Commit 32e58517 authored by Wim Taymans's avatar Wim Taymans

ext/ffmpeg/gstffmpegdec.c: make _open and _close as functions that should be...

ext/ffmpeg/gstffmpegdec.c: make _open and _close as functions that should be called with the object lock instead of t...

Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_change_state):
make _open and _close as functions that should be
called with the object lock instead of them taking a
lock themselves. This fixes a deadlock when
_open fails.
parent fd380cb8
2006-03-22 Wim Taymans <wim@fluendo.com>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_change_state):
make _open and _close as functions that should be
called with the object lock instead of them taking a
lock themselves. This fixes a deadlock when
_open fails.
2006-03-14 Tim-Philipp Müller <tim at centricular dot net> 2006-03-14 Tim-Philipp Müller <tim at centricular dot net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame): * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame):
......
common @ f1c7bfd2
Subproject commit 9200457d08a57f0d7eaeb56915804fa8faf14418 Subproject commit f1c7bfd24d0fcc4e5113ce3b96b1fac83a9ec560
...@@ -370,13 +370,12 @@ gst_ffmpegdec_event (GstPad * pad, GstEvent * event) ...@@ -370,13 +370,12 @@ gst_ffmpegdec_event (GstPad * pad, GstEvent * event)
return FALSE; /* .. */ return FALSE; /* .. */
} }
/* with LOCK */
static void static void
gst_ffmpegdec_close (GstFFMpegDec * ffmpegdec) gst_ffmpegdec_close (GstFFMpegDec * ffmpegdec)
{ {
GST_OBJECT_LOCK (ffmpegdec);
if (!ffmpegdec->opened) if (!ffmpegdec->opened)
goto done; return;
if (ffmpegdec->par) { if (ffmpegdec->par) {
g_free (ffmpegdec->par); g_free (ffmpegdec->par);
...@@ -408,11 +407,9 @@ gst_ffmpegdec_close (GstFFMpegDec * ffmpegdec) ...@@ -408,11 +407,9 @@ gst_ffmpegdec_close (GstFFMpegDec * ffmpegdec)
ffmpegdec->format.video.fps_n = -1; ffmpegdec->format.video.fps_n = -1;
ffmpegdec->format.video.old_fps_n = -1; ffmpegdec->format.video.old_fps_n = -1;
done:
GST_OBJECT_UNLOCK (ffmpegdec);
} }
/* with LOCK */
static gboolean static gboolean
gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec) gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
{ {
...@@ -478,11 +475,11 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps) ...@@ -478,11 +475,11 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
GST_DEBUG_OBJECT (pad, "setcaps called"); GST_DEBUG_OBJECT (pad, "setcaps called");
GST_OBJECT_LOCK (ffmpegdec);
/* close old session */ /* close old session */
gst_ffmpegdec_close (ffmpegdec); gst_ffmpegdec_close (ffmpegdec);
GST_OBJECT_LOCK (ffmpegdec);
/* set defaults */ /* set defaults */
avcodec_get_context_defaults (ffmpegdec->context); avcodec_get_context_defaults (ffmpegdec->context);
...@@ -1291,11 +1288,13 @@ gst_ffmpegdec_change_state (GstElement * element, GstStateChange transition) ...@@ -1291,11 +1288,13 @@ gst_ffmpegdec_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_OBJECT_LOCK (ffmpegdec);
gst_ffmpegdec_close (ffmpegdec); gst_ffmpegdec_close (ffmpegdec);
if (ffmpegdec->last_buffer != NULL) { if (ffmpegdec->last_buffer != NULL) {
gst_buffer_unref (ffmpegdec->last_buffer); gst_buffer_unref (ffmpegdec->last_buffer);
ffmpegdec->last_buffer = NULL; ffmpegdec->last_buffer = NULL;
} }
GST_OBJECT_UNLOCK (ffmpegdec);
break; break;
default: default:
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment