diff options
author | Josep Torra <n770galaxy@gmail.com> | 2013-05-10 12:25:07 +0200 |
---|---|---|
committer | Josep Torra <n770galaxy@gmail.com> | 2013-05-10 12:25:07 +0200 |
commit | 64ef1f0e11ee9f49c7b253f8d8affc561c394321 (patch) | |
tree | 7c1c83307b9d22296aa1e1021cf411469708fdf7 | |
parent | 699d3248ef129ca6831c68a84731b385b94699e2 (diff) |
omxvideodec: Redesign video size change reconfiguration code
Ensure stop the decoder before clossing the tunnel.
-rw-r--r-- | omx/gstomxvideodec.c | 95 |
1 files changed, 40 insertions, 55 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 09f1825..5378f60 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -2557,80 +2557,65 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, } else { #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) if (self->eglimage) { - OMX_STATETYPE egl_state; - - if (gst_omx_port_set_enabled (self->dec_in_port, - FALSE) != OMX_ErrorNone) - return FALSE; - - if (gst_omx_port_set_enabled (self->dec_out_port, - FALSE) != OMX_ErrorNone) - return FALSE; - - if (gst_omx_port_wait_buffers_released (self->dec_in_port, - 5 * GST_SECOND) != OMX_ErrorNone) - return FALSE; - - if (gst_omx_port_wait_buffers_released (self->dec_out_port, - 5 * GST_SECOND) != OMX_ErrorNone) - return FALSE; - - if (gst_omx_port_deallocate_buffers (self->dec_in_port) != - OMX_ErrorNone) - return FALSE; + gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE); + gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE); + gst_omx_port_set_flushing (self->egl_in_port, 5 * GST_SECOND, TRUE); + gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, TRUE); + } +#endif - if (gst_omx_port_wait_enabled (self->dec_in_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; + if (gst_omx_port_set_enabled (self->dec_in_port, FALSE) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_wait_buffers_released (self->dec_in_port, + 5 * GST_SECOND) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_wait_buffers_released (out_port, + 1 * GST_SECOND) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_deallocate_buffers (self->dec_in_port) != OMX_ErrorNone) + return FALSE; + if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_wait_enabled (self->dec_in_port, + 1 * GST_SECOND) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_wait_enabled (out_port, 1 * GST_SECOND) != OMX_ErrorNone) + return FALSE; - if (gst_omx_port_wait_enabled (self->dec_out_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) + if (self->eglimage) { + OMX_STATETYPE egl_state; egl_state = gst_omx_component_get_state (self->egl_render, 0); if (egl_state > OMX_StateLoaded || egl_state == OMX_StateInvalid) { + if (egl_state > OMX_StateIdle) { gst_omx_component_set_state (self->egl_render, OMX_StateIdle); - gst_omx_component_get_state (self->egl_render, 5 * GST_SECOND); + gst_omx_component_set_state (self->dec, OMX_StateIdle); + egl_state = gst_omx_component_get_state (self->egl_render, + 5 * GST_SECOND); + gst_omx_component_get_state (self->dec, 1 * GST_SECOND); } gst_omx_component_set_state (self->egl_render, OMX_StateLoaded); + gst_omx_component_set_state (self->dec, OMX_StateLoaded); - gst_omx_video_dec_deallocate_output_buffers (self); gst_omx_component_close_tunnel (self->dec, self->dec_out_port, self->egl_render, self->egl_in_port); if (egl_state > OMX_StateLoaded) { gst_omx_component_get_state (self->egl_render, 5 * GST_SECOND); } + + gst_omx_component_set_state (self->dec, OMX_StateIdle); + + gst_omx_component_set_state (self->dec, OMX_StateExecuting); + gst_omx_component_get_state (self->dec, GST_CLOCK_TIME_NONE); } self->eglimage = FALSE; - } else { -#else - { - if (gst_omx_port_set_enabled (self->dec_in_port, - FALSE) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_wait_buffers_released (self->dec_in_port, - 5 * GST_SECOND) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_wait_buffers_released (out_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_deallocate_buffers (self->dec_in_port) != - OMX_ErrorNone) - return FALSE; - if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_wait_enabled (self->dec_in_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_wait_enabled (out_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; -#endif } +#endif } if (self->input_state) gst_video_codec_state_unref (self->input_state); |