From: Steinar H. Gunderson Date: Mon, 17 Feb 2020 19:00:50 +0000 (+0100) Subject: Fix an assertion error when FFmpeg inputs were dropping frames. X-Git-Tag: 1.9.2~33 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=6fe0ba86faca3769c57bf30cbf526959b418fc9a Fix an assertion error when FFmpeg inputs were dropping frames. --- diff --git a/nageru/audio_mixer.cpp b/nageru/audio_mixer.cpp index 360689b..cef3c3c 100644 --- a/nageru/audio_mixer.cpp +++ b/nageru/audio_mixer.cpp @@ -320,7 +320,12 @@ bool AudioMixer::add_audio(DeviceSpec device_spec, const uint8_t *data, unsigned } unsigned num_channels = device->interesting_channels.size(); - assert(num_channels > 0); + if (num_channels == 0) { + // No buses use this device; throw it away. (Normally, we should not + // be here, but probably, we are in the process of changing a mapping, + // and the queue just isn't gone yet. In any case, returning is harmless.) + return true; + } // Convert the audio to fp32. unique_ptr audio(new float[num_samples * num_channels]);