Bug 256955 - [GStreamer][MSE] Append pipeline can fail to handle multiple initialization segments
Summary: [GStreamer][MSE] Append pipeline can fail to handle multiple initialization s...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-18 02:20 PDT by Arnaud Vrac
Modified: 2023-06-07 06:15 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arnaud Vrac 2023-05-18 02:20:37 PDT
A recent GStreamer change (https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4535) triggers issues when dealing with multiple initialization segments on the same track. With this change AppendPipeline will trigger a ParsingFailed error. Here's an extract of the logs to illustrate the problem:

> basesink gstbasesink.c:3657:gst_base_sink_event:<appsink2> received event 0x7f080056c0 stream-start event: 0x7f080056c0, time 99:99:99.999999999, seq-num 3723, GstEventStreamStart, stream-id=(string)1e0cd2c71ed662e1e145048bfaef7523/001, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)2;
> basesink gstbasesink.c:3701:gst_base_sink_event:<appsink2> Event received after EOS, dropping
>webkitmse AppendPipeline.cpp:1016:appendPipelineAppsinkPadEventProbe: Handling event stream-start on append pipeline appsinkPad
> basesink gstbasesink.c:3657:gst_base_sink_event:<appsink2> received event 0x7f080056c0 stream-start event: 0x7f080056c0, time 99:99:99.999999999, seq-num 3723, GstEventStreamStart, stream-id=(string)1e0cd2c71ed662e1e145048bfaef7523/001, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)2;
> basesink gstbasesink.c:3701:gst_base_sink_event:<appsink2> Event received after EOS, dropping
>  basesrc gstbasesrc.c:3132:gst_base_src_loop:<appsrc0> error: Internal data stream error.
>  basesrc gstbasesrc.c:3132:gst_base_src_loop:<appsrc0> error: streaming stopped, reason error (-5)
>structure gststructure.c:2093:priv_gst_structure_append_to_gstring: No value transform to serialize field 'gerror' of type 'GError'
>webkitmse AppendPipeline.cpp:266:handleErrorSyncMessage:<append-pipeline-video-mp4-0> Demuxing error: error message: 0x7f0800fe00, time 99:99:99.999999999, seq-num 3742, element 'appsrc0', GstMessageError, gerror=(GError)NULL, debug=(string)"../gitsrc/subprojects/gstreamer/libs/gst/base/gstbasesrc.c\(3132\):\ gst_base_src_loop\ \(\):\ /GstPipeline:append-pipeline-video-mp4-0/GstAppSrc:appsrc0:\012streaming\ stopped\,\ reason\ error\ \(-5\)", details=(structure)"details\,\ flow-return\=\(int\)-5\;";
>[WPEWebKit:MediaSource:-] SourceBuffer::sourceBufferPrivateAppendComplete(6467E18DC2CA0001) ParsingFailed

With this change, EOS will be propagated downstream to the AppendPipeline appsink, and the next stream-start event that is generated when the new init segment comes in is dropped, resulting in an error. Before the gstreamer change, the eos was not propagated to the appsink so the problem did not happen. Reverting the change is sufficient to fix the issue.

I've tried the following patch in bug 254664 and it does not help, instead I get another error:

>webkitmse AppendPipeline.cpp:1015:appendPipelineAppsinkPadEventProbe: Handling event eos on append pipeline appsinkPad
>webkitmse AppendPipeline.cpp:172:operator():<append-pipeline-video-mp4-0> Posting no-more-pads task to main thread
>webkitmse AppendPipeline.cpp:492:didReceiveInitializationSegment:<append-pipeline-video-mp4-0> New demuxed stream topology doesn't match the existing tracks topology
Comment 1 Philippe Normand 2023-05-19 07:26:48 PDT
I've tested 1.23.3 and Xabier's patch from bug 254664 on YT, on a video with ad-breaks and it plays as expected.

Arnaud, can you share your use-case?
Comment 2 Arnaud Vrac 2023-06-07 06:15:29 PDT
With the final version of Xavier's patch merged in master, I am not able to reproduce the issue anymore. Sorry for not posting a test, I didn't have one I could share.