streamsynchronizer: If a stream belongs to an already running stream, don't wait

This fixes enabling visualizations after the audio stream already started.

https://bugzilla.gnome.org/show_bug.cgi?id=697820
This commit is contained in:
Sebastian Dröge 2013-04-23 13:18:45 +02:00
parent 93769b1a60
commit 2e017bd595

View file

@ -241,20 +241,39 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstObject * parent,
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_STREAM_START:
{
GstStream *stream;
GstStream *stream, *ostream;
guint32 seqnum = gst_event_get_seqnum (event);
GList *l;
gboolean all_wait = TRUE;
gboolean new_stream = TRUE;
GST_STREAM_SYNCHRONIZER_LOCK (self);
stream = gst_pad_get_element_private (pad);
if (stream && stream->stream_start_seqnum != seqnum) {
stream->is_eos = FALSE;
stream->new_stream = TRUE;
stream->stream_start_seqnum = seqnum;
/* Check if this belongs to a stream that is already there,
* e.g. we got the visualizations for an audio stream */
for (l = self->streams; l; l = l->next) {
ostream = l->data;
if (ostream->stream_start_seqnum == seqnum && !ostream->wait) {
new_stream = FALSE;
break;
}
}
if (!new_stream) {
GST_DEBUG_OBJECT (pad,
"Stream %d belongs to running stream %d, no waiting",
stream->stream_number, ostream->stream_number);
stream->wait = FALSE;
} else {
GST_DEBUG_OBJECT (pad, "Stream %d changed", stream->stream_number);
stream->is_eos = FALSE;
stream->wait = TRUE;
stream->new_stream = TRUE;
for (l = self->streams; l; l = l->next) {
GstStream *ostream = l->data;
@ -298,11 +317,14 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstObject * parent,
g_cond_broadcast (&ostream->stream_finish_cond);
}
}
} else
GST_DEBUG_OBJECT (self, "No stream or STREAM_START from same source");
GST_STREAM_SYNCHRONIZER_UNLOCK (self);
}
} else {
GST_DEBUG_OBJECT (self, "No stream or STREAM_START from same source");
}
GST_STREAM_SYNCHRONIZER_UNLOCK (self);
break;
}
case GST_EVENT_SEGMENT:{
GstStream *stream;
GstSegment segment;