This patch fixes the crash of some WPT encrypted-media tests like: clearkey-mp4-playback-temporary-multikey-sequential.https.html or clearkey-mp4-playback-temporary-clear-encrypted.https.html. These crashes should be fixed in 185242 but unfortunately it isn't the case. See bug 185242 for more detail. Here is the root cause of the crash: 1.When an error occurs in playback pipeline (no decipher key for example), we receive an error message in MediaPlayerPrivateGStreamer::handleMessage -> MediaPlayerPrivateGStreamer::loadingFailed (MediaPlayer::FormatError). 2.The function loadingFailed -> HTMLMediaElement::mediaPlayerNetworkStateChanged (MediaPlayer::FormatError) -> setNetworkState -> mediaLoadingFailed -> noneSupported go to the point 3 | -> HTMLMediaElement::mediaPlayerReadyStateChanged(MediaPlayer::HaveNothing) -> setReadyState -> updatePlayState() go to the point 5 3.nonSupported -> detachMediaSource -> MediaSource::detachFromElement -> removeSourceBuffer -> MediaSourceGStreamer::removeSourceBuffer -> .. ->PlaybackPipeline::removeSourceBuffer 4.PlaybackPipeline::removeSourceBuffer -> webKitMediaSrcFreeStream . 5.HTMLMediaElement::updatePlayState -> potentiallyPlaying -> stoppedDueToErrors ( This function returns false because (m_readyState >= HAVE_METADATA && m_error) is false, m_readyState equal to HaveNothing ) 6.HTMLMediaElement::updatePlayState -> MediaPlayer::play -> MediaPlayerPrivateGStreamer::play -> changePipelineState (set the pipeline to playing state) 7.WebkitMediaSourceGStreamer sends "source-setup" signal when its state change from Ready to Paused, the signal catched in MediaPlayerPrivateGStreamer::sourceSetupCallback 8.MediaPlayerPrivateGStreamer::sourceSetupCallback -> MediaPlayerPrivateGStreamerMSE::sourceSetup -> MediaSourceGStreamer::open -> MediaSource::setPrivateAndOpen (crash in this function because the mediaSource is detached from mediaElement in the point 3, thus the variable m_mediaElement is null). In the point 5 the function "HTMLMediaElement::stoppedDueToErrors" returns false, because m_readyState equal to HaveNothing and it is not upper than HAVE_METADATA. In order to avoid trying again to play the same URI after an error, we don't set the ReadyState to HaveNothing when an error occurs in the pipeline, we should simply set NetworkState to error.
Created attachment 340602 [details] Patch
Comment on attachment 340602 [details] Patch I see no MSE-specific changes in this patch, confusing. Can't you simply override loadingFailed() in the MSE player?
(In reply to Philippe Normand from comment #2) > Comment on attachment 340602 [details] > Patch > > I see no MSE-specific changes in this patch, confusing. Can't you simply > override loadingFailed() in the MSE player? I think even in the no-mse (regular playback), we have not to set the ReadyState to HaveNothing when an error occurs in playback because it's not true, we have enough data, just an error occurs in playing state. see W3C spec: https://dev.w3.org/html5/pf-summary/video.html#dom-media-readystate <<< HAVE_NOTHING (numeric value 0): No information regarding the media resource is available. No data for the current playback position is available. Media elements whose networkState attribute is NETWORK_EMPTY are always in the HAVE_NOTHING state. >>> In AVFoundation port, they explicitly set the ReadyState to HaveNothing only when they start a new load. But I agree, I should put these explanations in changeLog and change the title of the bug and the patch.
Then if this method has only one call site there is no need for a method. Please also check this change doesn't break any test.
Created attachment 340790 [details] Patch
Did you check no test was affected by this patch?
(In reply to Philippe Normand from comment #6) > Did you check no test was affected by this patch? Yes, I tested all the media tests with WPE port. I have not seen any regression.
According to the wpe/TestExpectations, all media tests are skipped. Please check with WebKitGTK.
(In reply to Philippe Normand from comment #8) > According to the wpe/TestExpectations, all media tests are skipped. Please > check with WebKitGTK. I agree that most test are skipped but not all, we have 67 tests in LayoutTests/media/ 53 tests in LayoutTests/imported/w3c/web-platform-tests/encrypted-media/ I am preparing an new env for GTK in order to do the tests.
(In reply to Yacine Bandou from comment #9) > (In reply to Philippe Normand from comment #8) > > According to the wpe/TestExpectations, all media tests are skipped. Please > > check with WebKitGTK. > > I agree that most test are skipped but not all, we have > 67 tests in LayoutTests/media/ > 53 tests in LayoutTests/imported/w3c/web-platform-tests/encrypted-media/ > > I am preparing an new env for GTK in order to do the tests. I have passed all these tests with GTK port, I have not seen a regression: 730 tests in LayoutTests/media 59 tests in LayoutTests/imported/w3c/web-platform-tests/media-source/
Cool. Please check http/tests/media too :)
(In reply to Philippe Normand from comment #11) > Cool. Please check http/tests/media too :) All 58 tests ran as expected
Comment on attachment 340790 [details] Patch Attachment 340790 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/7760761 New failing tests: http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
Created attachment 340950 [details] Archive of layout-test-results from ews202 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews202 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
(In reply to Yacine Bandou from comment #10) > (In reply to Yacine Bandou from comment #9) > > (In reply to Philippe Normand from comment #8) > > > According to the wpe/TestExpectations, all media tests are skipped. Please > > > check with WebKitGTK. > > > > I agree that most test are skipped but not all, we have > > 67 tests in LayoutTests/media/ > > 53 tests in LayoutTests/imported/w3c/web-platform-tests/encrypted-media/ > > > > I am preparing an new env for GTK in order to do the tests. > > I have passed all these tests with GTK port, I have not seen a regression: > > 730 tests in LayoutTests/media > 59 tests in LayoutTests/imported/w3c/web-platform-tests/media-source/ Please ensure MSE/EME are enabled in runtime.
Comment on attachment 340790 [details] Patch Clearing flags on attachment: 340790 Committed r232061: <https://trac.webkit.org/changeset/232061>
All reviewed patches have been landed. Closing bug.