mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
omxvideodec: Redesign video size change reconfiguration code
Ensure stop the decoder before clossing the tunnel.
This commit is contained in:
parent
699d3248ef
commit
64ef1f0e11
1 changed files with 41 additions and 56 deletions
|
@ -2557,58 +2557,14 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
|
||||||
} else {
|
} else {
|
||||||
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL)
|
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL)
|
||||||
if (self->eglimage) {
|
if (self->eglimage) {
|
||||||
OMX_STATETYPE egl_state;
|
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);
|
||||||
if (gst_omx_port_set_enabled (self->dec_in_port,
|
gst_omx_port_set_flushing (self->egl_in_port, 5 * GST_SECOND, TRUE);
|
||||||
FALSE) != OMX_ErrorNone)
|
gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, TRUE);
|
||||||
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;
|
|
||||||
|
|
||||||
if (gst_omx_port_wait_enabled (self->dec_in_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;
|
|
||||||
|
|
||||||
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->egl_render, OMX_StateLoaded);
|
#endif
|
||||||
|
|
||||||
gst_omx_video_dec_deallocate_output_buffers (self);
|
if (gst_omx_port_set_enabled (self->dec_in_port, FALSE) != OMX_ErrorNone)
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self->eglimage = FALSE;
|
|
||||||
} else {
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
if (gst_omx_port_set_enabled (self->dec_in_port,
|
|
||||||
FALSE) != OMX_ErrorNone)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone)
|
if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2618,19 +2574,48 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
|
||||||
if (gst_omx_port_wait_buffers_released (out_port,
|
if (gst_omx_port_wait_buffers_released (out_port,
|
||||||
1 * GST_SECOND) != OMX_ErrorNone)
|
1 * GST_SECOND) != OMX_ErrorNone)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (gst_omx_port_deallocate_buffers (self->dec_in_port) !=
|
if (gst_omx_port_deallocate_buffers (self->dec_in_port) != OMX_ErrorNone)
|
||||||
OMX_ErrorNone)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
|
if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (gst_omx_port_wait_enabled (self->dec_in_port,
|
if (gst_omx_port_wait_enabled (self->dec_in_port,
|
||||||
1 * GST_SECOND) != OMX_ErrorNone)
|
1 * GST_SECOND) != OMX_ErrorNone)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (gst_omx_port_wait_enabled (out_port,
|
if (gst_omx_port_wait_enabled (out_port, 1 * GST_SECOND) != OMX_ErrorNone)
|
||||||
1 * GST_SECOND) != OMX_ErrorNone)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
|
||||||
|
#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_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_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;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (self->input_state)
|
if (self->input_state)
|
||||||
gst_video_codec_state_unref (self->input_state);
|
gst_video_codec_state_unref (self->input_state);
|
||||||
|
|
Loading…
Reference in a new issue