Changeset 179784 in webkit
- Timestamp:
- Feb 7, 2015 2:48:36 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r179783 r179784 1 2015-02-07 Jer Noble <jer.noble@apple.com> 2 3 [Mac] Set -contentsScale on AVPlayerLayer to allow AVPlayer to select the appropriate HLS variant. 4 https://bugs.webkit.org/show_bug.cgi?id=141354 5 rdar://problem/19717591 6 7 Reviewed by Darin Adler. 8 9 AVPlayer will try to determine the correct HLS variant based on the bounds of an AVPlayerLayer. 10 When not in a layer tree, AVFoundation is not able to determine the correct mapping from logical 11 units to pixel values. To provide AVPlayer with that scaling value, set -contentsScale based on 12 both the current device scale and the current page scale. 13 14 Since this needs to be set at initialization time, before the AVPlayer is has any AVPlayerItems, 15 add some plumbing up from MediaPlayer to as the HTMLMediaElement for the appropriate contents 16 scale. 17 18 * html/HTMLMediaElement.cpp: 19 (WebCore::HTMLMediaElement::mediaPlayerContentsScale): 20 * html/HTMLMediaElement.h: 21 * platform/graphics/MediaPlayer.h: 22 (WebCore::MediaPlayerClient::mediaPlayerContentsScale): 23 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 24 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): 25 * platform/graphics/ca/GraphicsLayerCA.cpp: 26 (WebCore::GraphicsLayerCA::updateContentsScale): 27 1 28 2015-02-07 Alexey Proskuryakov <ap@apple.com> 2 29 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r179641 r179784 5702 5702 } 5703 5703 5704 float HTMLMediaElement::mediaPlayerContentsScale() const 5705 { 5706 if (auto page = document().page()) 5707 return page->pageScaleFactor() * page->deviceScaleFactor(); 5708 return 1; 5709 } 5710 5704 5711 void HTMLMediaElement::mediaPlayerSetSize(const IntSize& size) 5705 5712 { -
trunk/Source/WebCore/html/HTMLMediaElement.h
r179641 r179784 588 588 virtual bool mediaPlayerIsVideo() const override; 589 589 virtual LayoutRect mediaPlayerContentBoxRect() const override; 590 virtual float mediaPlayerContentsScale() const override; 590 591 virtual void mediaPlayerSetSize(const IntSize&) override; 591 592 virtual void mediaPlayerPause() override; -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r179641 r179784 229 229 virtual bool mediaPlayerIsVideo() const { return false; } 230 230 virtual LayoutRect mediaPlayerContentBoxRect() const { return LayoutRect(); } 231 virtual float mediaPlayerContentsScale() const { return 1; } 231 232 virtual void mediaPlayerSetSize(const IntSize&) { } 232 233 virtual void mediaPlayerPause() { } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r179641 r179784 621 621 [m_videoLayer addObserver:m_objcObserver.get() forKeyPath:@"readyForDisplay" options:NSKeyValueObservingOptionNew context:(void *)MediaPlayerAVFoundationObservationContextAVPlayerLayer]; 622 622 updateVideoLayerGravity(); 623 [m_videoLayer setContentsScale:player()->client().mediaPlayerContentsScale()]; 623 624 IntSize defaultSize = player()->client().mediaPlayerContentBoxRect().pixelSnappedSize(); 624 625 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createVideoLayer(%p) - returning %p", this, m_videoLayer.get()); -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r179604 r179784 2991 2991 m_layer->setContentsScale(contentsScale); 2992 2992 2993 if (m_contentsLayer && m_contentsLayerPurpose == ContentsLayerForMedia) 2994 m_contentsLayer->setContentsScale(contentsScale); 2995 2993 2996 if (tiledBacking()) { 2994 2997 // Scale change may swap in a different set of tiles changing the custom child layers.
Note: See TracChangeset
for help on using the changeset viewer.