Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3e536cdd2b1fe184627a33fb98024070f0fa2a83
      
https://github.com/WebKit/WebKit/commit/3e536cdd2b1fe184627a33fb98024070f0fa2a83
  Author: Jer Noble <[email protected]>
  Date:   2023-10-11 (Wed, 11 Oct 2023)

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

  Log Message:
  -----------
  [Cocoa] CRASH in RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage
https://bugs.webkit.org/show_bug.cgi?id=258898
rdar://107296485

Reviewed by Eric Carlson.

A command to destroy the MediaPlayer may be received while 
MediaPlayerPrivateAVFoundationObjC
is spinning the RunLoop in waitForVideoOutputMediaDataWillChange(). Detect this 
by instantiating
a WeakPtr in waitForVideoOutputMediaDataWillChange() and bailing early with an 
error code if the
WeakPtr has been invalidated while spinning the RunLoop.

Modify updateLastImage() to take a CompletionHandler, which will only fire if
waitForVideoOutputMediaDataWillChange() returns a non-exceptional result. If 
that method
detects that the WeakPtr was invalidated, the completion handler will not be 
called
(which will trigger an ASSERT in debug builds).

Update all the callers of updateLastImage() to do their subsequent work in the 
completion handler
they pass to updateLastImage().

* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::nativeImageForCurrentTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::colorSpace):
(WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):

Originally-landed-as: 265870.11@safari-7616-branch (1fb95912042f). 
rdar://116424357
Canonical link: https://commits.webkit.org/269212@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to