Bug 227444

Summary: Make LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData hop to main thread before hopping to processing thread
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, eric.carlson, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description youenn fablet 2021-06-28 05:14:39 PDT
Make LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData hop to main thread before hopping to processing thread
Comment 1 youenn fablet 2021-06-28 05:14:53 PDT
<rdar://79413368>
Comment 2 youenn fablet 2021-06-28 05:18:27 PDT
Created attachment 432384 [details]
Patch
Comment 3 youenn fablet 2021-07-01 03:41:40 PDT
ping review
Comment 4 Chris Dumez 2021-07-01 12:32:34 PDT
Comment on attachment 432384 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=432384&action=review

> Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:401
> +        m_processingQueue->dispatch([this] {

Why is this safe? What guarantees that |this| is still alive when the lambda runs?
Comment 5 youenn fablet 2021-07-01 12:52:08 PDT
(In reply to Chris Dumez from comment #4)
> Comment on attachment 432384 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=432384&action=review
> 
> > Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:401
> > +        m_processingQueue->dispatch([this] {
> 
> Why is this safe? What guarantees that |this| is still alive when the lambda
> runs?

We are doing a dispatchSync in LocalSampleBufferDisplayLayer destructor.
Comment 6 Chris Dumez 2021-07-01 12:54:21 PDT
Comment on attachment 432384 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=432384&action=review

>>> Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:401
>>> +        m_processingQueue->dispatch([this] {
>> 
>> Why is this safe? What guarantees that |this| is still alive when the lambda runs?
> 
> We are doing a dispatchSync in LocalSampleBufferDisplayLayer destructor.

Ah, sneaky :) Seems safe indeed then. Sorry about the noise.
Comment 7 EWS 2021-07-02 00:09:59 PDT
Committed r279500 (239352@main): <https://commits.webkit.org/239352@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 432384 [details].