Changeset 277122 in webkit


Ignore:
Timestamp:
May 6, 2021 2:16:51 PM (3 years ago)
Author:
jer.noble@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r277116 r277122  
     12021-05-06  Jer Noble  <jer.noble@apple.com>
     2
     3        REGRESSION (r276870): ASSERTION FAILED: !m_impl || !m_shouldEnableAssertions || m_impl->wasConstructedOnMainThread() == isMainThread() under WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer
     4        https://bugs.webkit.org/show_bug.cgi?id=225371
     5        <rdar://problem/77531907>
     6
     7        Reviewed by Eric Carlson.
     8
     9        In WebKitLegacy, the weakPtr created by createAVPlayer() is constructed on the WebThread, and
     10        dereferenced on the main thread. However, the reason we use a WeakPtr for this call is a long-
     11        since fixed bug in AVFoundation. We can just remove the WeakPtr and rely on AVFoundation to
     12        not call our block after the observer has been removed in the destructor.
     13
     14        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
     15        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     16        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
     17
    1182021-05-06  Eric Carlson  <eric.carlson@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r277116 r277122  
    11051105
    11061106    ASSERT(!m_currentTimeObserver);
    1107     m_currentTimeObserver = [m_avPlayer addPeriodicTimeObserverForInterval:CMTimeMake(1, 10) queue:dispatch_get_main_queue() usingBlock:[weakThis = makeWeakPtr(*this)] (CMTime time) {
    1108         if (weakThis)
    1109             weakThis->currentMediaTimeDidChange(PAL::toMediaTime(time));
     1107    m_currentTimeObserver = [m_avPlayer addPeriodicTimeObserverForInterval:CMTimeMake(1, 10) queue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) usingBlock:[this] (CMTime time) {
     1108        currentMediaTimeDidChange(PAL::toMediaTime(time));
    11101109    }];
    11111110
Note: See TracChangeset for help on using the changeset viewer.