Bug 227864

Summary: [MSE] sequence mode is broken if GPU Process is enabled
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: MediaAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: calvaris, eric.carlson, ews-watchlist, glenn, jer.noble, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Jean-Yves Avenard [:jya] 2021-07-11 19:35:19 PDT
if sequence mode is explicitly set, or if generate timestamps flag is true (such as when using MSE with raw mpeg audio or aac) each time you call SourceBuffer.appendBuffer the timestampOffset will be amended.

However, if the GPU Process is enabled, then the value of the timestamp offset is only updated in the GPU Process. If we read the value in the web content process, this value will always be 0.
Comment 1 Radar WebKit Bug Importer 2021-07-11 19:35:46 PDT
<rdar://problem/80445041>
Comment 2 Jean-Yves Avenard [:jya] 2021-07-14 03:39:32 PDT
Fly-by notice:

In the spec we read:
3.5.8 Coded Frame Processing
[...]
3.5.8.3 If mode equals "sequence" and group start timestamp is set, then run the following steps:
   1. Set timestampOffset equal to group start timestamp - presentation timestamp.
   2. Set group end timestamp equal to group start timestamp.
   3. Set the need random access point flag on all track buffers to true.
   4, Unset group start timestamp.

But in the code we do:
https://webkit-search.igalia.com/webkit/rev/d08a57141296609b7f8a171e989aa141afa12244/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp#891-892

            // 1.3.1 Set timestampOffset equal to group start timestamp - presentation timestamp.
            m_timestampOffset = m_groupStartTimestamp;

m_timestampOffset isn't set properly here.
Comment 3 Jean-Yves Avenard [:jya] 2021-07-14 04:01:54 PDT
Created attachment 433495 [details]
Patch
Comment 4 EWS 2021-07-15 19:07:54 PDT
Committed r279973 (239716@main): <https://commits.webkit.org/239716@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 433495 [details].