audioaggregator: Use an ad-hoc converter when changing srcpad caps
Copied from https://gitlab.freedesktop.org//gstreamer/gst-plugins-base/-/merge_requests/1117
The sinkpad converters created by
gst_audio_aggregator_convert_pad_update_converter
cannot be used:
-
The converter-config could be invalid for this conversion. For example, applying the mix-matrix to this internal conversion makes no sense.
-
The function resets
converter_config_changed
, assuming that the the provided infos are for the sinkpad → srcpad conversion. This can leave the pad in a bad state, set up with the wrong resampler, causing a buffer overflow when it next attempts this conversion.
FIXME: This still feels really brittle and could cause glitches when the conversion doesn't match what the sinkpad converters would have created for the new caps. I think the audioaggregator should probably keep the pre-conversion sinkpad buffers around and re-convert to the new caps instead of attempting to convert between internal formats.