From 9d2564874a5bf4b47c80dbf086f52644afb83ffd Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 20 Jun 2008 16:56:18 +0000 Subject: [PATCH] gst/playback/gstdecodebin2.c: Ensure decodebin2 emits 'drained' signal once, and only once, when all pads are drained. Original commit message from CVS: * gst/playback/gstdecodebin2.c: Ensure decodebin2 emits 'drained' signal once, and only once, when all pads are drained. --- ChangeLog | 6 ++++++ gst/playback/gstdecodebin2.c | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b29efba12..84b46363f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-20 Michael Smith + + * gst/playback/gstdecodebin2.c: + Ensure decodebin2 emits 'drained' signal once, and only once, when all + pads are drained. + 2008-06-20 Wim Taymans * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_get_latency), diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 963f69ce17..4f8ebdba37 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -1836,6 +1836,14 @@ gst_decode_group_check_if_drained (GstDecodeGroup * group) GST_LOG ("group : %p", group); + DECODE_BIN_LOCK (dbin); + + /* Ensure we only emit the drained signal once, for this group */ + if (group->drained) { + drained = FALSE; + goto done; + } + for (tmp = group->endpads; tmp; tmp = g_list_next (tmp)) { GstDecodePad *dpad = (GstDecodePad *) tmp->data; @@ -1849,10 +1857,9 @@ gst_decode_group_check_if_drained (GstDecodeGroup * group) group->drained = drained; if (!drained) - return; + goto done; /* we are drained. Check if there is a next group to activate */ - DECODE_BIN_LOCK (dbin); if ((group == dbin->activegroup) && dbin->groups) { GST_DEBUG_OBJECT (dbin, "Switching to new group"); @@ -1863,6 +1870,8 @@ gst_decode_group_check_if_drained (GstDecodeGroup * group) /* we're not yet drained now */ drained = FALSE; } + +done: DECODE_BIN_UNLOCK (dbin); if (drained) {