playbin3: switching the only track being played from matroska file fail with GST_FLOW_NOT_LINKED
Describe your issue
When I use playbin3 to play a matroska file with multiple tracks while I am only able to play one at a time, switching track often ends up stopping playback because the source got GST_FLOW_NOT_LINKED.
Expected Behavior
I should be able to switch tracks without error
Observed Behavior
The flow combiner used in matroskademux has all the tracks not linked except one, and if you are out of luck, switching track while the streaming thread was pushing to the only track that was linked and is not anymore will make the flow combiner return GST_FLOW_NOT_LINKED to the source.
Setup
To be able to easily reproduce this issue, here is the pipeline I used to generate a mkv with 2 audio tracks, one AAC and the other AC3
gst-launch-1.0 \
audiotestsrc num-buffers=1000 tick-interval=1000000000 wave=ticks ! \
audio/x-raw,channels=2,rate=44100 ! \
avenc_ac3 name=a \
audiotestsrc num-buffers=1000 tick-interval=500000000 wave=ticks ! \
audio/x-raw,channels=2,rate=44100 ! \
fdkaacenc name=b \
matroskamux name=m ! \
filesink sync=false location=no_vid.mkv \
b. ! m.audio_1 \
a. ! m.audio_0
no_vid.mkv is attached, but I also attached an ffmpeg remux of this file (because mpv was complaining about no_vid.mkv).
Steps to reproduce the bug
Use gst-play and cycle through the audio tracks Interestingly no_vid.mkv reproduces the issue less frequently than the ffmpeg remux.
# gst-play-1.0 --use-playbin3 no_vid.mkv
Press 'k' to see a list of keyboard shortcuts.
Now playing /tmp/no_vid.mkv
Redistribute latency...
Redistribute latency...
Switching to audio track 2 of 2 (English).
ERROR Internal data stream error. for file:///tmp/no_vid.mkv
ERROR debug information: ../gstreamer/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c(6115): gst_matroska_demux_loop (): /GstPlayBin3:playbin/GstURIDecodeBin3:uridecodebin3/GstURISourceBin:urisourcebin0/GstParseBin:parsebin0/GstMatroskaDemux:matroskademux0:
streaming stopped, reason not-linked (-1)
Reached end of play list.