diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2006-03-22 11:36:38 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2006-03-22 11:36:38 +0000 |
commit | 32e5851723d1ae1f1b415454a054a635bd6235c4 (patch) | |
tree | 2d7bbd38abc2d4345e102c9f25d2858710d7160e | |
parent | fd380cb84767e9385d9ab7fcc90d27311540bf35 (diff) |
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.
-rw-r--r-- | ChangeLog | 9 | ||||
m--------- | common | 0 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegdec.c | 15 |
3 files changed, 16 insertions, 8 deletions
@@ -1,3 +1,12 @@ +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> * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame): diff --git a/common b/common -Subproject 9200457d08a57f0d7eaeb56915804fa8faf1441 +Subproject f1c7bfd24d0fcc4e5113ce3b96b1fac83a9ec56 diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 1bfd43f..409db17 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -370,13 +370,12 @@ gst_ffmpegdec_event (GstPad * pad, GstEvent * event) return FALSE; /* .. */ } +/* with LOCK */ static void gst_ffmpegdec_close (GstFFMpegDec * ffmpegdec) { - GST_OBJECT_LOCK (ffmpegdec); - if (!ffmpegdec->opened) - goto done; + return; if (ffmpegdec->par) { g_free (ffmpegdec->par); @@ -408,11 +407,9 @@ gst_ffmpegdec_close (GstFFMpegDec * ffmpegdec) ffmpegdec->format.video.fps_n = -1; ffmpegdec->format.video.old_fps_n = -1; - -done: - GST_OBJECT_UNLOCK (ffmpegdec); } +/* with LOCK */ static gboolean gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec) { @@ -478,11 +475,11 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps) GST_DEBUG_OBJECT (pad, "setcaps called"); + GST_OBJECT_LOCK (ffmpegdec); + /* close old session */ gst_ffmpegdec_close (ffmpegdec); - GST_OBJECT_LOCK (ffmpegdec); - /* set defaults */ avcodec_get_context_defaults (ffmpegdec->context); @@ -1291,11 +1288,13 @@ gst_ffmpegdec_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: + GST_OBJECT_LOCK (ffmpegdec); gst_ffmpegdec_close (ffmpegdec); if (ffmpegdec->last_buffer != NULL) { gst_buffer_unref (ffmpegdec->last_buffer); ffmpegdec->last_buffer = NULL; } + GST_OBJECT_UNLOCK (ffmpegdec); break; default: break; |