From 9a6cea5af3709427ca5059f81eaa791d80786884 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 7 Nov 2011 11:05:29 +0100 Subject: [PATCH] omxvideoenc: Fix deadlock between srcpad stream lock and ::reset() --- omx/gstomxvideoenc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 61eaf93..c7dd5ef 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -758,6 +758,16 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self) GST_DEBUG_OBJECT (self, "Handling buffer: 0x%08x %lu", buf->omx_buf->nFlags, buf->omx_buf->nTimeStamp); + /* 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"); + gst_omx_port_release_buffer (self->out_port, buf); + goto flushing; + } + frame = _find_nearest_frame (self, buf); if ((buf->omx_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG) && buf->omx_buf->nFilledLen > 0) { -- 2.7.4