mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
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:
parent
c9a8224553
commit
78f104aa61
1 changed files with 5 additions and 10 deletions
|
@ -22,15 +22,11 @@
|
||||||
static void
|
static void
|
||||||
gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf)
|
gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
if (meta->image_buf != NULL) {
|
if (meta->image_buf != NULL)
|
||||||
CVPixelBufferUnlockBaseAddress (meta->image_buf,
|
CVPixelBufferUnlockBaseAddress (meta->image_buf,
|
||||||
kCVPixelBufferLock_ReadOnly);
|
kCVPixelBufferLock_ReadOnly);
|
||||||
CVBufferRelease(meta->image_buf);
|
|
||||||
}
|
CFRelease (meta->sample_buf);
|
||||||
if (meta->block_buf != NULL) {
|
|
||||||
CFRelease (meta->block_buf);
|
|
||||||
}
|
|
||||||
CVBufferRelease ((CVBufferRef)meta->sample_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
|
@ -78,8 +74,7 @@ gst_core_media_buffer_new (CMSampleBufferRef sample_buf)
|
||||||
pixel_buf = NULL;
|
pixel_buf = NULL;
|
||||||
block_buf = CMSampleBufferGetDataBuffer (sample_buf);
|
block_buf = CMSampleBufferGetDataBuffer (sample_buf);
|
||||||
|
|
||||||
if (image_buf != NULL &&
|
if (image_buf != NULL && CFGetTypeID (image_buf) == CVPixelBufferGetTypeID ()) {
|
||||||
CFGetTypeID (image_buf) == CVPixelBufferGetTypeID ()) {
|
|
||||||
pixel_buf = (CVPixelBufferRef) image_buf;
|
pixel_buf = (CVPixelBufferRef) image_buf;
|
||||||
|
|
||||||
if (CVPixelBufferLockBaseAddress (pixel_buf,
|
if (CVPixelBufferLockBaseAddress (pixel_buf,
|
||||||
|
@ -116,7 +111,7 @@ gst_core_media_buffer_new (CMSampleBufferRef sample_buf)
|
||||||
|
|
||||||
meta = (GstCoreMediaMeta *) gst_buffer_add_meta (buf,
|
meta = (GstCoreMediaMeta *) gst_buffer_add_meta (buf,
|
||||||
gst_core_media_meta_get_info (), NULL);
|
gst_core_media_meta_get_info (), NULL);
|
||||||
CVBufferRetain ((CVBufferRef)sample_buf);
|
CFRetain (sample_buf);
|
||||||
meta->sample_buf = sample_buf;
|
meta->sample_buf = sample_buf;
|
||||||
meta->image_buf = image_buf;
|
meta->image_buf = image_buf;
|
||||||
meta->pixel_buf = pixel_buf;
|
meta->pixel_buf = pixel_buf;
|
||||||
|
|
Loading…
Reference in a new issue