mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
omxvideoenc: Always flush the ports and make sure no processing is happening in ::reset
This fixes a race condition that happened when seeking very often in a short period of time.
This commit is contained in:
parent
e56cff5f2a
commit
fbe171ee2c
1 changed files with 11 additions and 15 deletions
|
@ -1123,23 +1123,19 @@ gst_omx_video_enc_reset (GstBaseVideoEncoder * encoder)
|
||||||
g_list_free (GST_BASE_VIDEO_CODEC (self)->frames);
|
g_list_free (GST_BASE_VIDEO_CODEC (self)->frames);
|
||||||
GST_BASE_VIDEO_CODEC (self)->frames = NULL;
|
GST_BASE_VIDEO_CODEC (self)->frames = NULL;
|
||||||
|
|
||||||
if (self->started) {
|
gst_omx_port_set_flushing (self->in_port, TRUE);
|
||||||
self->started = FALSE;
|
gst_omx_port_set_flushing (self->out_port, TRUE);
|
||||||
|
|
||||||
gst_omx_port_set_flushing (self->in_port, TRUE);
|
/* Wait until the srcpad loop is finished,
|
||||||
gst_omx_port_set_flushing (self->out_port, TRUE);
|
* unlock GST_BASE_VIDEO_CODEC_STREAM_LOCK to prevent deadlocks
|
||||||
|
* caused by using this lock from inside the loop function */
|
||||||
|
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
|
||||||
|
GST_PAD_STREAM_LOCK (GST_BASE_VIDEO_CODEC_SRC_PAD (self));
|
||||||
|
GST_PAD_STREAM_UNLOCK (GST_BASE_VIDEO_CODEC_SRC_PAD (self));
|
||||||
|
GST_BASE_VIDEO_CODEC_STREAM_LOCK (self);
|
||||||
|
|
||||||
/* Wait until the srcpad loop is finished,
|
gst_omx_port_set_flushing (self->in_port, FALSE);
|
||||||
* unlock GST_BASE_VIDEO_CODEC_STREAM_LOCK to prevent deadlocks
|
gst_omx_port_set_flushing (self->out_port, FALSE);
|
||||||
* caused by using this lock from inside the loop function */
|
|
||||||
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK (self);
|
|
||||||
GST_PAD_STREAM_LOCK (GST_BASE_VIDEO_CODEC_SRC_PAD (self));
|
|
||||||
GST_PAD_STREAM_UNLOCK (GST_BASE_VIDEO_CODEC_SRC_PAD (self));
|
|
||||||
GST_BASE_VIDEO_CODEC_STREAM_LOCK (self);
|
|
||||||
|
|
||||||
gst_omx_port_set_flushing (self->in_port, FALSE);
|
|
||||||
gst_omx_port_set_flushing (self->out_port, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start the srcpad loop again */
|
/* Start the srcpad loop again */
|
||||||
self->eos = FALSE;
|
self->eos = FALSE;
|
||||||
|
|
Loading…
Reference in a new issue