inputselector: handle gap events

Use gap events to advance the selector's pad position.

This is relevant to keep sync_streams mode working when one of the
streams doesn't have data all the time.
This commit is contained in:
Thiago Santos 2013-11-18 18:11:56 -03:00
parent fe36be1c03
commit 5bb45ffbfc

View file

@ -553,6 +553,27 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
}
GST_DEBUG_OBJECT (pad, "received EOS");
break;
case GST_EVENT_GAP:{
GstClockTime ts, dur;
GST_DEBUG_OBJECT (pad, "Received gap event: %" GST_PTR_FORMAT, event);
gst_event_parse_gap (event, &ts, &dur);
if (GST_CLOCK_TIME_IS_VALID (ts)) {
if (GST_CLOCK_TIME_IS_VALID (dur))
ts += dur;
/* update the segment position */
GST_OBJECT_LOCK (pad);
selpad->position = ts;
selpad->segment.position = ts;
GST_OBJECT_UNLOCK (pad);
if (sel->sync_streams && active_sinkpad == pad)
GST_INPUT_SELECTOR_BROADCAST (sel);
}
}
break;
default:
break;
}