diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2018-04-18 12:42:55 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2018-04-18 14:01:39 +0200 |
commit | e1a149f3d52ab9e1f5d7b7f9a83eb59be2f6e0ee (patch) | |
tree | b8232a3d41600127818ad8e28355b146b1a4239d /omx | |
parent | dfd270042fa6707563b98dc851eed413d94c7fcc (diff) | |
download | gst-omx-e1a149f3d52ab9e1f5d7b7f9a83eb59be2f6e0ee.tar.gz |
omxvideoenc/dec: fix handling of component enabling failing
- Report the error from OMX if any (OMX_EventError)
- If not report the failing to the application (GST_ELEMENT_ERROR)
- return GST_FLOW_ERROR rather than FALSE
- don't leak @frame
https://bugzilla.gnome.org/show_bug.cgi?id=795352
Diffstat (limited to 'omx')
-rw-r--r-- | omx/gstomxvideodec.c | 17 | ||||
-rw-r--r-- | omx/gstomxvideoenc.c | 17 |
2 files changed, 32 insertions, 2 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 1b4207f..812eb29 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -2733,7 +2733,7 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder, if (gst_omx_port_is_flushing (self->dec_out_port)) { if (!gst_omx_video_dec_enable (self, frame->input_buffer)) - return FALSE; + goto enable_error; } GST_DEBUG_OBJECT (self, "Starting task"); @@ -3001,6 +3001,21 @@ map_failed: return GST_FLOW_ERROR; } +enable_error: + { + /* Report the OMX error, if any */ + if (gst_omx_component_get_last_error (self->dec) != OMX_ErrorNone) + GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL), + ("Failed to enable OMX decoder: %s (0x%08x)", + gst_omx_component_get_last_error_string (self->dec), + gst_omx_component_get_last_error (self->dec))); + else + GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL), + ("Failed to enable OMX decoder")); + gst_video_codec_frame_unref (frame); + return GST_FLOW_ERROR; + } + component_error: { gst_video_codec_frame_unref (frame); diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index dfc6244..2079bba 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -2582,7 +2582,7 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder, if (!self->started) { if (gst_omx_port_is_flushing (self->enc_out_port)) { if (!gst_omx_video_enc_enable (self, frame->input_buffer)) - return FALSE; + goto enable_error; } GST_DEBUG_OBJECT (self, "Starting task"); @@ -2758,6 +2758,21 @@ flow_error: return self->downstream_flow_ret; } +enable_error: + { + /* Report the OMX error, if any */ + if (gst_omx_component_get_last_error (self->enc) != OMX_ErrorNone) + GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL), + ("Failed to enable OMX encoder: %s (0x%08x)", + gst_omx_component_get_last_error_string (self->enc), + gst_omx_component_get_last_error (self->enc))); + else + GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL), + ("Failed to enable OMX encoder")); + gst_video_codec_frame_unref (frame); + return GST_FLOW_ERROR; + } + component_error: { GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL), |