[webkit-changes] [WebKit/WebKit] 736ffd: [Cocoa] Refactor: update MediaPlayerPrivateAVFound...

Jer Noble noreply at github.com
Thu Nov 16 00:18:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 736ffded229de1ca05e5a07c1aecaf18aa0b5486
      https://github.com/WebKit/WebKit/commit/736ffded229de1ca05e5a07c1aecaf18aa0b5486
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-11-16 (Thu, 16 Nov 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
    M Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

  Log Message:
  -----------
  [Cocoa] Refactor: update MediaPlayerPrivateAVFoundation's cached duration from duration KVO
https://bugs.webkit.org/show_bug.cgi?id=264743
rdar://118334048

Reviewed by Andy Estes.

Rather than simply resetting the m_cachedDuration ivar to InvalidTime when the durationDidChange KVO
method fires, forcing us to re-query the duration next time it's asked for, store the new value as
m_cachedDuration and fire the durationChanged() client callback when the value for duration has actually
changed.

Drive-by fix: Call durationMediaTime() rather than platformDuration() in platformMaxTimeSeekable(). The
former will return the cached duration, if available. The latter will not.

* Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::invalidateCachedDuration):
* Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::durationDidChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable):

Canonical link: https://commits.webkit.org/270814@main




More information about the webkit-changes mailing list