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.
This commit is contained in:
Andre Moreira Magalhaes (andrunko) 2012-05-31 17:45:29 +02:00 committed by Sebastian Dröge
parent 7aff9dba0e
commit 0dca0dac71

View file

@ -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,