summaryrefslogtreecommitdiffstats
path: root/src/dabplus-enc.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-04-01 10:42:09 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-04-01 10:42:09 +0200
commit02bdb041dff6d191c62eea36c4bc155caf2d90f7 (patch)
tree5d4c7889ec09a67e34d4d972eef7b46f881195b5 /src/dabplus-enc.cpp
parentc5cbfc7e8feb92a65a825698f6c9ca7f6df652db (diff)
downloadODR-AudioEnc-02bdb041dff6d191c62eea36c4bc155caf2d90f7.tar.gz
ODR-AudioEnc-02bdb041dff6d191c62eea36c4bc155caf2d90f7.tar.bz2
ODR-AudioEnc-02bdb041dff6d191c62eea36c4bc155caf2d90f7.zip
Fix silence detection in DAB mode
Diffstat (limited to 'src/dabplus-enc.cpp')
-rw-r--r--src/dabplus-enc.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp
index 34add1c..0fbe860 100644
--- a/src/dabplus-enc.cpp
+++ b/src/dabplus-enc.cpp
@@ -982,12 +982,13 @@ int main(int argc, char *argv[])
/* Silence detection */
if (die_on_silence && MAX(peak_left, peak_right) == 0) {
- const unsigned int dabplus_superframe_msec = 120ul;
- const unsigned int frame_time_msec =
- dabplus_superframe_msec / enc_calls_per_output;
+ const unsigned int frame_time_msec = 1000ul *
+ read_bytes / (BYTES_PER_SAMPLE * channels * sample_rate);
measured_silence_ms += frame_time_msec;
+ printf("%ld bytes is %dms\n", read_bytes, frame_time_msec);
+
if (measured_silence_ms > 1000*silence_timeout) {
fprintf(stderr, "Silence detected for %d seconds, aborting.\n",
silence_timeout);