plugins: fix code style for errors

https://bugzilla.gnome.org/show_bug.cgi?id=773497
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-10-20 18:12:04 +02:00
parent 34e8579238
commit 0f938be7a4
6 changed files with 84 additions and 42 deletions

View file

@ -341,9 +341,11 @@ _h264_convert_byte_stream_to_avc (GstBuffer * buf)
return TRUE;
error:
{
gst_buffer_unmap (buf, &info);
return FALSE;
}
}
static GstFlowReturn
gst_vaapiencode_h264_alloc_buffer (GstVaapiEncode * base_encode,

View file

@ -340,9 +340,11 @@ _h265_convert_byte_stream_to_hvc (GstBuffer * buf)
return TRUE;
error:
{
gst_buffer_unmap (buf, &info);
return FALSE;
}
}
static GstFlowReturn
gst_vaapiencode_h265_alloc_buffer (GstVaapiEncode * base_encode,

View file

@ -1449,18 +1449,23 @@ done:
gst_buffer_unref (buffer);
return ret;
/* ERRORS */
error:
{
GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
("Internal error: could not render surface"), (NULL));
ret = GST_FLOW_ERROR;
goto done;
}
no_surface:
{
/* No surface or surface proxy. That's very bad! */
GST_WARNING_OBJECT (sink, "could not get surface");
ret = GST_FLOW_ERROR;
goto done;
}
}
static GstFlowReturn
gst_vaapisink_show_frame (GstVideoSink * video_sink, GstBuffer * src_buffer)

View file

@ -436,30 +436,46 @@ gst_vaapi_video_memory_map (GstVaapiVideoMemory * mem, gsize maxsize,
/* ERRORS */
error_unsupported_map:
{
GST_ERROR ("unsupported map flags (0x%x)", flags);
return NULL;
}
error_unsupported_map_type:
{
GST_ERROR ("unsupported map type (%d)", mem->map_type);
return NULL;
}
error_no_surface_proxy:
{
GST_ERROR ("failed to extract GstVaapiSurfaceProxy from video meta");
return NULL;
}
error_no_surface:
{
GST_ERROR ("failed to extract VA surface from video buffer");
return NULL;
}
error_no_current_surface:
{
GST_ERROR ("failed to make surface current");
return NULL;
}
error_no_image:
{
GST_ERROR ("failed to extract VA image from video buffer");
return NULL;
}
error_no_current_image:
{
GST_ERROR ("failed to make image current");
return NULL;
}
error_map_image:
{
GST_ERROR ("failed to map VA image");
return NULL;
}
}
static void
gst_vaapi_video_memory_unmap (GstVaapiVideoMemory * mem)
@ -482,9 +498,11 @@ gst_vaapi_video_memory_unmap (GstVaapiVideoMemory * mem)
/* ERRORS */
error_incompatible_map:
{
GST_ERROR ("incompatible map type (%d)", mem->map_type);
return;
}
}
static GstVaapiVideoMemory *
gst_vaapi_video_memory_copy (GstVaapiVideoMemory * mem,
@ -518,15 +536,21 @@ gst_vaapi_video_memory_copy (GstVaapiVideoMemory * mem,
/* ERRORS */
error_no_current_surface:
{
GST_ERROR ("failed to make surface current");
return NULL;
}
error_unsupported:
{
GST_ERROR ("failed to copy partial memory (unsupported operation)");
return NULL;
}
error_allocate_memory:
{
GST_ERROR ("failed to allocate GstVaapiVideoMemory copy");
return NULL;
}
}
static GstVaapiVideoMemory *
gst_vaapi_video_memory_share (GstVaapiVideoMemory * mem,

View file

@ -307,10 +307,13 @@ gst_vaapi_video_meta_new_from_pool (GstVaapiVideoPool * pool)
set_display (meta, gst_vaapi_video_pool_get_display (pool));
return meta;
/* ERRORS */
error:
{
gst_vaapi_video_meta_unref (meta);
return NULL;
}
}
/**
* gst_vaapi_video_meta_new_with_image:

View file

@ -143,10 +143,13 @@ meta_texture_new (void)
goto error;
return meta;
/* ERRORS */
error:
{
meta_texture_free (meta);
return NULL;
}
}
static GstVaapiVideoMetaTexture *
meta_texture_copy (GstVaapiVideoMetaTexture * meta)
@ -237,10 +240,13 @@ gst_buffer_add_texture_upload_meta (GstBuffer * buffer)
goto error;
return TRUE;
/* ERRORS */
error:
{
meta_texture_free (meta_texture);
return FALSE;
}
}
gboolean
gst_buffer_ensure_texture_upload_meta (GstBuffer * buffer)