diff options
author | Josep Torra <n770galaxy@gmail.com> | 2014-03-10 17:43:50 +0100 |
---|---|---|
committer | Julien Isorce <julien.isorce@collabora.co.uk> | 2014-03-28 11:40:20 +0000 |
commit | 718fd1bb93a09137a139d050e537f07daaf654b3 (patch) | |
tree | 551f7ea3236561afa3cd90665e146291aa04e14b | |
parent | 5724df75231e83c510b00c851ae25aa5024e5798 (diff) | |
download | gst-omx-718fd1bb93a09137a139d050e537f07daaf654b3.tar.gz |
omxvideodec: Implement pipeline draining to support adaptive scenarios
When draining due a format change also drain
the pipeline to reclaim back all buffers.
https://bugzilla.gnome.org/show_bug.cgi?id=726107
-rw-r--r-- | examples/egl/testegl.c | 8 | ||||
-rw-r--r-- | omx/gstomxvideodec.c | 18 |
2 files changed, 12 insertions, 14 deletions
diff --git a/examples/egl/testegl.c b/examples/egl/testegl.c index a8d61ca..73d4374 100644 --- a/examples/egl/testegl.c +++ b/examples/egl/testegl.c @@ -1275,7 +1275,8 @@ query_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) GstQuery *query = GST_PAD_PROBE_INFO_QUERY (info); switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_ALLOCATION:{ + case GST_QUERY_ALLOCATION: + { GstBufferPool *pool; GstStructure *config; GstCaps *caps; @@ -1378,8 +1379,13 @@ query_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) GST_DEBUG ("done alocation"); return GST_PAD_PROBE_OK; + break; } + case GST_QUERY_DRAIN: + { + flush_internal (state); break; + } default: break; } diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 682ac8f..357e236 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -1445,6 +1445,10 @@ eos: { g_mutex_lock (&self->drain_lock); if (self->draining) { + /* Drain the pipeline to reclaim all memories back to the pool */ + gst_pad_peer_query (GST_VIDEO_DECODER_SRC_PAD (self), + gst_query_new_drain ()); + GST_DEBUG_OBJECT (self, "Drained"); self->draining = FALSE; g_cond_broadcast (&self->drain_cond); @@ -1759,15 +1763,9 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, GST_DEBUG_OBJECT (self, "Need to disable and drain decoder"); gst_omx_video_dec_drain (self, FALSE); + gst_omx_video_dec_flush (decoder); gst_omx_port_set_flushing (out_port, 5 * GST_SECOND, TRUE); - /* Wait until the srcpad loop is finished, - * unlock GST_VIDEO_DECODER_STREAM_LOCK to prevent deadlocks - * caused by using this lock from inside the loop function */ - GST_VIDEO_DECODER_STREAM_UNLOCK (self); - gst_pad_stop_task (GST_VIDEO_DECODER_SRC_PAD (decoder)); - GST_VIDEO_DECODER_STREAM_LOCK (self); - if (klass->cdata.hacks & GST_OMX_HACK_NO_COMPONENT_RECONFIGURE) { GST_VIDEO_DECODER_STREAM_UNLOCK (self); gst_omx_video_dec_stop (GST_VIDEO_DECODER (self)); @@ -1929,13 +1927,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, return FALSE; } - /* Start the srcpad loop again */ - GST_DEBUG_OBJECT (self, "Starting task again"); - self->downstream_flow_ret = GST_FLOW_OK; - gst_pad_start_task (GST_VIDEO_DECODER_SRC_PAD (self), - (GstTaskFunction) gst_omx_video_dec_loop, decoder, NULL); - return TRUE; } |