Title: [226712] trunk
Revision
226712
Author
[email protected]
Date
2018-01-10 07:26:07 -0800 (Wed, 10 Jan 2018)

Log Message

[GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html
https://bugs.webkit.org/show_bug.cgi?id=181471
<rdar://problem/36402323>

Reviewed by Carlos Garcia Campos.

Source/WebCore:

This patch mainly reduces the amount of playback state changes
emitted by the GStreamer player to its client. Emitting those
notifications too often has bad side effects.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::paused const): Add debug messages.
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): This debug message appears too much. Demote.
(WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::updateStates): Try to emit
playback state change notification only when going to PLAYING.
(WebCore::MediaPlayerPrivateGStreamer::loadingFailed): Add warning message.

LayoutTests:

* platform/gtk/TestExpectations: These 2 tests shall pass now.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (226711 => 226712)


--- trunk/LayoutTests/ChangeLog	2018-01-10 14:44:53 UTC (rev 226711)
+++ trunk/LayoutTests/ChangeLog	2018-01-10 15:26:07 UTC (rev 226712)
@@ -1,3 +1,13 @@
+2018-01-10  Philippe Normand  <[email protected]>
+
+        [GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html
+        https://bugs.webkit.org/show_bug.cgi?id=181471
+        <rdar://problem/36402323>
+
+        Reviewed by Carlos Garcia Campos.
+
+        * platform/gtk/TestExpectations: These 2 tests shall pass now.
+
 2018-01-10  Ms2ger  <[email protected]>
 
         [GTK] Enable css2.1/20110323/c541-word-sp-000.htm.

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (226711 => 226712)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2018-01-10 14:44:53 UTC (rev 226711)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2018-01-10 15:26:07 UTC (rev 226712)
@@ -2100,9 +2100,6 @@
 
 webkit.org/b/137698 media/video-controls-drag.html [ Timeout ]
 
-webkit.org/b/181471 media/video-interruption-with-resume-allowing-play.html [ Timeout ]
-webkit.org/b/181471 media/media-playback-page-visibility.html [ Failure ]
-
 webkit.org/b/137131 inspector/debugger [ Skip ]
 webkit.org/b/147518 inspector/dom [ Skip ]
 webkit.org/b/147518 inspector/model [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (226711 => 226712)


--- trunk/Source/WebCore/ChangeLog	2018-01-10 14:44:53 UTC (rev 226711)
+++ trunk/Source/WebCore/ChangeLog	2018-01-10 15:26:07 UTC (rev 226712)
@@ -1,3 +1,24 @@
+2018-01-10  Philippe Normand  <[email protected]>
+
+        [GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html
+        https://bugs.webkit.org/show_bug.cgi?id=181471
+        <rdar://problem/36402323>
+
+        Reviewed by Carlos Garcia Campos.
+
+        This patch mainly reduces the amount of playback state changes
+        emitted by the GStreamer player to its client. Emitting those
+        notifications too often has bad side effects.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::paused const): Add debug messages.
+        (WebCore::MediaPlayerPrivateGStreamer::handleMessage): This debug message appears too much. Demote.
+        (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const): Ditto.
+        (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Ditto.
+        (WebCore::MediaPlayerPrivateGStreamer::updateStates): Try to emit
+        playback state change notification only when going to PLAYING.
+        (WebCore::MediaPlayerPrivateGStreamer::loadingFailed): Add warning message.
+
 2018-01-10  Youenn Fablet  <[email protected]>
 
         Add Service Worker CSP persistency

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (226711 => 226712)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-01-10 14:44:53 UTC (rev 226711)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-01-10 15:26:07 UTC (rev 226712)
@@ -581,12 +581,16 @@
         return true;
     }
 
-    if (m_playbackRatePause)
+    if (m_playbackRatePause) {
+        GST_DEBUG("Playback rate is 0, simulating PAUSED state");
         return false;
+    }
 
     GstState state;
     gst_element_get_state(m_pipeline.get(), &state, nullptr, 0);
-    return state <= GST_STATE_PAUSED;
+    bool paused = state <= GST_STATE_PAUSED;
+    GST_DEBUG("Paused state: %s", paused ? "enabled":"disabled");
+    return paused;
 }
 
 bool MediaPlayerPrivateGStreamer::seeking() const
@@ -917,7 +921,7 @@
     // We ignore state changes from internal elements. They are forwarded to playbin2 anyway.
     bool messageSourceIsPlaybin = GST_MESSAGE_SRC(message) == reinterpret_cast<GstObject*>(m_pipeline.get());
 
-    GST_DEBUG("Message %s received from element %s", GST_MESSAGE_TYPE_NAME(message), GST_MESSAGE_SRC_NAME(message));
+    GST_LOG("Message %s received from element %s", GST_MESSAGE_TYPE_NAME(message), GST_MESSAGE_SRC_NAME(message));
     switch (GST_MESSAGE_TYPE(message)) {
     case GST_MESSAGE_ERROR:
         if (m_resetPipeline || m_missingPluginsCallback || m_errorOccured)
@@ -1288,7 +1292,7 @@
     MediaTime loaded = m_maxTimeLoaded;
     if (m_isEndReached)
         loaded = durationMediaTime();
-    GST_DEBUG("maxTimeLoaded: %s", toString(loaded).utf8().data());
+    GST_LOG("maxTimeLoaded: %s", toString(loaded).utf8().data());
     return loaded;
 }
 
@@ -1299,7 +1303,7 @@
     MediaTime currentMaxTimeLoaded = maxTimeLoaded();
     bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress;
     m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded;
-    GST_DEBUG("didLoadingProgress: %d", didLoadingProgress);
+    GST_LOG("didLoadingProgress: %d", didLoadingProgress);
     return didLoadingProgress;
 }
 
