From 30610a746eae73f5fa1eba72351effcba7366297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 17 Nov 2011 10:19:10 -0800 Subject: [PATCH] omxvideodec: Shutdown component in PAUSED->READY and deallocate buffers --- omx/gstomxvideodec.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index d0de18fbb7..38846965c9 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -283,11 +283,11 @@ gst_omx_video_dec_open (GstOMXVideoDec * self) } static gboolean -gst_omx_video_dec_close (GstOMXVideoDec * self) +gst_omx_video_dec_shutdown (GstOMXVideoDec * self) { OMX_STATETYPE state; - GST_DEBUG_OBJECT (self, "Closing decoder"); + GST_DEBUG_OBJECT (self, "Shutting down decoder"); state = gst_omx_component_get_state (self->component, 0); if (state > OMX_StateLoaded || state == OMX_StateInvalid) { @@ -302,6 +302,17 @@ gst_omx_video_dec_close (GstOMXVideoDec * self) gst_omx_component_get_state (self->component, 5 * GST_SECOND); } + return TRUE; +} + +static gboolean +gst_omx_video_dec_close (GstOMXVideoDec * self) +{ + GST_DEBUG_OBJECT (self, "Closing decoder"); + + if (!gst_omx_video_dec_shutdown (self)) + return FALSE; + self->in_port = NULL; self->out_port = NULL; if (self->component) @@ -381,6 +392,9 @@ gst_omx_video_dec_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_PAUSED_TO_READY: self->downstream_flow_ret = GST_FLOW_WRONG_STATE; self->started = FALSE; + + if (!gst_omx_video_dec_shutdown (self)) + ret = GST_STATE_CHANGE_FAILURE; break; case GST_STATE_CHANGE_READY_TO_NULL: if (!gst_omx_video_dec_close (self))