Bug 253997 - MockSourceBufferPrivate should only process samples once init segment has been processed.
Summary: MockSourceBufferPrivate should only process samples once init segment has bee...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
Depends on:
Blocks: 225367
  Show dependency treegraph
 
Reported: 2023-03-15 18:34 PDT by Jean-Yves Avenard [:jya]
Modified: 2023-03-17 10:43 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2023-03-15 18:34:35 PDT
This blocks bug 225367.

Currently, MockSourceBufferPrivate::append process init and media segments in the same loop. [1]

Immediately after parsing the init segment, it calls SourceBufferPrivate::didReceiveSample

SourceBufferPrivate::didReceiveSample will drop any frames with an unknown track buffer ID. [2]

This is fine when the MockSourceBufferPrivate runs in the content process and the entire append operation is synchronous.
However, when the operation occurs in the GPU Process, the track id will not be usable until the initialisation segment has been sent back to the content process to be processed by the SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment [3] so that it can create a new TrackBuffer.

the SourceBufferPrivateAVFObjC will queue all demuxed frames until after sourceBufferPrivateDidReceiveInitializationSegment has completed (which is an asynchronous operation). and only call SourceBufferPrivate::didReceiveSample once done [4]

[1] https://searchfox.org/wubkat/rev/23d40f46815dafd5828fa1932569943b85f8f24e/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp#141-157
[2] https://searchfox.org/wubkat/rev/23d40f46815dafd5828fa1932569943b85f8f24e/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp#670-679
[3] https://searchfox.org/wubkat/source/Source/WebCore/Modules/mediasource/SourceBuffer.cpp#856-857
[4] https://searchfox.org/wubkat/rev/23d40f46815dafd5828fa1932569943b85f8f24e/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm#466-474
Comment 1 Jean-Yves Avenard [:jya] 2023-03-15 18:36:36 PDT
We need to have MockSourceBufferPrivate follow a similar pattern or SourceBufferPrivateAVFObjC ; or preferably have SourceBufferPrivate handle this in a platform agnostic fashion.

The latter allowing to wrap all SourceBufferPrivate implementation in a RemoteSourceBufferPrivate (and run in the GPU Process)
Comment 2 Radar WebKit Bug Importer 2023-03-15 18:36:54 PDT
<rdar://problem/106784564>
Comment 3 Jean-Yves Avenard [:jya] 2023-03-16 02:27:55 PDT
Pull request: https://github.com/WebKit/WebKit/pull/11599
Comment 4 EWS 2023-03-17 10:43:34 PDT
Committed 261799@main (30fd635c1cbe): <https://commits.webkit.org/261799@main>

Reviewed commits have been landed. Closing PR #11599 and removing active labels.