Bug 254256
| Summary: | `playing` event isn't fired as early as it should | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
| Component: | Media | Assignee: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: |
https://bugs.webkit.org/show_bug.cgi?id=225396 https://bugs.webkit.org/show_bug.cgi?id=239471 |
||
Jean-Yves Avenard [:jya]
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/107041118>
Jean-Yves Avenard [:jya]
Pull request: https://github.com/WebKit/WebKit/pull/11797
EWS
Committed 261959@main (84eb2324cde9): <https://commits.webkit.org/261959@main>
Reviewed commits have been landed. Closing PR #11797 and removing active labels.