Title: [239387] trunk/Source/WebCore
Revision
239387
Author
jer.no...@apple.com
Date
2018-12-19 13:11:12 -0800 (Wed, 19 Dec 2018)

Log Message

Force synchronous decode in WebCoreDecompressionSession::decodeSampleSync()
https://bugs.webkit.org/show_bug.cgi?id=192856
<rdar://problem/46843245>

Reviewed by Alex Christensen.

Some decoders exposed through VideoToolbox will decode asynchronously even when
kVTDecodeInfo_Asynchronous is not set. Force synchronous behavior with a Semaphore.

* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::decodeSampleSync):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239386 => 239387)


--- trunk/Source/WebCore/ChangeLog	2018-12-19 21:09:43 UTC (rev 239386)
+++ trunk/Source/WebCore/ChangeLog	2018-12-19 21:11:12 UTC (rev 239387)
@@ -1,3 +1,17 @@
+2018-12-19  Jer Noble  <jer.no...@apple.com>
+
+        Force synchronous decode in WebCoreDecompressionSession::decodeSampleSync()
+        https://bugs.webkit.org/show_bug.cgi?id=192856
+        <rdar://problem/46843245>
+
+        Reviewed by Alex Christensen.
+
+        Some decoders exposed through VideoToolbox will decode asynchronously even when 
+        kVTDecodeInfo_Asynchronous is not set. Force synchronous behavior with a Semaphore.
+
+        * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
+        (WebCore::WebCoreDecompressionSession::decodeSampleSync):
+
 2018-12-19  Megan Gardner  <megan_gard...@apple.com>
 
         Allow clients to set the navigator platform

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm (239386 => 239387)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm	2018-12-19 21:09:43 UTC (rev 239386)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm	2018-12-19 21:11:12 UTC (rev 239387)
@@ -39,6 +39,7 @@
 #import <wtf/MonotonicTime.h>
 #import <wtf/StringPrintStream.h>
 #import <wtf/Vector.h>
+#import <wtf/WTFSemaphore.h>
 #import <wtf/cf/TypeCastsCF.h>
 
 #import "CoreVideoSoftLink.h"
@@ -277,10 +278,13 @@
 
     RetainPtr<CVPixelBufferRef> pixelBuffer;
     VTDecodeInfoFlags flags { 0 };
+    WTF::Semaphore syncDecompressionOutputSemaphore { 0 };
     VTDecompressionSessionDecodeFrameWithOutputHandler(m_decompressionSession.get(), sample, flags, nullptr, [&] (OSStatus, VTDecodeInfoFlags, CVImageBufferRef imageBuffer, CMTime, CMTime) mutable {
         if (imageBuffer && CFGetTypeID(imageBuffer) == CVPixelBufferGetTypeID())
             pixelBuffer = (CVPixelBufferRef)imageBuffer;
+        syncDecompressionOutputSemaphore.signal();
     });
+    syncDecompressionOutputSemaphore.wait();
     return pixelBuffer;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to