From 472d1959a228d016cf44ca846245e40c6e393944 Mon Sep 17 00:00:00 2001 From: Ilya Konstantinov Date: Sun, 19 Apr 2015 01:21:40 +0300 Subject: [PATCH] avfvideosrc: check for failure to create buffer gst_core_media_buffer_new and gst_core_video_texture_cache_get_gl_buffer can fail for various platform reasons. https://bugzilla.gnome.org/show_bug.cgi?id=748122 --- sys/applemedia/avfvideosrc.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/applemedia/avfvideosrc.m b/sys/applemedia/avfvideosrc.m index 7141991..8d456a7 100644 --- a/sys/applemedia/avfvideosrc.m +++ b/sys/applemedia/avfvideosrc.m @@ -909,6 +909,11 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer } *buf = gst_core_media_buffer_new (sbuf, useVideoMeta, textureCache == NULL); + if (*buf == NULL) { + CFRelease (sbuf); + return GST_FLOW_ERROR; + } + if (format == GST_VIDEO_FORMAT_RGBA) { /* So now buf contains BGRA data (!) . Since downstream is actually going to * use the GL upload meta to get RGBA textures (??), we need to override the @@ -920,8 +925,11 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer } CFRelease (sbuf); - if (textureCache != NULL) + if (textureCache != NULL) { *buf = gst_core_video_texture_cache_get_gl_buffer (textureCache, *buf); + if (*buf == NULL) + return GST_FLOW_ERROR; + } GST_BUFFER_OFFSET (*buf) = offset++; GST_BUFFER_OFFSET_END (*buf) = GST_BUFFER_OFFSET (*buf) + 1; -- 2.7.4