From 2f2c17a1b5ab7621b8e85a9ecc0a16728fe58ccc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 20 Oct 2011 14:32:40 +0200 Subject: [PATCH] omxvideodec: Fix deadlock if ::reset is called before finding the corresponding frame of a decoded buffer --- omx/gstomxvideodec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 3e63a84..8788f64 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -390,6 +390,15 @@ _find_nearest_frame (GstOMXVideoDec * self, GstOMXBuffer * buf) guint64 best_diff = G_MAXUINT64; BufferIdentification *best_id = NULL; + /* This prevents a deadlock between the srcpad stream + * lock and the videocodec stream lock, if ::reset() + * is called at the wrong time + */ + if (gst_omx_port_is_flushing (self->out_port)) { + GST_DEBUG_OBJECT (self, "Flushing -- returning NULL"); + return NULL; + } + GST_BASE_VIDEO_CODEC_STREAM_LOCK (self); for (l = GST_BASE_VIDEO_CODEC (self)->frames; l; l = l->next) { GstVideoFrame *tmp = l->data; -- 2.7.4