haikuwebkit/LayoutTests/media/media-source
Tomoki Imai 8c01c82de4 Missing playing events when the ready state becomes HAVE_FUTURE_DATA/HAVE_ENOUGH_DATA from HAVE_METADATA state
https://bugs.webkit.org/show_bug.cgi?id=228531

Reviewed by Eric Carlson.

Source/WebCore:

The main issue is that missing playing event when the ready state becomes HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA from HAVE_METADATA.
According to the specification, we need to "notify about playing" in the following cases:
- If the previous ready state was HAVE_CURRENT_DATA or less, and the new ready state is HAVE_FUTURE_DATA, and it's not paused.
- If the new ready state is HAVE_ENOUGH_DATA, and it's eligible for autoplay
The implementation didn't cover these cases and had web compatibility issues.

We also should move scheduleNotifyAboutPlaying from setPlaying to playInternal and checks the ready state.
- Without this change, playing event is fired twice. The first one is fired by setReadyState, and the second is called from setPlaying.
- According to the specification, scheduleNotifyAboutPlaying should be in  "internal play steps" and check the ready state.
  Checking ready state fixes the issue where playing event is fired twice.

Test: media/media-source/media-source-monitor-playing-event.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setReadyState): Added missing scheduleNotifyAboutPlaying calls. Added do-while to make the implementation similar to the specification text
(WebCore::HTMLMediaElement::playInternal): Added scheduleNotifyAboutPlaying call.
                                           According to the specification, "internal play steps" should "notify about playing" when
                                           the ready state is HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA.
(WebCore::HTMLMediaElement::setPlaying): Removed scheduleNotifyAboutPlaying call because playInternal now calls scheduleNotifyAboutPlaying instead.

Reference:
- https://html.spec.whatwg.org/multipage/media.html#internal-play-steps
- https://html.spec.whatwg.org/multipage/media.html#ready-states

LayoutTests:

Added the testcase to checks if the playing event is fired correctly on the ready state changes.

* media/media-source/media-source-monitor-playing-event-expected.txt: Added.
* media/media-source/media-source-monitor-playing-event.html: Added.


