Changeset 258749 in webkit


Ignore:
Timestamp:
Mar 19, 2020 8:05:11 PM (4 years ago)
Author:
Peng Liu
Message:

Safari video gravity changes performance improvements
https://bugs.webkit.org/show_bug.cgi?id=209316

Reviewed by Eric Carlson.

Remove an unnecessary (and harmful) call of setVideoLayerFrame in WebAVPlayerLayer:layoutSublayers.

When a video with the gravity AVLayerVideoGravityResizeAspectFill needs to enter the
picture-in-picture mode from fullscreen, the extra call of setVideoLayerFrame will send
an extra IPC message to the Web process to set the video layer bounds. So the [CATransaction commit]
will need to wait for three property changes to complete - two in the Web process, and one in the
UI process. The interval of the two property changes in the Web process is over 100 ms, because we
delay the call of resolveBounds (which calls the second setVideoLayerFrame) at least 100 ms
in WebAVPlayerLayer:layoutSublayers. That leads to long durations of core animation commits.
In the test, the longest duration of commits is over 500 ms. After applying this patch,
the longest duration in the test is about 50 ms.

  • platform/ios/VideoFullscreenInterfaceAVKit.mm:

(-[WebAVPlayerLayer layoutSublayers]):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r258748 r258749  
     12020-03-19  Peng Liu  <peng.liu6@apple.com>
     2
     3        Safari video gravity changes performance improvements
     4        https://bugs.webkit.org/show_bug.cgi?id=209316
     5
     6        Reviewed by Eric Carlson.
     7
     8        Remove an unnecessary (and harmful) call of setVideoLayerFrame in WebAVPlayerLayer:layoutSublayers.
     9
     10        When a video with the gravity AVLayerVideoGravityResizeAspectFill needs to enter the
     11        picture-in-picture mode from fullscreen, the extra call of setVideoLayerFrame will send
     12        an extra IPC message to the Web process to set the video layer bounds. So the [CATransaction commit]
     13        will need to wait for three property changes to complete - two in the Web process, and one in the
     14        UI process. The interval of the two property changes in the Web process is over 100 ms, because we
     15        delay the call of resolveBounds (which calls the second setVideoLayerFrame) at least 100 ms
     16        in WebAVPlayerLayer:layoutSublayers. That leads to long durations of core animation commits.
     17        In the test, the longest duration of commits is over 500 ms. After applying this patch,
     18        the longest duration in the test is about 50 ms.
     19
     20        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
     21        (-[WebAVPlayerLayer layoutSublayers]):
     22
    1232020-03-19  Tim Horton  <timothy_horton@apple.com>
    224
  • trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm

    r258682 r258749  
    280280    } else if ([AVLayerVideoGravityResizeAspectFill isEqualToString:self.videoGravity]) {
    281281        sourceVideoFrame = smallestRectWithAspectRatioAroundRect(videoAspectRatio, self.modelVideoLayerFrame);
    282         self.modelVideoLayerFrame = CGRectMake(0, 0, sourceVideoFrame.width(), sourceVideoFrame.height());
    283         if (auto* model = _fullscreenInterface->videoFullscreenModel())
    284             model->setVideoLayerFrame(self.modelVideoLayerFrame);
    285282        targetVideoFrame = smallestRectWithAspectRatioAroundRect(videoAspectRatio, self.bounds);
    286283    } else
Note: See TracChangeset for help on using the changeset viewer.