RESOLVED FIXED 254256
`playing` event isn't fired as early as it should
https://bugs.webkit.org/show_bug.cgi?id=254256
Summary `playing` event isn't fired as early as it should
Jean-Yves Avenard [:jya]
Reported 2023-03-21 23:34:27 PDT
In bug 225396, changes were added to reduce how many times the content process would poll the MediaPlayer running in the GPU process. This was done through simulating the currentTime progress by using the wall clock to assume by how much the MediaPlayer's currentTime actually progressed. This caused regression where when the real currentTime was re-synchronised, it could make the clock appears to go backward due to drift. In bug 239471 a check was added to force the refresh and notify the HTMLMediaElement that the time changed if it did go backward [1]. When we call `play()` on a media element, it waits to be notified of a time change [2] to determine if playback has started, and then fire the `playing` event [3] However, when the MediaPlayer update the currentTime for the first time, it calls `MediaPlayerPrivateRemote::currentTimeChanged` followed by multiple calls `MediaPlayerPrivateRemote::timeChanged` whenever some significant player change occurs. The first time `MediaPlayerPrivateRemote::currentTimeChanged` is called, the previous currentTime was 0, the new time is positive and so we don't call HTMLMediaPlayer::mediaPlayerTimeChanged() [2] only on following call to timeChanged will the HTMLMediaElement be notified [4] As such, we only fire `playing` after the 2nd time update by the MediaPlayer rather than the first. This issue is exposed by the MocKMSE test `media/media-source/media-source-end-of-stream-buffered.html` as the MockMediaPlayer only ever send a single time update. [1]https://searchfox.org/wubkat/rev/c1fb4e9f678eb1aacf9b056070aced47d70502f7/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp#418-429 [2]https://searchfox.org/wubkat/rev/c1fb4e9f678eb1aacf9b056070aced47d70502f7/Source/WebCore/html/HTMLMediaElement.cpp#5335 [3]https://searchfox.org/wubkat/rev/c1fb4e9f678eb1aacf9b056070aced47d70502f7/Source/WebCore/html/HTMLMediaElement.cpp#5966 [4]https://searchfox.org/wubkat/rev/c1fb4e9f678eb1aacf9b056070aced47d70502f7/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp#366-369
Attachments
Radar WebKit Bug Importer
Comment 1 2023-03-21 23:35:01 PDT
Jean-Yves Avenard [:jya]
Comment 2 2023-03-21 23:57:17 PDT
EWS
Comment 3 2023-03-22 05:08:57 PDT
Committed 261959@main (84eb2324cde9): <https://commits.webkit.org/261959@main> Reviewed commits have been landed. Closing PR #11797 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.