diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-03-07 11:36:17 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-03-07 11:36:17 +0100 |
commit | 5e9fe473ba528f336dd86ce9d3d7d3e40410db54 (patch) | |
tree | 6e4f6276f7192edc3d9db04cd68265e3e8d8f1bb | |
parent | 5cb6703b20d269608eef98fbc107cb0b1136018e (diff) | |
download | ODR-AudioEnc-5e9fe473ba528f336dd86ce9d3d7d3e40410db54.tar.gz ODR-AudioEnc-5e9fe473ba528f336dd86ce9d3d7d3e40410db54.tar.bz2 ODR-AudioEnc-5e9fe473ba528f336dd86ce9d3d7d3e40410db54.zip |
add 120ms delay
-rw-r--r-- | src/AlsaDabplus.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/AlsaDabplus.cpp b/src/AlsaDabplus.cpp index 758d96e..ea81bda 100644 --- a/src/AlsaDabplus.cpp +++ b/src/AlsaDabplus.cpp @@ -90,6 +90,7 @@ int prepare_aac_encoder( return 1; } + *encoder = handle; if(channels == 2 && subchannel_index <= 6) aot = AOT_DABPLUS_PS; @@ -362,6 +363,19 @@ int main(int argc, char *argv[]) { fprintf(stderr, "."); // -------------- wait 120ms (one DAB+ superframe) + tp.tv_nsec += 120000000; + if (tp.tv_nsec > 1000000000L) { + tp.tv_nsec -= 1000000000L; + tp.tv_sec += 1; + } + + struct timespec tp_now; + do { + usleep(10000); + clock_gettime(CLOCK_MONOTONIC, &tp); + } while (tp_now.tv_sec < tp.tv_sec || + ( tp_now.tv_sec == tp.tv_sec && + tp_now.tv_nsec < tp.tv_nsec) ); } |