summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2011-12-07 11:01:31 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2011-12-07 11:01:31 +0100
commit7952a54299cae8cb4e380c29362d9e07849259c3 (patch)
tree51020c3ed60e4715af28ef6f31e3c28334525875
parent7fb67e9d6fb5eadc8423c45cce44f3a355c8ccd7 (diff)
outputselector: Don't send last segment/buffer when no segment was configured yet
-rw-r--r--plugins/elements/gstoutputselector.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/elements/gstoutputselector.c b/plugins/elements/gstoutputselector.c
index 300721983..41b176c06 100644
--- a/plugins/elements/gstoutputselector.c
+++ b/plugins/elements/gstoutputselector.c
@@ -179,7 +179,7 @@ gst_output_selector_init (GstOutputSelector * sel,
/* srcpad management */
sel->active_srcpad = NULL;
sel->nb_srcpads = 0;
- gst_segment_init (&sel->segment, GST_FORMAT_TIME);
+ gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
sel->pending_srcpad = NULL;
sel->resend_latest = FALSE;
@@ -462,10 +462,12 @@ gst_output_selector_switch (GstOutputSelector * osel)
osel->pending_srcpad = NULL;
GST_OBJECT_UNLOCK (GST_OBJECT (osel));
- /* Send NEWSEGMENT event and latest buffer if switching succeeded */
- if (res) {
+ /* Send NEWSEGMENT event and latest buffer if switching succeeded
+ * and we already have a valid segment configured */
+ if (res && osel->segment.format != GST_FORMAT_UNDEFINED) {
/* Send NEWSEGMENT to the pad we are going to switch to */
seg = &osel->segment;
+
/* If resending then mark newsegment start and position accordingly */
if (osel->resend_latest && osel->latest_buffer &&
GST_BUFFER_TIMESTAMP_IS_VALID (osel->latest_buffer)) {