Repository navigation
Commit 3a0c494
committed
MEDIA_ERR_ABORTED after restore page with media from bfcache
https://bugs.webkit.org/show_bug.cgi?id=319665
Reviewed by Alicia Boya Garcia and Nikolas Zimmermann.
This bundles three related fixes uncovered while restoring pages containing
a media element (e.g.: "video") from the back/forward cache:
1. HTMLMediaElement::suspend() destroyed the media player on entering the
cache (via stopWithoutDestroyingMediaPlayer() -> userCancelledLoad()),
so a restored page reported video.error.code == MEDIA_ERR_ABORTED.
userCancelledLoad() now takes a destroyMediaPlayer flag, false for the
BackForwardCache suspension path, so it early-returns instead of tearing
the player down.
2. A <video> that was playing before being cached did not resume playing
after restore. HTMLMediaElement::resume() schedules an updatePlayState()
task while the media session is still interrupted. mayResumePlayback()
now also retries updatePlayState() when the element isn't paused.
3. A <video> that was paused before being cached showed a blank/white
frame instead of its last decoded frame after restore. Restoring a page
rebuilds the render tree, so CoordinatedPlatformLayerBufferProxy gets
attached to a brand new CoordinatedPlatformLayer with no buffer of its
own, and a paused GStreamer pipeline has no new sample to push. The
proxy now invokes a layer-attached callback whenever a new non-null
layer is attached, which MediaPlayerPrivateGStreamer uses to re-deliver
its current sample so the new layer isn't left blank.
Also fixes a related macOS-only assert crash (ASSERTION FAILED:
m_mediaSessions.contains(identifier) in MediaUsageManagerCocoa::
updateMediaUsage): the UI process unconditionally clears its usage-tracking
map on every navigation commit, including a back/forward cache restore, but
MediaElementSession kept believing it had already added its session across
the whole suspend/resume cycle. mediaUsageManagerSessionWillBeSuspended()
resets that flag on suspend so the next update re-adds the session first.
A LayoutTest for the playing-before-caching scenario (fix #2):
it plays a video, waits for the playing event, navigates away and
back via history.back(), and asserts the video is still not paused and
currentTime has advanced after restore.
Added a LayoutTest based on media/restore-from-page-cache.html for a video
that was paused before entering the cache, as a real pixel/screenshot
comparison to catch the blank-frame regression from fix #3.
Tests: media/restore-from-page-cache-paused.html
media/restore-from-page-cache-playing.html
* LayoutTests/media/restore-from-page-cache-paused-expected.png: Added.
* LayoutTests/media/restore-from-page-cache-paused-expected.txt: Added.
* LayoutTests/media/restore-from-page-cache-paused.html: Added.
* LayoutTests/media/restore-from-page-cache-playing-expected.txt: Added.
* LayoutTests/media/restore-from-page-cache-playing.html: Added.
* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::userCancelledLoad):
(WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
(WebCore::HTMLMediaElement::suspend):
(WebCore::HTMLMediaElement::mayResumePlayback):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::mediaUsageManagerSessionWillBeSuspended):
* Source/WebCore/html/MediaElementSession.h:
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint):
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferProxy.cpp:
(WebCore::CoordinatedPlatformLayerBufferProxy::CoordinatedPlatformLayerBufferProxy):
(WebCore::CoordinatedPlatformLayerBufferProxy::create):
(WebCore::CoordinatedPlatformLayerBufferProxy::setTargetLayer):
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferProxy.h:
Canonical link: https://commits.webkit.org/319472@main1 parent 54382f2 commit 3a0c494
18 files changed
Lines changed: 298 additions & 20 deletions
File tree
- LayoutTests
- media
- platform/ios
- Source/WebCore
- html
- platform/graphics
- gstreamer
- texmap
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2643 | 2643 | | |
2644 | 2644 | | |
2645 | 2645 | | |
| 2646 | + | |
2646 | 2647 | | |
2647 | 2648 | | |
2648 | 2649 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6523 | 6523 | | |
6524 | 6524 | | |
6525 | 6525 | | |
6526 | | - | |
| 6526 | + | |
6527 | 6527 | | |
6528 | 6528 | | |
6529 | 6529 | | |
6530 | 6530 | | |
6531 | 6531 | | |
| 6532 | + | |
6532 | 6533 | | |
6533 | 6534 | | |
6534 | 6535 | | |
6535 | | - | |
| 6536 | + | |
6536 | 6537 | | |
6537 | 6538 | | |
6538 | 6539 | | |
| |||
6665 | 6666 | | |
6666 | 6667 | | |
6667 | 6668 | | |
6668 | | - | |
| 6669 | + | |
6669 | 6670 | | |
6670 | 6671 | | |
6671 | 6672 | | |
| |||
6718 | 6719 | | |
6719 | 6720 | | |
6720 | 6721 | | |
6721 | | - | |
| 6722 | + | |
6722 | 6723 | | |
| 6724 | + | |
| 6725 | + | |
6723 | 6726 | | |
6724 | 6727 | | |
6725 | 6728 | | |
| |||
8912 | 8915 | | |
8913 | 8916 | | |
8914 | 8917 | | |
8915 | | - | |
8916 | | - | |
| 8918 | + | |
| 8919 | + | |
| 8920 | + | |
| 8921 | + | |
| 8922 | + | |
| 8923 | + | |
| 8924 | + | |
| 8925 | + | |
| 8926 | + | |
| 8927 | + | |
8917 | 8928 | | |
8918 | 8929 | | |
8919 | 8930 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
911 | | - | |
| 911 | + | |
| 912 | + | |
912 | 913 | | |
913 | 914 | | |
914 | 915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
209 | 221 | | |
210 | 222 | | |
211 | 223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| |||
0 commit comments