Title: [225374] trunk/Source/WebCore
Revision
225374
Author
[email protected]
Date
2017-11-30 16:57:13 -0800 (Thu, 30 Nov 2017)

Log Message

[Cocoa] Fix CVPixelBuffer leak
https://bugs.webkit.org/show_bug.cgi?id=180224

Patch by Joseph Pecoraro <[email protected]> on 2017-11-30
Reviewed by Youenn Fablet.

* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
Adopt the newly created pixel buffer.

(WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
Release the format description as soon as we are done with it. Otherwise
we could have bailed before releasing it.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225373 => 225374)


--- trunk/Source/WebCore/ChangeLog	2017-12-01 00:54:41 UTC (rev 225373)
+++ trunk/Source/WebCore/ChangeLog	2017-12-01 00:57:13 UTC (rev 225374)
@@ -1,3 +1,18 @@
+2017-11-30  Joseph Pecoraro  <[email protected]>
+
+        [Cocoa] Fix CVPixelBuffer leak
+        https://bugs.webkit.org/show_bug.cgi?id=180224
+
+        Reviewed by Youenn Fablet.
+
+        * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
+        (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
+        Adopt the newly created pixel buffer.
+
+        (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
+        Release the format description as soon as we are done with it. Otherwise
+        we could have bailed before releasing it.
+
 2017-11-30  Simon Fraser  <[email protected]>
 
         Improve filter logging

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp (225373 => 225374)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp	2017-12-01 00:54:41 UTC (rev 225373)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp	2017-12-01 00:57:13 UTC (rev 225374)
@@ -65,7 +65,7 @@
             auto status = CVPixelBufferCreate(kCFAllocatorDefault, frame.width(), frame.height(), kCVPixelFormatType_420YpCbCr8Planar, nullptr, &pixelBuffer);
             ASSERT_UNUSED(status, status == noErr);
 
-            m_blackFrame = pixelBuffer;
+            m_blackFrame = adoptCF(pixelBuffer);
             m_blackFrameWidth = frame.width();
             m_blackFrameHeight = frame.height();
 
@@ -114,11 +114,11 @@
 
     CMSampleBufferRef sampleBuffer;
     ostatus = CMSampleBufferCreateReadyWithImageBuffer(kCFAllocatorDefault, (CVImageBufferRef)pixelBuffer, formatDescription, &timingInfo, &sampleBuffer);
+    CFRelease(formatDescription);
     if (ostatus != noErr) {
         LOG_ERROR("Failed to create the sample buffer: %d", static_cast<int>(ostatus));
         return;
     }
-    CFRelease(formatDescription);
 
     auto sample = adoptCF(sampleBuffer);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to