From 0dca0dac71c84dc3544dacdf41e9c0396f4523da Mon Sep 17 00:00:00 2001 From: "Andre Moreira Magalhaes (andrunko)" Date: Thu, 31 May 2012 17:45:29 +0200 Subject: [PATCH] inputselector: Don't try to sync on the segment if it has no TIME format ...and wait until it is actually configured and has a format before trying to sync. --- plugins/elements/gstinputselector.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index 2c4d0ed..4e98e8a 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c @@ -629,13 +629,18 @@ gst_input_selector_wait_running_time (GstInputSelector * sel, gst_input_selector_activate_sinkpad (sel, GST_PAD_CAST (selpad)); active_selpad = GST_SELECTOR_PAD_CAST (active_sinkpad); + if (seg->format != GST_FORMAT_TIME) { + GST_INPUT_SELECTOR_UNLOCK (sel); + return FALSE; + } + running_time = GST_BUFFER_TIMESTAMP (buf); /* If possible try to get the running time at the end of the buffer */ if (GST_BUFFER_DURATION_IS_VALID (buf)) running_time += GST_BUFFER_DURATION (buf); /* Only use the segment to convert to running time if the segment is * in TIME format, otherwise do our best to try to sync */ - if (seg->format == GST_FORMAT_TIME && GST_CLOCK_TIME_IS_VALID (seg->stop)) { + if (GST_CLOCK_TIME_IS_VALID (seg->stop)) { if (running_time > seg->stop) { running_time = seg->stop; } @@ -666,6 +671,14 @@ gst_input_selector_wait_running_time (GstInputSelector * sel, active_seg = &active_selpad->segment; + /* If the active segment is configured but not to time format + * we can't do any syncing at all */ + if (active_seg->format != GST_FORMAT_TIME + && active_seg->format != GST_FORMAT_UNDEFINED) { + GST_INPUT_SELECTOR_UNLOCK (sel); + return FALSE; + } + /* Get active pad's running time, if no configured segment yet keep at -1 */ if (active_seg->format == GST_FORMAT_TIME) cur_running_time = gst_segment_to_running_time (active_seg, -- 2.7.4