]> git.sesse.net Git - nageru/blobdiff - nageru/audio_mixer.cpp
Fix an assertion error when FFmpeg inputs were dropping frames.
[nageru] / nageru / audio_mixer.cpp
index 360689b83406b04e6737cb6b7815d4092aca0a90..cef3c3c87fb31416b78e50c7ac601797265f41f3 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]);