Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0a7b2cd6eaaf26123fbcfeffae9adc0c07ed79ef
      
https://github.com/WebKit/WebKit/commit/0a7b2cd6eaaf26123fbcfeffae9adc0c07ed79ef
  Author: Youenn Fablet <youe...@gmail.com>
  Date:   2023-06-23 (Fri, 23 Jun 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/avfoundation/SampleBufferDisplayLayer.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm
    M Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h

  Log Message:
  -----------
  Adopt ThreadSafeWeakPtr in LocalSampleBufferDisplayLayer
https://bugs.webkit.org/show_bug.cgi?id=258441
rdar://111203259

Reviewed by Eric Carlson.

SampleBufferDisplayLayer was migrated to 
ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr but not 
LocalSampleBufferDisplayLayer.
LocalSampleBufferDisplayLayer was still using WeakPtr and a work queue, with 
dispatchSync in its destructor.
This works ok except if dispatching a task from another dispatched task, which 
was happening in 
LocalSampleBufferDisplayLayer::updateRootLayerBoundsAndPosition.

To prevent this, we are introducing enqueueBufferInternal which should be 
called from the work queue.
In addition to that, we are removing the dispatchSync in the destructor and 
make use of ThreadSafeWeakPtr in the work queue, to make code more robust.

We have to change WebAVSampleBufferStatusChangeListener also and are now 
storing the displayLayer at begin time, since stop might be called within 
LocalSampleBufferDisplayLayer destructor.
Covered by exsting tests.

* Source/WebCore/platform/graphics/avfoundation/SampleBufferDisplayLayer.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
(-[WebAVSampleBufferStatusChangeListener begin:]):
(-[WebAVSampleBufferStatusChangeListener stop]):
(-[WebAVSampleBufferStatusChangeListener 
observeValueForKeyPath:ofObject:change:context:]):
(WebCore::LocalSampleBufferDisplayLayer::initialize):
(WebCore::LocalSampleBufferDisplayLayer::~LocalSampleBufferDisplayLayer):
(WebCore::LocalSampleBufferDisplayLayer::updateRootLayerBoundsAndPosition):
(WebCore::LocalSampleBufferDisplayLayer::flush):
(WebCore::LocalSampleBufferDisplayLayer::flushAndRemoveImage):
(WebCore::LocalSampleBufferDisplayLayer::enqueueVideoFrame):
(WebCore::LocalSampleBufferDisplayLayer::enqueueBuffer):
(WebCore::LocalSampleBufferDisplayLayer::enqueueBufferInternal):
(WebCore::LocalSampleBufferDisplayLayer::onIrregularFrameRateNotification):
(WebCore::LocalSampleBufferDisplayLayer::clearVideoFrames):
(WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData):
(-[WebAVSampleBufferStatusChangeListener begin]): Deleted.
* Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to