Title: [277122] trunk/Source/WebCore
Revision
277122
Author
jer.no...@apple.com
Date
2021-05-06 14:16:51 -0700 (Thu, 06 May 2021)

Log Message

REGRESSION (r276870): ASSERTION FAILED: !m_impl || !m_shouldEnableAssertions || m_impl->wasConstructedOnMainThread() == isMainThread() under WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer
https://bugs.webkit.org/show_bug.cgi?id=225371
<rdar://problem/77531907>

Reviewed by Eric Carlson.

In WebKitLegacy, the weakPtr created by createAVPlayer() is constructed on the WebThread, and
dereferenced on the main thread. However, the reason we use a WeakPtr for this call is a long-
since fixed bug in AVFoundation. We can just remove the WeakPtr and rely on AVFoundation to
not call our block after the observer has been removed in the destructor.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277121 => 277122)


--- trunk/Source/WebCore/ChangeLog	2021-05-06 21:14:50 UTC (rev 277121)
+++ trunk/Source/WebCore/ChangeLog	2021-05-06 21:16:51 UTC (rev 277122)
@@ -1,3 +1,20 @@
+2021-05-06  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION (r276870): ASSERTION FAILED: !m_impl || !m_shouldEnableAssertions || m_impl->wasConstructedOnMainThread() == isMainThread() under WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer
+        https://bugs.webkit.org/show_bug.cgi?id=225371
+        <rdar://problem/77531907>
+
+        Reviewed by Eric Carlson.
+
+        In WebKitLegacy, the weakPtr created by createAVPlayer() is constructed on the WebThread, and
+        dereferenced on the main thread. However, the reason we use a WeakPtr for this call is a long-
+        since fixed bug in AVFoundation. We can just remove the WeakPtr and rely on AVFoundation to
+        not call our block after the observer has been removed in the destructor.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
+
 2021-05-06  Eric Carlson  <eric.carl...@apple.com>
 
         [GPUP] Reduce MediaPlayer polling frequency when possible

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (277121 => 277122)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2021-05-06 21:14:50 UTC (rev 277121)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2021-05-06 21:16:51 UTC (rev 277122)
@@ -1104,9 +1104,8 @@
 #endif
 
     ASSERT(!m_currentTimeObserver);
-    m_currentTimeObserver = [m_avPlayer addPeriodicTimeObserverForInterval:CMTimeMake(1, 10) queue:dispatch_get_main_queue() usingBlock:[weakThis = makeWeakPtr(*this)] (CMTime time) {
-        if (weakThis)
-            weakThis->currentMediaTimeDidChange(PAL::toMediaTime(time));
+    m_currentTimeObserver = [m_avPlayer addPeriodicTimeObserverForInterval:CMTimeMake(1, 10) queue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) usingBlock:[this] (CMTime time) {
+        currentMediaTimeDidChange(PAL::toMediaTime(time));
     }];
 
     setDelayCallbacks(false);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to