Skip to content
Permalink
Browse files
[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:


Canonical link: https://commits.webkit.org/153573@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jernoble committed Aug 7, 2014
1 parent 14e7d1b commit 160a5958f7e256e2e9815a79bbcf0e17827474b2
Showing 3 changed files with 37 additions and 1 deletion.
@@ -1,3 +1,23 @@
2014-08-07 Jer Noble <jer.noble@apple.com>

[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 <zdobersek@igalia.com>

ASSERT in Document::unregisterCollection reloading apple.com
@@ -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 @@ std::unique_ptr<MediaSession> MediaSession::create(MediaSessionClient& client)

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 @@ bool MediaSession::clientWillPausePlayback()

setState(Paused);
MediaSessionManager::sharedManager().sessionWillEndPlayback(*this);
updateClientDataBuffering();
if (!m_clientDataBufferingTimer.isActive())
m_clientDataBufferingTimer.startOneShot(kClientDataBufferingTimerThrottleDelay);
return true;
}

@@ -171,12 +175,21 @@ void MediaSession::didReceiveRemoteControlCommand(RemoteControlCommandType comma
}

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);
}
@@ -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 @@ class MediaSession {
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;

0 comments on commit 160a595

Please sign in to comment.