Title: [270235] trunk/Source/WebCore
Revision
270235
Author
[email protected]
Date
2020-11-30 01:29:45 -0800 (Mon, 30 Nov 2020)

Log Message

[GStreamer] Media player does not properly inhibit, uninhibit sleep
https://bugs.webkit.org/show_bug.cgi?id=186971

Reviewed by Philippe Normand.

* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::updateStates): Call the
player to update the playback state as it is done in the regular
player.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270234 => 270235)


--- trunk/Source/WebCore/ChangeLog	2020-11-30 05:36:30 UTC (rev 270234)
+++ trunk/Source/WebCore/ChangeLog	2020-11-30 09:29:45 UTC (rev 270235)
@@ -1,3 +1,15 @@
+2020-11-30  Xabier Rodriguez Calvar  <[email protected]>
+
+        [GStreamer] Media player does not properly inhibit, uninhibit sleep
+        https://bugs.webkit.org/show_bug.cgi?id=186971
+
+        Reviewed by Philippe Normand.
+
+        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerMSE::updateStates): Call the
+        player to update the playback state as it is done in the regular
+        player.
+
 2020-11-29  Zalan Bujtas  <[email protected]>
 
         [LFC][BFC] Do not assume float avoiders have pre-computed vertical positions

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp (270234 => 270235)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp	2020-11-30 05:36:30 UTC (rev 270234)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp	2020-11-30 09:29:45 UTC (rev 270235)
@@ -498,8 +498,14 @@
     MediaPlayer::NetworkState oldNetworkState = m_networkState;
     MediaPlayer::ReadyState oldReadyState = m_readyState;
     GstState state, pending;
+    bool stateReallyChanged = false;
 
     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) {
@@ -576,6 +582,15 @@
             GST_DEBUG("Requested state change to %s was completed", gst_element_state_get_name(state));
         }
 
+        // 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_OBJECT(pipeline(), "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;
+        }
+
         break;
     }
     case GST_STATE_CHANGE_ASYNC:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to