applemedia: coremediabuffer: use correct retain/release functions on CMSampleBufferRef buffer

Fixes a crash while releasing the sample buffer after the image
buffer it contains.

Also fixes a minor coding style error.

https://bugzilla.gnome.org/show_bug.cgi?id=711606
This commit is contained in:
Matthieu Bouron 2013-11-07 12:29:48 +00:00 committed by Sebastian Dröge
parent c9a8224553
commit 78f104aa61

View file

@ -22,15 +22,11 @@
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);
}
CVBufferRelease ((CVBufferRef)meta->sample_buf);
CFRelease (meta->sample_buf);
}
GType
@ -78,8 +74,7 @@ gst_core_media_buffer_new (CMSampleBufferRef sample_buf)
pixel_buf = NULL;
block_buf = CMSampleBufferGetDataBuffer (sample_buf);
if (image_buf != NULL &&
CFGetTypeID (image_buf) == CVPixelBufferGetTypeID ()) {
if (image_buf != NULL && CFGetTypeID (image_buf) == CVPixelBufferGetTypeID ()) {
pixel_buf = (CVPixelBufferRef) image_buf;
if (CVPixelBufferLockBaseAddress (pixel_buf,
@ -116,7 +111,7 @@ gst_core_media_buffer_new (CMSampleBufferRef sample_buf)
meta = (GstCoreMediaMeta *) gst_buffer_add_meta (buf,
gst_core_media_meta_get_info (), NULL);
CVBufferRetain ((CVBufferRef)sample_buf);
CFRetain (sample_buf);
meta->sample_buf = sample_buf;
meta->image_buf = image_buf;
meta->pixel_buf = pixel_buf;