Canonical link: https://commits.webkit.org/240103@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-30 06:43:48 +00:00
..
content Migrate Monterey expectations to OpenSource and bump version numbers 2021-07-22 20:59:06 +00:00
live-rewind-seek-and-evict-expected.txt [MSE] Infinite loop in sample eviction when duration is NaN 2020-11-20 12:19:20 +00:00
live-rewind-seek-and-evict.html [MSE] Infinite loop in sample eviction when duration is NaN 2020-11-20 12:19:20 +00:00
media-mp4-h264-partial-abort-expected.txt SourceBuffer.abort() doesn't go back to state WAITING_FOR_SEGMENT properly 2021-07-14 05:12:26 +00:00
media-mp4-h264-partial-abort.html SourceBuffer.abort() doesn't go back to state WAITING_FOR_SEGMENT properly 2021-07-14 05:12:26 +00:00
media-mp4-h264-sequence-mode-expected.txt [MSE] sequence mode is broken if GPU Process is enabled 2021-07-16 02:07:47 +00:00
media-mp4-h264-sequence-mode.html [MSE] sequence mode is broken if GPU Process is enabled 2021-07-16 02:07:47 +00:00
media-source-abort-resets-parser-expected.txt
media-source-abort-resets-parser.html
media-source-addsourcebuffer-after-canplaytype-expected.txt [GPUP] MediaSource.addSourceBuffer() will throw if given the same parameter as a previous call to HTMLMediaElement.canPlayType() 2021-04-14 06:24:06 +00:00
media-source-addsourcebuffer-after-canplaytype.html [GPUP] MediaSource.addSourceBuffer() will throw if given the same parameter as a previous call to HTMLMediaElement.canPlayType() 2021-04-14 06:24:06 +00:00
media-source-addsourcebuffer-expected.txt
media-source-addsourcebuffer.html
media-source-append-acb-no-frame-lost-expected.txt
media-source-append-acb-no-frame-lost.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-append-acb-tolerance-expected.txt
media-source-append-acb-tolerance.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-append-before-last-range-no-quota-exceeded-expected.txt [MSE] Infinite loop in sample eviction when duration is NaN 2020-11-20 12:19:20 +00:00
media-source-append-before-last-range-no-quota-exceeded.html
media-source-append-buffer-expected.txt
media-source-append-buffer-full-quota-exceeded-error-expected.txt [MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize. 2021-05-12 00:46:17 +00:00
media-source-append-buffer-full-quota-exceeded-error-onstart-expected.txt [MSE] Assertion if attempting to perform eviction before playback starts. 2021-06-09 01:02:55 +00:00
media-source-append-buffer-full-quota-exceeded-error-onstart.html [MSE] Assertion if attempting to perform eviction before playback starts. 2021-06-09 01:02:55 +00:00
media-source-append-buffer-full-quota-exceeded-error.html [MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize. 2021-05-12 00:46:17 +00:00
media-source-append-buffer-with-append-window-expected.txt
media-source-append-buffer-with-append-window.html
media-source-append-buffer.html
media-source-append-failed-expected.txt
media-source-append-failed.html
media-source-append-media-segment-without-init-expected.txt
media-source-append-media-segment-without-init.html
media-source-append-nonsync-sample-after-abort-expected.txt
media-source-append-nonsync-sample-after-abort.html
media-source-append-out-of-order-expected.txt
media-source-append-out-of-order.html
media-source-append-overlapping-dts-expected.txt
media-source-append-overlapping-dts.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-append-presentation-durations-expected.txt
media-source-append-presentation-durations.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-append-twice-overlapping-sync-frame-expected.txt
media-source-append-twice-overlapping-sync-frame.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-append-variable-frame-lengths-with-matching-durations-expected.txt
media-source-append-variable-frame-lengths-with-matching-durations.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-canplaythrough-event-expected.txt
media-source-canplaythrough-event.html
media-source-canplaythrough-expected.txt
media-source-canplaythrough.html
media-source-changetype-second-init-expected.txt
media-source-changetype-second-init.html
media-source-closed-expected.txt
media-source-closed.html
media-source-delaying-load-event-expected.txt
media-source-delaying-load-event.html
media-source-dropped-iframe-expected.txt
media-source-dropped-iframe.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-duplicate-seeked-expected.txt
media-source-duplicate-seeked.html
media-source-duration-after-append-expected.txt
media-source-duration-after-append.html
media-source-effectiveplaybackrate-expected.txt [Cocoa] Playback stalls on bilibili.com 2021-07-26 19:36:50 +00:00
media-source-effectiveplaybackrate.html [Cocoa] Playback stalls on bilibili.com 2021-07-26 19:36:50 +00:00
media-source-end-of-stream-buffered-expected.txt
media-source-end-of-stream-buffered.html
media-source-end-of-stream-expected.txt
media-source-end-of-stream-readyState-expected.txt
media-source-end-of-stream-readyState.html
media-source-end-of-stream.html
media-source-erase-after-last-append-expected.txt
media-source-erase-after-last-append.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-error-crash-expected.txt
media-source-error-crash.html
media-source-evict-codedframe-after-seek-expected.txt [MSE] MediaSample that need to be removed with SourceBufferPrivate::evictCodedFrames() may not be removed. 2021-05-27 04:35:17 +00:00
media-source-evict-codedframe-after-seek.html [MSE] MediaSample that need to be removed with SourceBufferPrivate::evictCodedFrames() may not be removed. 2021-05-27 04:35:17 +00:00
media-source-evict-codedframe-large-currenttime-expected.txt [MSE] When currentTime is a large value, it takes time to process SourceBufferPrivate::evictCodedFrames(). 2021-06-10 20:50:40 +00:00
media-source-evict-codedframe-large-currenttime.html [MSE] When currentTime is a large value, it takes time to process SourceBufferPrivate::evictCodedFrames(). 2021-06-10 20:50:40 +00:00
media-source-fastseek-expected.txt
media-source-fastseek.html
media-source-first-append-not-starting-at-zero-expected.txt
media-source-first-append-not-starting-at-zero.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-fudge-factor-expected.txt
media-source-fudge-factor.html
media-source-get-tracks-crash-expected.txt [MSE] Crash when getting audioTracks, videoTracks, textTracks of sourceBuffer after executing MediaSource::removeSourceBuffer() 2021-06-16 14:27:47 +00:00
media-source-get-tracks-crash.html [MSE] Crash when getting audioTracks, videoTracks, textTracks of sourceBuffer after executing MediaSource::removeSourceBuffer() 2021-06-16 14:27:47 +00:00
media-source-has-audio-video-expected.txt [Mac] MSE-based video pauses when put in background; PiP context menu disabled 2021-05-19 16:43:28 +00:00
media-source-has-audio-video.html [Mac] MSE-based video pauses when put in background; PiP context menu disabled 2021-05-19 16:43:28 +00:00
media-source-init-segment-duration-expected.txt
media-source-init-segment-duration.html
media-source-istypesupported-case-sensitive-expected.txt
media-source-istypesupported-case-sensitive.html
media-source-loadedmetada-with-two-sourcebuffers-expected.txt
media-source-loadedmetada-with-two-sourcebuffers.html
media-source-loader-simple.js
media-source-loader.js
media-source-minimumupcomingpresentationtime-expected.txt
media-source-minimumupcomingpresentationtime.html
media-source-monitor-playing-event-expected.txt Missing playing events when the ready state becomes HAVE_FUTURE_DATA/HAVE_ENOUGH_DATA from HAVE_METADATA state 2021-07-30 06:43:48 +00:00
media-source-monitor-playing-event.html Missing playing events when the ready state becomes HAVE_FUTURE_DATA/HAVE_ENOUGH_DATA from HAVE_METADATA state 2021-07-30 06:43:48 +00:00
media-source-monitor-source-buffers-expected.txt
media-source-monitor-source-buffers.html
media-source-multiple-initialization-segments-expected.txt
media-source-multiple-initialization-segments.html
media-source-no-preload-set-duration-crash-expected.txt [MSE][GStreamer] Crash in WebCore::PlaybackPipeline::addSourceBuffer when setting duration and preload is set to none 2021-04-12 13:41:38 +00:00
media-source-no-preload-set-duration-crash.html [MSE][GStreamer] Crash in WebCore::PlaybackPipeline::addSourceBuffer when setting duration and preload is set to none 2021-04-12 13:41:38 +00:00
media-source-overlapping-append-buffered-expected.txt
media-source-overlapping-append-buffered.html
media-source-overlapping-append-expected.txt
media-source-overlapping-append.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-overlapping-decodetime-expected.txt
media-source-overlapping-decodetime.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-page-cache-expected.txt
media-source-page-cache.html [Testing] Rename test header commands to match names in WebPreferences*.yaml 2020-10-13 17:16:15 +00:00
media-source-paint-to-canvas-expected.txt
media-source-paint-to-canvas.html
media-source-play-expected.txt
media-source-play.html
media-source-range-end-frame-not-removed-expected.txt
media-source-range-end-frame-not-removed.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-range-start-frame-replaced-expected.txt
media-source-range-start-frame-replaced.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-remove-b-frame-expected.txt
media-source-remove-b-frame.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-remove-crash-expected.txt
media-source-remove-crash.html
media-source-remove-decodeorder-crash-expected.txt
media-source-remove-decodeorder-crash.html
media-source-remove-expected.txt
media-source-remove-too-much-expected.txt
media-source-remove-too-much.html
media-source-remove-unload-crash-expected.txt
media-source-remove-unload-crash.html
media-source-remove.html
media-source-resize-expected.txt [GPUP] Some media-source tests fail/timeout when media in GPU Process is enabled 2021-03-17 17:06:08 +00:00
media-source-resize.html [GPUP] Some media-source tests fail/timeout when media in GPU Process is enabled 2021-03-17 17:06:08 +00:00
media-source-restrictions-expected.txt
media-source-restrictions.html
media-source-sample-wrong-track-id-expected.txt
media-source-sample-wrong-track-id.html
media-source-samples-out-of-order-expected.txt
media-source-samples-out-of-order.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-samples-resolution-change-expected.txt
media-source-samples-resolution-change.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-seek-back-expected.txt
media-source-seek-back.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-seek-complete-expected.txt
media-source-seek-complete.html
media-source-seek-detach-crash-expected.txt
media-source-seek-detach-crash.html
media-source-seek-redundant-append-expected.txt
media-source-seek-redundant-append.html
media-source-seek-twice-expected.txt
media-source-seek-twice.html
media-source-seek-unbuffered-expected.txt REGRESSION: MSE: Netflix playback sometimes fails when going to "next episode" in series 2021-06-16 01:01:52 +00:00
media-source-seek-unbuffered.html REGRESSION: MSE: Netflix playback sometimes fails when going to "next episode" in series 2021-06-16 01:01:52 +00:00
media-source-sequence-timestamps-expected.txt
media-source-sequence-timestamps.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-small-gap-expected.txt
media-source-small-gap.html
media-source-stalled-holds-sleep-assertion-expected.txt
media-source-stalled-holds-sleep-assertion.html
media-source-stpp-crash-expected.txt
media-source-stpp-crash.html
media-source-timeoffset-expected.txt
media-source-timeoffset.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-timestampoffset-rounding-error-expected.txt
media-source-timestampoffset-rounding-error.html [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes 2021-04-22 01:28:38 +00:00
media-source-timestampoffset-then-zero-expected.txt
media-source-timestampoffset-then-zero.html [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes 2020-12-17 02:19:07 +00:00
media-source-timestampoffset-trim-expected.txt [MSE] Media segment is incorrectly dropped when using negative timestampOffset or when source buffer appendWindow is set. 2021-02-25 00:57:53 +00:00
media-source-timestampoffset-trim.html [MSE] Media segment is incorrectly dropped when using negative timestampOffset or when source buffer appendWindow is set. 2021-02-25 00:57:53 +00:00
media-source-track-enabled-expected.txt
media-source-track-enabled.html
media-source-trackid-change-expected.txt [MSE] Handle trackId changing across Initialization Segments 2020-10-28 20:42:59 +00:00
media-source-trackid-change.html [MSE] Handle trackId changing across Initialization Segments 2020-10-28 20:42:59 +00:00
media-source-tracks-expected.txt
media-source-tracks.html
media-source-unnecessary-seek-seeked-expected.txt
media-source-unnecessary-seek-seeked.html
media-source-video-playback-quality-expected.txt
media-source-video-playback-quality.html
media-source-webm-append-buffer-after-abort-expected.txt [GPUP][MSE] A video element does not fire “canplaythrough” event if SourceBuffer.abort() is called 2021-01-29 00:19:30 +00:00
media-source-webm-append-buffer-after-abort.html [GPUP][MSE] A video element does not fire “canplaythrough” event if SourceBuffer.abort() is called 2021-01-29 00:19:30 +00:00
media-source-webm-expected.txt [MSE] Move the call to didParseInitializationDataCallback() from the beginning of a cluster to the end of "tracks" element 2021-02-04 06:00:10 +00:00
media-source-webm-init-inside-segment-expected.txt [BigSur] Appending a new WebM init segment between Cluster elements throws an error 2020-10-24 19:30:44 +00:00
media-source-webm-init-inside-segment.html [BigSur] Appending a new WebM init segment between Cluster elements throws an error 2020-10-24 19:30:44 +00:00
media-source-webm-vorbis-partial-expected.txt [Big Sur] platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial.html is consistently failing 2021-03-01 22:02:30 +00:00
media-source-webm-vorbis-partial.html [Big Sur] platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial.html is consistently failing 2021-05-04 23:35:29 +00:00
media-source-webm-vp8-malformed-header-expected.txt Migrate Monterey expectations to OpenSource and bump version numbers 2021-07-22 20:59:06 +00:00
media-source-webm-vp8-malformed-header.html Migrate Monterey expectations to OpenSource and bump version numbers 2021-07-22 20:59:06 +00:00
media-source-webm.html [MSE] Move the call to didParseInitializationDataCallback() from the beginning of a cluster to the end of "tracks" element 2021-02-04 06:00:10 +00:00
media-webm-opus-partial-abort-expected.txt SourceBuffer.abort() doesn't go back to state WAITING_FOR_SEGMENT properly 2021-07-14 05:12:26 +00:00
media-webm-opus-partial-abort.html SourceBuffer.abort() doesn't go back to state WAITING_FOR_SEGMENT properly 2021-07-14 05:12:26 +00:00
media-webm-opus-partial-expected.txt [Cocoa] Last few seconds of 'audio/webm; codecs=vorbis' appended to a SampleBuffer are not played 2021-07-02 01:08:44 +00:00
media-webm-opus-partial.html SourceBuffer.abort() doesn't go back to state WAITING_FOR_SEGMENT properly 2021-07-14 05:12:26 +00:00
media-webm-vorbis-partial-expected.txt [Cocoa] Last few seconds of 'audio/webm; codecs=vorbis' appended to a SampleBuffer are not played 2021-07-02 01:08:44 +00:00
media-webm-vorbis-partial.html SourceBuffer.abort() doesn't go back to state WAITING_FOR_SEGMENT properly 2021-07-14 05:12:26 +00:00
mock-media-source.js [MSE] Infinite loop in sample eviction when duration is NaN 2020-11-20 12:19:20 +00:00
only-bcp47-language-tags-accepted-as-valid-expected.txt
only-bcp47-language-tags-accepted-as-valid.html Remove unused JS and CSS files of media controls 2021-03-22 22:17:49 +00:00