Fix an assertion error when FFmpeg inputs were dropping frames.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 17 Feb 2020 19:00:50 +0000 (20:00 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 17 Feb 2020 19:00:50 +0000 (20:00 +0100)
nageru/audio_mixer.cpp

index 360689b..cef3c3c 100644 (file)
@@ -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<float[]> audio(new float[num_samples * num_channels]);