Title: [172212] trunk/Source/WebCore
Revision
172212
Author
[email protected]
Date
2014-08-07 09:06:06 -0700 (Thu, 07 Aug 2014)

Log Message

[Mac] Taking a paused video full screen flashes black at beginning of animation.
https://bugs.webkit.org/show_bug.cgi?id=135668

Reviewed by Eric Carlson.

When entering fullscreen, the full screen window will momentarily occlude the browser
window, causing a visiblity change notification. To avoid flickering when client buffering
is disabled, throttle calls to updateClientDataBuffering by delaying those calls for a
short period.

* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::MediaSession):
(WebCore::MediaSession::clientWillPausePlayback):
(WebCore::MediaSession::visibilityChanged):
(WebCore::MediaSession::clientDataBufferingTimerFired):
(WebCore::MediaSession::updateClientDataBuffering):
* platform/audio/MediaSession.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (172211 => 172212)


--- trunk/Source/WebCore/ChangeLog	2014-08-07 14:58:11 UTC (rev 172211)
+++ trunk/Source/WebCore/ChangeLog	2014-08-07 16:06:06 UTC (rev 172212)
@@ -1,3 +1,23 @@
+2014-08-07  Jer Noble  <[email protected]>
+
+        [Mac] Taking a paused video full screen flashes black at beginning of animation.
+        https://bugs.webkit.org/show_bug.cgi?id=135668
+
+        Reviewed by Eric Carlson.
+
+        When entering fullscreen, the full screen window will momentarily occlude the browser
+        window, causing a visiblity change notification. To avoid flickering when client buffering
+        is disabled, throttle calls to updateClientDataBuffering by delaying those calls for a
+        short period.
+
+        * platform/audio/MediaSession.cpp:
+        (WebCore::MediaSession::MediaSession):
+        (WebCore::MediaSession::clientWillPausePlayback):
+        (WebCore::MediaSession::visibilityChanged):
+        (WebCore::MediaSession::clientDataBufferingTimerFired):
+        (WebCore::MediaSession::updateClientDataBuffering):
+        * platform/audio/MediaSession.h:
+
 2014-08-07  Zan Dobersek  <[email protected]>
 
         ASSERT in Document::unregisterCollection reloading apple.com

Modified: trunk/Source/WebCore/platform/audio/MediaSession.cpp (172211 => 172212)


--- trunk/Source/WebCore/platform/audio/MediaSession.cpp	2014-08-07 14:58:11 UTC (rev 172211)
+++ trunk/Source/WebCore/platform/audio/MediaSession.cpp	2014-08-07 16:06:06 UTC (rev 172212)
@@ -34,6 +34,8 @@
 
 namespace WebCore {
 
+const double kClientDataBufferingTimerThrottleDelay = 0.1;
+
 #if !LOG_DISABLED
 static const char* stateName(MediaSession::State state)
 {
@@ -57,6 +59,7 @@
 
 MediaSession::MediaSession(MediaSessionClient& client)
     : m_client(client)
+    , m_clientDataBufferingTimer(this, &MediaSession::clientDataBufferingTimerFired)
     , m_state(Idle)
     , m_stateToRestore(Idle)
     , m_notifyingClient(false)
@@ -125,7 +128,8 @@
     
     setState(Paused);
     MediaSessionManager::sharedManager().sessionWillEndPlayback(*this);
-    updateClientDataBuffering();
+    if (!m_clientDataBufferingTimer.isActive())
+        m_clientDataBufferingTimer.startOneShot(kClientDataBufferingTimerThrottleDelay);
     return true;
 }
 
@@ -172,11 +176,20 @@
 
 void MediaSession::visibilityChanged()
 {
+    if (!m_clientDataBufferingTimer.isActive())
+        m_clientDataBufferingTimer.startOneShot(kClientDataBufferingTimerThrottleDelay);
+}
+
+void MediaSession::clientDataBufferingTimerFired(Timer<WebCore::MediaSession> &)
+{
     updateClientDataBuffering();
 }
 
 void MediaSession::updateClientDataBuffering()
 {
+    if (m_clientDataBufferingTimer.isActive())
+        m_clientDataBufferingTimer.stop();
+
     bool shouldBuffer = m_state == Playing || !m_client.elementIsHidden();
     m_client.setShouldBufferData(shouldBuffer);
 }

Modified: trunk/Source/WebCore/platform/audio/MediaSession.h (172211 => 172212)


--- trunk/Source/WebCore/platform/audio/MediaSession.h	2014-08-07 14:58:11 UTC (rev 172211)
+++ trunk/Source/WebCore/platform/audio/MediaSession.h	2014-08-07 16:06:06 UTC (rev 172212)
@@ -26,6 +26,7 @@
 #ifndef MediaSession_h
 #define MediaSession_h
 
+#include "Timer.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/text/WTFString.h>
 
@@ -102,9 +103,11 @@
     MediaSessionClient& client() const { return m_client; }
 
 private:
+    void clientDataBufferingTimerFired(Timer<MediaSession>&);
     void updateClientDataBuffering();
 
     MediaSessionClient& m_client;
+    Timer<MediaSession> m_clientDataBufferingTimer;
     State m_state;
     State m_stateToRestore;
     bool m_notifyingClient;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to