summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorMatthew Waters <ystreet00@gmail.com>2013-07-18 20:21:57 +1000
committerSebastian Dröge <slomo@circular-chaos.org>2013-07-19 09:56:52 +0200
commitc7df41b5d5e2ca0af81103fc731f9627b983c975 (patch)
tree4007333bfd2d88c9cb8078acf8163451706daeb5 /gst-libs
parentd694d633317303f1a19f6faaa381bb0989fdbb10 (diff)
up/download: check return values
So we fail properly
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/gl/gstglfilter.c74
-rw-r--r--gst-libs/gst/gl/gstglmemory.c26
-rw-r--r--gst-libs/gst/gl/gstglmixer.c35
3 files changed, 94 insertions, 41 deletions
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c
index cd6eba5..65a4796 100644
--- a/gst-libs/gst/gl/gstglfilter.c
+++ b/gst-libs/gst/gl/gstglfilter.c
@@ -947,12 +947,16 @@ gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
if (!filter->upload) {
filter->upload = gst_gl_upload_new (filter->display);
- gst_gl_upload_init_format (filter->upload,
- GST_VIDEO_FRAME_FORMAT (&in_frame),
- GST_VIDEO_FRAME_WIDTH (&in_frame),
- GST_VIDEO_FRAME_HEIGHT (&in_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_upload_init_format (filter->upload,
+ GST_VIDEO_FRAME_FORMAT (&in_frame),
+ GST_VIDEO_FRAME_WIDTH (&in_frame),
+ GST_VIDEO_FRAME_HEIGHT (&in_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init upload format"), (NULL));
+ return FALSE;
+ }
}
in_tex = filter->in_tex_id;
@@ -964,10 +968,14 @@ gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
if (!filter->download) {
filter->download = gst_gl_download_new (filter->display);
- gst_gl_download_init_format (filter->download,
- GST_VIDEO_FRAME_FORMAT (&out_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_download_init_format (filter->download,
+ GST_VIDEO_FRAME_FORMAT (&out_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init download format"), (NULL));
+ return FALSE;
+ }
}
in_tex = *(guint *) in_frame.data[0];
@@ -976,32 +984,42 @@ gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
if (!filter->upload) {
filter->upload = gst_gl_upload_new (filter->display);
- gst_gl_upload_init_format (filter->upload,
- GST_VIDEO_FRAME_FORMAT (&in_frame),
- GST_VIDEO_FRAME_WIDTH (&in_frame),
- GST_VIDEO_FRAME_HEIGHT (&in_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_upload_init_format (filter->upload,
+ GST_VIDEO_FRAME_FORMAT (&in_frame),
+ GST_VIDEO_FRAME_WIDTH (&in_frame),
+ GST_VIDEO_FRAME_HEIGHT (&in_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init upload format"), (NULL));
+ return FALSE;
+ }
}
if (!filter->download) {
filter->download = gst_gl_download_new (filter->display);
- gst_gl_download_init_format (filter->download,
- GST_VIDEO_FRAME_FORMAT (&out_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_download_init_format (filter->download,
+ GST_VIDEO_FRAME_FORMAT (&out_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init download format"), (NULL));
+ return FALSE;
+ }
}
- gst_gl_upload_perform_with_data (filter->upload, filter->in_tex_id,
- in_frame.data);
-
out_tex = filter->out_tex_id;
in_tex = filter->in_tex_id;
}
if (in_gl_wrapped) {
- gst_gl_upload_perform_with_data (filter->upload, in_tex, in_frame.data);
+ if (!gst_gl_upload_perform_with_data (filter->upload, in_tex,
+ in_frame.data)) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND, ("%s",
+ "Failed to upload video frame"), (NULL));
+ return FALSE;
+ }
}
GST_DEBUG ("calling filter_texture with textures in:%i out:%i", in_tex,
@@ -1011,8 +1029,12 @@ gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
ret = filter_class->filter_texture (filter, in_tex, out_tex);
if (out_gl_wrapped) {
- gst_gl_download_perform_with_data (filter->download, out_tex,
- out_frame.data);
+ if (!gst_gl_download_perform_with_data (filter->download, out_tex,
+ out_frame.data)) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to download video frame"), (NULL));
+ return FALSE;
+ }
}
gst_video_frame_unmap (&in_frame);
diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c
index 0cdf8e5..6108ca7 100644
--- a/gst-libs/gst/gl/gstglmemory.c
+++ b/gst-libs/gst/gl/gstglmemory.c
@@ -129,12 +129,17 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
if (!GST_GL_MEMORY_FLAG_IS_SET (gl_mem,
GST_GL_MEMORY_FLAG_UPLOAD_INITTED)) {
- gst_gl_upload_init_format (gl_mem->upload, gl_mem->v_format,
- gl_mem->width, gl_mem->height, gl_mem->width, gl_mem->height);
+ if (!gst_gl_upload_init_format (gl_mem->upload, gl_mem->v_format,
+ gl_mem->width, gl_mem->height, gl_mem->width,
+ gl_mem->height)) {
+ goto error;
+ }
GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_UPLOAD_INITTED);
}
- gst_gl_upload_perform_with_memory (gl_mem->upload, gl_mem);
+ if (!gst_gl_upload_perform_with_memory (gl_mem->upload, gl_mem)) {
+ goto error;
+ }
}
} else {
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "mapping GL texture:%u for writing",
@@ -150,12 +155,16 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD)) {
if (!GST_GL_MEMORY_FLAG_IS_SET (gl_mem,
GST_GL_MEMORY_FLAG_DOWNLOAD_INITTED)) {
- gst_gl_download_init_format (gl_mem->download, gl_mem->v_format,
- gl_mem->width, gl_mem->height);
+ if (!gst_gl_download_init_format (gl_mem->download, gl_mem->v_format,
+ gl_mem->width, gl_mem->height)) {
+ goto error;
+ }
GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_DOWNLOAD_INITTED);
}
- gst_gl_download_perform_with_memory (gl_mem->download, gl_mem);
+ if (!gst_gl_download_perform_with_memory (gl_mem->download, gl_mem)) {
+ goto error;
+ }
}
} else {
GST_CAT_TRACE (GST_CAT_GL_MEMORY,
@@ -168,6 +177,11 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
gl_mem->map_flags = flags;
return data;
+
+error:
+ {
+ return NULL;
+ }
}
void
diff --git a/gst-libs/gst/gl/gstglmixer.c b/gst-libs/gst/gl/gstglmixer.c
index 512ba1e..748e5a8 100644
--- a/gst-libs/gst/gl/gstglmixer.c
+++ b/gst-libs/gst/gl/gstglmixer.c
@@ -1451,10 +1451,14 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
if (!mix->download) {
mix->download = gst_gl_download_new (mix->display);
- gst_gl_download_init_format (mix->download,
- GST_VIDEO_FRAME_FORMAT (&out_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_download_init_format (mix->download,
+ GST_VIDEO_FRAME_FORMAT (&out_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init upload format"), (NULL));
+ return FALSE;
+ }
}
out_gl_wrapped = TRUE;
@@ -1510,16 +1514,24 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
if (!pad->upload) {
pad->upload = gst_gl_upload_new (mix->display);
- gst_gl_upload_init_format (pad->upload, in_format,
- in_width, in_height, in_width, in_height);
+ if (!gst_gl_upload_init_format (pad->upload, in_format,
+ in_width, in_height, in_width, in_height)) {
+ GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init upload format"), (NULL));
+ return FALSE;
+ }
if (!pad->in_tex_id)
gst_gl_display_gen_texture (mix->display, &pad->in_tex_id,
GST_VIDEO_FORMAT_RGBA, out_width, out_height);
}
- gst_gl_upload_perform_with_data (pad->upload, pad->in_tex_id,
- in_frame->data);
+ if (!gst_gl_upload_perform_with_data (pad->upload, pad->in_tex_id,
+ in_frame->data)) {
+ GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to upload video frame"), (NULL));
+ return FALSE;
+ }
in_tex = pad->in_tex_id;
pad->mapped = TRUE;
@@ -1534,7 +1546,12 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
out_tex);
if (out_gl_wrapped) {
- gst_gl_download_perform_with_data (mix->download, out_tex, out_frame.data);
+ if (gst_gl_download_perform_with_data (mix->download, out_tex,
+ out_frame.data)) {
+ GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s",
+ "Failed to download video frame"), (NULL));
+ return FALSE;
+ }
}
i = 0;