Skip to content

Commit 3b2979e

Browse files
asurdej-comcasteocanha
authored andcommitted
[GStreamer][MSE] Push STREAM_COLLECTION event after flushing
https://bugs.webkit.org/show_bug.cgi?id=262193 Reviewed by Alicia Boya Garcia <aboya@igalia.com>. Flushing the playback pipeline when very first buffers are being pushed downstream causes STREAM_COLLECTION event to be dropped before reaching decodebin3. As a result playback never starts after flush (buffer push return not-linked). This happens on initial seek sometimes, when it is triggered at the same time that first buffers push. STREAM_COLLECTION is dropped by GstBaseParse element specificaly that is caching events and sending them with first frame. Unfortunately flushing will drop all pending events if first frame is not ready yet. Original author: Andrzej Surdej (https://github.com/asurdej-comcast) See: #1197 * Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcStreamFlush): Reset hasPushedStreamCollectionEvent at the end of the flush to force sending of the STREAM_COLLECTION event after that. Only for GStreamer versions that don't have a proper fix yet. Canonical link: https://commits.webkit.org/268582@main
1 parent 674ac36 commit 3b2979e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,18 @@ static void webKitMediaSrcStreamFlush(Stream* stream, bool isSeekingFlush)
660660
GST_DEBUG_OBJECT(stream->pad.get(), "StreamingMembers mutex taken, using it to set isFlushing = false.");
661661
streamingMembers->isFlushing = false;
662662
streamingMembers->doesNeedSegmentEvent = true;
663+
664+
if (!webkitGstCheckVersion(1, 22, 0)) {
665+
// In older GST versions STREAM_COLLECTION event is delivered to decodebin3
666+
// from parsebin src pad probe. On the way, this event is cached inside
667+
// parser element (GstBaseParse) and pushed downstream with first frame.
668+
// Flushing before first frame is handled by the parser,
669+
// the event is dropped from GstBaseParse and never reaches decodebin3.
670+
// GST 1.21.3 added STREAM_COLLECTION event handling on decodebin3 sink pad directly
671+
// so this workaround is not needed anymore.
672+
GST_DEBUG_OBJECT(stream->pad.get(), "Reset hasPushedStreamCollectionEvent");
673+
streamingMembers->hasPushedStreamCollectionEvent = false;
674+
}
663675
}
664676

665677
GST_DEBUG_OBJECT(stream->pad.get(), "Sending FLUSH_STOP downstream (resetTime = %s).", boolForPrinting(isSeekingFlush));

0 commit comments

Comments
 (0)