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.
This commit is contained in:
Wim Taymans 2006-03-22 11:36:38 +00:00
parent fd380cb847
commit 32e5851723
3 changed files with 17 additions and 9 deletions

View file

@ -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):

2
common

@ -1 +1 @@
Subproject commit 9200457d08a57f0d7eaeb56915804fa8faf14418
Subproject commit f1c7bfd24d0fcc4e5113ce3b96b1fac83a9ec560

View file

@ -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;