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
This commit is contained in:
Ilya Konstantinov 2015-04-19 01:21:40 +03:00 committed by Sebastian Dröge
parent 4a88951c52
commit 472d1959a2

View file

@ -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;