RESOLVED FIXED283443
VideoMediaSampleRenderer can resolve its `WhenHasAvailableVideoFrame` callback with a flushed frame.
https://bugs.webkit.org/show_bug.cgi?id=283443
Summary VideoMediaSampleRenderer can resolve its `WhenHasAvailableVideoFrame` callbac...
Jean-Yves Avenard [:jya]
Reported 2024-11-20 14:23:48 PST
Noticed when I was trying to understand why a test intermittently timed out. When we do: ``` let v = document.getElementsByTagName('video')[0]; v.src = "content/test-vp8-hiddenframes.webm"; await waitFor(v, 'loadedmetadata', true); // duration of the last frame. v.currentTime = v.duration - 0.038; let p1 = new Promise(resolve => v.requestVideoFrameCallback(resolve)); let p2 = waitFor(v, 'seeked', true); await Promise.all([ p1, p2 ]); ``` the p1 promise here may not always be resolved. The reason being is: when the video is being loaded, we immediately start decoding video. The MediaPlayerPrivate feeds the data to the VideoMediaSampleRenderer, set the WhenHasAvailableVideoFrame callback. Shortly after the VideoMediaSampleRenderer decode the frame, push it to the renderer and queue a task back to the main thread to call the WhenHasAvailableVideoFrame callback. In between, the player is now seeking, it flushes the VideoMediaSampleRenderer, pushes the new frames to decode and set a new WhenHasAvailableVideoFrame callback. Just at this time the pending WhenHasAvailableVideoFrame queued gets called, once called the callback gets cleared. The MediaPlayerPrivate now believes that the seek is complete to the right frame when there's now no frame displayed has the seek started and all decoded frames got flushed. The new decoded frame pushed for seeking now gets decoded and another WhenHasAvailableVideoFrame gets called, but by this time the callback is cleared (see above). We never call the requestVideoFrameCallback's callback
Attachments
Radar WebKit Bug Importer
Comment 1 2024-11-20 14:24:20 PST
Jean-Yves Avenard [:jya]
Comment 2 2024-11-20 17:06:31 PST
EWS
Comment 3 2024-11-22 04:43:43 PST
Committed 286949@main (284f68f80bbb): <https://commits.webkit.org/286949@main> Reviewed commits have been landed. Closing PR #36924 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.