coremediabuffer: keep an extra ref to the image and data buffer
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Thu, 7 Nov 2013 20:37:29 +0000 (21:37 +0100)
committerAndoni Morales Alastruey <ylatuya@gmail.com>
Thu, 7 Nov 2013 20:37:29 +0000 (21:37 +0100)
sys/applemedia/coremediabuffer.c

index cf48154218b605327be6959fde78f567ad1bc592..56c38bc9e76821b0e852fbbaf01048f62ac0e673 100644 (file)
 static void
 gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf)
 {
-  if (meta->image_buf != NULL)
+  if (meta->image_buf != NULL) {
     CVPixelBufferUnlockBaseAddress (meta->image_buf,
         kCVPixelBufferLock_ReadOnly);
+    CVBufferRelease(meta->image_buf);
+  }
+  if (meta->block_buf != NULL) {
+    CFRelease (meta->block_buf);
+  }
 
   CFRelease (meta->sample_buf);
 }
@@ -112,6 +117,10 @@ gst_core_media_buffer_new (CMSampleBufferRef sample_buf)
   meta = (GstCoreMediaMeta *) gst_buffer_add_meta (buf,
       gst_core_media_meta_get_info (), NULL);
   CFRetain (sample_buf);
+  if (image_buf)
+    CVBufferRetain (image_buf);
+  if (block_buf)
+    CFRetain (block_buf);
   meta->sample_buf = sample_buf;
   meta->image_buf = image_buf;
   meta->pixel_buf = pixel_buf;