summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-09-30 10:47:20 +0300
committerSebastian Dröge <sebastian@centricular.com>2014-09-30 10:47:20 +0300
commit40ab1b0a45d27b082f2d243977d4b07d4cff58f6 (patch)
tree11903ac242263194068a7e3d71c77b322e895227
parenteba9e3f29d01f8eab2bf32e12c944ad6c5ea1fea (diff)
omxaudiodec: Clean up code a bit to get rid of useless NULL checks
-rw-r--r--omx/gstomxaudiodec.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/omx/gstomxaudiodec.c b/omx/gstomxaudiodec.c
index cbf528f..6206fa2 100644
--- a/omx/gstomxaudiodec.c
+++ b/omx/gstomxaudiodec.c
@@ -991,15 +991,7 @@ gst_omx_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
GST_DEBUG_OBJECT (self, "Handling frame");
- /* Make sure to keep a reference to the input here,
- * it can be unreffed from the other thread if
- * finish_frame() is called */
- if (inbuf)
- gst_buffer_ref (inbuf);
-
if (self->downstream_flow_ret != GST_FLOW_OK) {
- if (inbuf)
- gst_buffer_unref (inbuf);
return self->downstream_flow_ret;
}
@@ -1012,6 +1004,11 @@ gst_omx_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
if (inbuf == NULL)
return gst_omx_audio_dec_drain (self);
+ /* Make sure to keep a reference to the input here,
+ * it can be unreffed from the other thread if
+ * finish_frame() is called */
+ gst_buffer_ref (inbuf);
+
timestamp = GST_BUFFER_TIMESTAMP (inbuf);
duration = GST_BUFFER_DURATION (inbuf);
@@ -1181,18 +1178,16 @@ gst_omx_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
goto release_error;
}
gst_buffer_unmap (inbuf, &minfo);
+ gst_buffer_unref (inbuf);
GST_DEBUG_OBJECT (self, "Passed frame to component");
- if (inbuf)
- gst_buffer_unref (inbuf);
return self->downstream_flow_ret;
full_buffer:
{
gst_buffer_unmap (inbuf, &minfo);
- if (inbuf)
- gst_buffer_unref (inbuf);
+ gst_buffer_unref (inbuf);
GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL),
("Got OpenMAX buffer with no free space (%p, %u/%u)", buf,
@@ -1203,8 +1198,7 @@ full_buffer:
flow_error:
{
gst_buffer_unmap (inbuf, &minfo);
- if (inbuf)
- gst_buffer_unref (inbuf);
+ gst_buffer_unref (inbuf);
return self->downstream_flow_ret;
}
@@ -1212,8 +1206,7 @@ flow_error:
too_large_codec_data:
{
gst_buffer_unmap (inbuf, &minfo);
- if (inbuf)
- gst_buffer_unref (inbuf);
+ gst_buffer_unref (inbuf);
GST_ELEMENT_ERROR (self, STREAM, FORMAT, (NULL),
("codec_data larger than supported by OpenMAX port "
@@ -1225,8 +1218,7 @@ too_large_codec_data:
component_error:
{
gst_buffer_unmap (inbuf, &minfo);
- if (inbuf)
- gst_buffer_unref (inbuf);
+ gst_buffer_unref (inbuf);
GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL),
("OpenMAX component in error state %s (0x%08x)",
@@ -1238,8 +1230,7 @@ component_error:
flushing:
{
gst_buffer_unmap (inbuf, &minfo);
- if (inbuf)
- gst_buffer_unref (inbuf);
+ gst_buffer_unref (inbuf);
GST_DEBUG_OBJECT (self, "Flushing -- returning FLUSHING");
return GST_FLOW_FLUSHING;
@@ -1247,8 +1238,7 @@ flushing:
reconfigure_error:
{
gst_buffer_unmap (inbuf, &minfo);
- if (inbuf)
- gst_buffer_unref (inbuf);
+ gst_buffer_unref (inbuf);
GST_ELEMENT_ERROR (self, LIBRARY, SETTINGS, (NULL),
("Unable to reconfigure input port"));
@@ -1257,8 +1247,7 @@ reconfigure_error:
release_error:
{
gst_buffer_unmap (inbuf, &minfo);
- if (inbuf)
- gst_buffer_unref (inbuf);
+ gst_buffer_unref (inbuf);
GST_ELEMENT_ERROR (self, LIBRARY, SETTINGS, (NULL),
("Failed to relase input buffer to component: %s (0x%08x)",