Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Decrease flicker when changing video presentation mode.
https://bugs.webkit.org/show_bug.cgi?id=158148 rdar://problem/24476949 Patch by Jeremy Jones <jeremyj@apple.com> on 2016-05-27 Source/WebCore: Reviewed by Jer Noble. No new tests because there is no behavior change. This change is about the timing of moving AVPlayerLayers between layers to prevent flicker. 1) Moving an AVPlayerLayer between CAContexts can flicker. So always keep two AVPlayerLayers around and add and remove them from the inline and fullscreen contexts. 2) Wait to show the inline placeholder until the fullscreen video layer has been installed. 3) Wait to remove the fullscreen video layer until the placeholder has been removed. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::isVideoLayerInline): Expose isVideoLayerInline to the shadow DOM. (WebCore::MediaControlsHost::setPreparedForInline): Expose setPreparedForInline to the shadow DOM. * Modules/mediacontrols/MediaControlsHost.h: Add setPreparedForInline and isVideoLayerInline * Modules/mediacontrols/MediaControlsHost.idl: Add setPreparedForInline and isVideoLayerInline * Modules/mediacontrols/mediaControlsApple.js: (Controller.prototype.showInlinePlaybackPlaceholderWhenSafe): Wait to show placeholder when entering fullscreen. (Controller.prototype.handlePresentationModeChange): Wait to show placeholder, and notify when placeholder is removed. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setPreparedForInline): (WebCore::HTMLMediaElement::waitForPreparedForInlineThen): Used to delay fullscreen cleanup until placeholder is removed. (WebCore::HTMLMediaElement::setVideoFullscreenLayer): Add a callback so we can wait until this completes before continuing. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::isVideoLayerInline): (WebCore::HTMLMediaElement::waitForPreparedForInlineThen): (WebCore::HTMLMediaElement::setVideoFullscreenLayer): Add completionHandler. * platform/cocoa/WebVideoFullscreenModelVideoElement.h: (WebCore::WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): Add completionHandler. (WebCore::WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen): Added. * platform/cocoa/WebVideoFullscreenModelVideoElement.mm: (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): Add completionHandler. (WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::setVideoFullscreenLayer): Add completionHandler. * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayer::setVideoFullscreenLayer): Add completionHandler. * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::setVideoFullscreenLayer): Add completionHandler. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Create two video layers. (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): Allow two video layers. (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): Add completionHandler. (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity): Allow two video layers. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Allow two video layers. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer): Add completionHandler. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createPreviewLayers): Allow two video layers. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer): Add completionHandler. * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h: * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm: (WebCore::VideoFullscreenLayerManager::setVideoLayers): Allow two video layers. (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Add completionHandler. (WebCore::VideoFullscreenLayerManager::setVideoFullscreenFrame): Allow two video layers. (WebCore::VideoFullscreenLayerManager::didDestroyVideoLayer): Allow two video layers. (WebCore::VideoFullscreenLayerManager::setVideoLayer): Deleted. * platform/ios/WebVideoFullscreenControllerAVKit.mm: (WebVideoFullscreenControllerContext::didSetupFullscreen): Use completionHandler. (WebVideoFullscreenControllerContext::didExitFullscreen): Use completionHandler. Source/WebKit2: Reviewed by Tim Horton. Prevent flicker by using setVideoFullscreenLayer with a completion handler to delay enter fullscreen and cleanup fullscreen until the video layer has completely been installed or removed. * WebProcess/cocoa/WebVideoFullscreenManager.mm: (WebKit::WebVideoFullscreenManager::didSetupFullscreen): (WebKit::WebVideoFullscreenManager::didExitFullscreen): Canonical link: https://commits.webkit.org/176274@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
233c46a
commit e7154dc
Showing
23 changed files
with
315 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.