@@ -1500,9 +1504,15 @@
     MediaPlayer::NetworkState oldNetworkState = m_networkState;
     MediaPlayer::ReadyState oldReadyState = m_readyState;
     GstState pending;
+    GstState state;
+    bool stateReallyChanged = false;
 
-    m_oldState = m_currentState;
-    GstStateChangeReturn getStateResult = gst_element_get_state(m_pipeline.get(), &m_currentState, &pending, 250 * GST_NSECOND);
+    GstStateChangeReturn getStateResult = gst_element_get_state(m_pipeline.get(), &state, &pending, 250 * GST_NSECOND);
+    if (state != m_currentState) {
+        m_oldState = m_currentState;
+        m_currentState = state;
+        stateReallyChanged = true;
+    }
 
     bool shouldUpdatePlaybackState = false;
     switch (getStateResult) {
@@ -1581,8 +1591,12 @@
             shouldUpdatePlaybackState = true;
             GST_INFO("Requested state change to %s was completed", gst_element_state_get_name(m_currentState));
         }
-        if ((m_oldState != m_currentState) && ((m_oldState > GST_STATE_READY && m_currentState > GST_STATE_READY)
-            || (m_currentState < GST_STATE_PLAYING && m_oldState > GST_STATE_READY))) {
+
+        // Emit play state change notification only when going to PLAYING so that
+        // the media element gets a chance to enable its page sleep disabler.
+        // Emitting this notification in more cases triggers unwanted code paths
+        // and test timeouts.
+        if (stateReallyChanged && (m_oldState != m_currentState) && (m_oldState == GST_STATE_PAUSED && m_currentState == GST_STATE_PLAYING)) {
             GST_INFO("Playback state changed from %s to %s. Notifying the media player client", gst_element_state_get_name(m_oldState), gst_element_state_get_name(m_currentState));
             shouldUpdatePlaybackState = true;
         }
@@ -1785,6 +1799,8 @@
 
 void MediaPlayerPrivateGStreamer::loadingFailed(MediaPlayer::NetworkState error)
 {
+    GST_WARNING("Loading failed, error: %d", error);
+
     m_errorOccured = true;
     if (m_networkState != error) {
         m_networkState = error;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to