From 02bdb041dff6d191c62eea36c4bc155caf2d90f7 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 1 Apr 2016 10:42:09 +0200 Subject: Fix silence detection in DAB mode --- src/dabplus-enc.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/dabplus-enc.cpp') 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); -- cgit v1.2.3