Bug 136879

Summary: Fix an issue that caused video playback to not always use high resolution streams
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: New BugsAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, eric.carlson, jeremyj-wk, jonlee, simon.fraser, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch eric.carlson: review+

Description Simon Fraser (smfr) 2014-09-16 19:10:13 PDT
Fix an issue that caused video playback to not always use high resolution streams
Comment 1 Simon Fraser (smfr) 2014-09-16 20:20:31 PDT
Created attachment 238235 [details]
Patch
Comment 2 Jeremy Jones 2014-09-17 11:41:55 PDT
Comment on attachment 238235 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238235&action=review

> Source/WebCore/WebCore.exp.in:3441
> -__ZN7WebCore32WebVideoFullscreenInterfaceAVKit15setupFullscreenER7CALayerNS_7IntRectEP6UIView
> +__ZN7WebCore32WebVideoFullscreenInterfaceAVKit15setupFullscreenER7CALayerNS_7IntRectEfP6UIView

This can be done without changing the WebVideoFullscreenInterfaceAVKit interface.

> Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm:128
> -    _interface->setupFullscreen(*_videoFullscreenLayer.get(), _mediaElement->clientRect(), view);
> +    _interface->setupFullscreen(*_videoFullscreenLayer.get(), _mediaElement->clientRect(), 1, view);

Don't need this if the change is isolated to the IPC interface.

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h:95
> -    virtual void setupFullscreen(PlatformLayer&, WebCore::IntRect initialRect, UIView *);
> +    virtual void setupFullscreen(PlatformLayer&, WebCore::IntRect initialRect, float hostingDeviceScaleFactor, UIView *);

Ditto.

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:737
> -void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer& videoLayer, WebCore::IntRect initialRect, UIView* parentView)
> +void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer& videoLayer, WebCore::IntRect initialRect, float hostingDeviceScaleFactor, UIView* parentView)

Ditto.

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:764
> +
> +        if (hostingDeviceScaleFactor != 1) {
> +            // Invert the scale transform added in the WebProcess to fix <rdar://problem/18316542>.
> +            float inverseScale = 1 / hostingDeviceScaleFactor;
> +            [m_videoLayer setTransform:CATransform3DMakeScale(inverseScale, inverseScale, 1)];
> +        }

This can be put into WebVideoFullscreenManagerProxy::setupFullscreenWithID, just before it calls setupFullsdcreen.

> Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm:80
> -    setupFullscreen(*m_layerHost.get(), initialRect, parentView);
> +    setupFullscreen(*m_layerHost.get(), initialRect, hostingDeviceScaleFactor, parentView);

Apply the transform here on m_layerHost instead of passing it to setupFullscreen.
Comment 3 Simon Fraser (smfr) 2014-09-17 11:55:09 PDT
Created attachment 238260 [details]
Patch
Comment 4 Simon Fraser (smfr) 2014-09-17 14:18:45 PDT
https://trac.webkit.org/r173702