From: Steinar H. Gunderson Date: Fri, 27 Apr 2018 20:26:25 +0000 (+0200) Subject: Loosen up an assert that would sometimes trigger when resetting FFmpeg sources. X-Git-Tag: 1.7.2~8 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=0bfd1b5f36ae867802a3672211691602b19bb75d Loosen up an assert that would sometimes trigger when resetting FFmpeg sources. --- diff --git a/bmusb b/bmusb index e287f28..6a012a4 160000 --- a/bmusb +++ b/bmusb @@ -1 +1 @@ -Subproject commit e287f28087aef9cfd6aa47acd0d283bc177a9d70 +Subproject commit 6a012a41c5422092cdac1f18a9019f37c0b85368 diff --git a/resampling_queue.cpp b/resampling_queue.cpp index a1a2395..ef7b735 100644 --- a/resampling_queue.cpp +++ b/resampling_queue.cpp @@ -60,7 +60,11 @@ void ResamplingQueue::add_input_samples(steady_clock::time_point ts, const float a1.good_sample = good_sample; if (a0.good_sample && a1.good_sample) { current_estimated_freq_in = (a1.input_samples_received - a0.input_samples_received) / duration(a1.ts - a0.ts).count(); - assert(current_estimated_freq_in >= 0.0); + if (!(current_estimated_freq_in >= 0.0)) { + fprintf(stderr, "%s: PANIC: Input audio clock going backwards, ignoring.\n", + spec_to_string(device_spec).c_str()); + current_estimated_freq_in = freq_in; + } // Bound the frequency, so that a single wild result won't throw the filter off guard. current_estimated_freq_in = min(current_estimated_freq_in, 1.2 * freq_in);