adaptivedemux2: Recheck for a pending track on drain
authorJan Schmidt <jan@centricular.com>
Thu, 30 Jun 2022 16:07:05 +0000 (02:07 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 4 Aug 2022 12:43:31 +0000 (13:43 +0100)
When a track is completely drained and EOS, but
there's a pending track on the slot loop again
to switch to that track.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2838>

subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c

index 2e977dc..8925454 100644 (file)
@@ -3657,6 +3657,15 @@ restart:
         /* This should only happen if the track is EOS, or exactly in between
          * the parser outputting segment/caps before buffers. */
         g_assert (track->eos || !slot->pushed_timed_data);
+
+        /* If we drained the track, but there's a pending track on the slot
+         * loop again to activate it */
+        if (slot->pending_track) {
+          GST_DEBUG_OBJECT (demux,
+              "Track '%s' (period %u) drained, but has a pending track to activate",
+              track->stream_id, track->period_num);
+          goto restart;
+        }
         break;
       }