opusdec: no sound after decoding error
We are developing application using gstreamer. We use gstreamer pipeline to mix several incoming audio streams (RTP, opus) to 1 audio stream in runtime. Pipeline is on the picture attached. Packets are received from network and handed off to pipeline as is. Sometimes (quite rarely) one of incoming streams stops being heard in resulting mixed stream, and we get error in logs:
Could not decode stream. gstopusdec.c(661): GstFlowReturn opus_dec_chain_parse_data(GstOpusDec *, GstBuffer *) (): /GstPipeline:pipeline/GstOpusDec:opusdec63_ada297c3-6932-4232-aa89-a2da8b67307d: Decoding error (-1): invalid argument
In our code we have the following call:
gst_audio_decoder_set_max_errors(GST_AUDIO_DECODER(dec), -1);
so decoding errors should be ignored and should not lead to stopping the pipeline.
We've performed the short investigation, this message is generated in libopus library, in opus_multistream_decode_native() function.
Invalid Argument error is returned in the next cases:
size of input buffer (encoded) passed as an argument is less than zero;
size of output buffer (decoded) passed as an argument is less than or equal to zero.
Both of this arguments are calculated in GStreamer's opus_dec_chain_parse_data() function. It seems this arguments calculations might contain bugs.