Title: [247604] branches/safari-608-branch/Source/WebCore
Revision
247604
Author
kocsen_ch...@apple.com
Date
2019-07-18 13:24:32 -0700 (Thu, 18 Jul 2019)

Log Message

Cherry-pick r247525. rdar://problem/53229719

    Hop to the main thread when doing logging in RealtimeIncomingVideoSourceCocoa
    https://bugs.webkit.org/show_bug.cgi?id=199865

    Reviewed by Darin Adler.

    LoggerHelper routines allow logging messages in system console and inspector console.
    These routines iterate through a Vector of log observers which is not thread safe.
    Document, the main log observer, also expects to be called on the main thread.
    Manually tested (writing a layout test for this would require more than 2 seconds).

    * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
    (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247525 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (247603 => 247604)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-07-18 20:24:29 UTC (rev 247603)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-07-18 20:24:32 UTC (rev 247604)
@@ -1,5 +1,40 @@
 2019-07-17  Kocsen Chung  <kocsen_ch...@apple.com>
 
+        Cherry-pick r247525. rdar://problem/53229719
+
+    Hop to the main thread when doing logging in RealtimeIncomingVideoSourceCocoa
+    https://bugs.webkit.org/show_bug.cgi?id=199865
+    
+    Reviewed by Darin Adler.
+    
+    LoggerHelper routines allow logging messages in system console and inspector console.
+    These routines iterate through a Vector of log observers which is not thread safe.
+    Document, the main log observer, also expects to be called on the main thread.
+    Manually tested (writing a layout test for this would require more than 2 seconds).
+    
+    * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
+    (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-17  Youenn Fablet  <you...@apple.com>
+
+            Hop to the main thread when doing logging in RealtimeIncomingVideoSourceCocoa
+            https://bugs.webkit.org/show_bug.cgi?id=199865
+
+            Reviewed by Darin Adler.
+
+            LoggerHelper routines allow logging messages in system console and inspector console.
+            These routines iterate through a Vector of log observers which is not thread safe.
+            Document, the main log observer, also expects to be called on the main thread.
+            Manually tested (writing a layout test for this would require more than 2 seconds).
+
+            * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
+            (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
+
+2019-07-17  Kocsen Chung  <kocsen_ch...@apple.com>
+
         Cherry-pick r247521. rdar://problem/53229717
 
     Make ANGLE work inside WebKit2's sandbox

Modified: branches/safari-608-branch/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm (247603 => 247604)


--- branches/safari-608-branch/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm	2019-07-18 20:24:29 UTC (rev 247603)
+++ branches/safari-608-branch/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm	2019-07-18 20:24:32 UTC (rev 247604)
@@ -158,13 +158,18 @@
         return;
 
 #if !RELEASE_LOG_DISABLED
-    if (!(++m_numberOfFrames % 60))
-        ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "frame ", m_numberOfFrames);
+    if (!(++m_numberOfFrames % 60)) {
+        callOnMainThread([this, protectedThis = makeRef(*this), numberOfFrames = m_numberOfFrames] {
+            ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "frame ", numberOfFrames);
+        });
+    }
 #endif
 
     auto pixelBuffer = pixelBufferFromVideoFrame(frame);
     if (!pixelBuffer) {
-        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to get a pixel buffer from a frame");
+        callOnMainThread([this, protectedThis = makeRef(*this)] {
+            ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to get a pixel buffer from a frame");
+        });
         return;
     }
 
@@ -178,7 +183,9 @@
     CMVideoFormatDescriptionRef formatDescription;
     OSStatus ostatus = CMVideoFormatDescriptionCreateForImageBuffer(kCFAllocatorDefault, (CVImageBufferRef)pixelBuffer, &formatDescription);
     if (ostatus != noErr) {
-        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to initialize CMVideoFormatDescription with error ", static_cast<int>(ostatus));
+        callOnMainThread([this, protectedThis = makeRef(*this), ostatus] {
+            ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to initialize CMVideoFormatDescription with error ", static_cast<int>(ostatus));
+        });
         return;
     }
 
@@ -186,7 +193,9 @@
     ostatus = CMSampleBufferCreateReadyWithImageBuffer(kCFAllocatorDefault, (CVImageBufferRef)pixelBuffer, formatDescription, &timingInfo, &sampleBuffer);
     CFRelease(formatDescription);
     if (ostatus != noErr) {
-        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to create the sample buffer with error ", static_cast<int>(ostatus));
+        callOnMainThread([this, protectedThis = makeRef(*this), ostatus] {
+            ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to create the sample buffer with error ", static_cast<int>(ostatus));
+        });
         return;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to