summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSong Bing <b06498@freescale.com>2015-01-12 17:40:25 +0800
committerSebastian Dröge <sebastian@centricular.com>2015-02-16 14:12:28 +0200
commit2614f80309bf37e65b30f0ea76d2acefba1d57c4 (patch)
treebb76c228c1e042fa9e224fbf99e246ddd5f5f69e
parent9f81931716b7f8fd29862f0bfa1a3891cb414bdc (diff)
streamsynchronizer: Send GAP events from the pads' streaming threads
Change the GAP events that are currently sent from the chain function of the current pad to all other EOS pads. They should instead be sent from their own streaming threads. https://bugzilla.gnome.org/show_bug.cgi?id=736655
-rw-r--r--gst/playback/gststreamsynchronizer.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c
index dfc955faa..50fc7b9c6 100644
--- a/gst/playback/gststreamsynchronizer.c
+++ b/gst/playback/gststreamsynchronizer.c
@@ -70,6 +70,7 @@ typedef struct
gboolean eos_sent; /* when EOS was sent downstream */
gboolean flushing; /* set after flush-start and before flush-stop */
gboolean seen_data;
+ GstClockTime gap_duration;
GCond stream_finish_cond;
@@ -231,8 +232,13 @@ gst_stream_synchronizer_wait (GstStreamSynchronizer * self, GstPad * pad)
continue;
}
- event = gst_event_new_gap (stream->segment.position, GST_CLOCK_TIME_NONE);
- GST_DEBUG_OBJECT (pad, "Send GAP event");
+ event =
+ gst_event_new_gap (stream->segment.position, stream->gap_duration);
+ GST_DEBUG_OBJECT (pad,
+ "Send GAP event, position: %" GST_TIME_FORMAT " duration: %"
+ GST_TIME_FORMAT, GST_TIME_ARGS (stream->segment.position),
+ GST_TIME_ARGS (stream->gap_duration));
+
/* drop lock when sending GAP event, which may block in e.g. preroll */
GST_STREAM_SYNCHRONIZER_UNLOCK (self);
ret = gst_pad_push_event (pad, event);
@@ -545,6 +551,7 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstObject * parent,
} else {
if (seen_data) {
self->send_gap_event = TRUE;
+ stream->gap_duration = GST_CLOCK_TIME_NONE;
ret = gst_stream_synchronizer_wait (self, srcpad);
}
}
@@ -689,8 +696,9 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstObject * parent,
ostream->segment.position = new_start;
- gst_pad_push_event (ostream->srcpad,
- gst_event_new_gap (position, new_start - position));
+ self->send_gap_event = TRUE;
+ ostream->gap_duration = new_start - position;
+ g_cond_broadcast (&ostream->stream_finish_cond);
}
}
GST_STREAM_SYNCHRONIZER_UNLOCK (self);
@@ -912,6 +920,7 @@ gst_stream_synchronizer_change_state (GstElement * element,
* which reach EOS to send GAP event. */
if (stream->is_eos && !stream->eos_sent) {
self->send_gap_event = TRUE;
+ stream->gap_duration = GST_CLOCK_TIME_NONE;
g_cond_broadcast (&stream->stream_finish_cond);
}
}
@@ -930,6 +939,7 @@ gst_stream_synchronizer_change_state (GstElement * element,
GstStream *stream = l->data;
gst_segment_init (&stream->segment, GST_FORMAT_UNDEFINED);
+ stream->gap_duration = GST_CLOCK_TIME_NONE;
stream->wait = FALSE;
stream->new_stream = FALSE;
stream->is_eos = FALSE;