mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-11 19:06:33 +00:00
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:
parent
e8e9c45c21
commit
8f267451f4
1 changed files with 14 additions and 1 deletions
|
@ -755,13 +755,18 @@ gst_input_selector_wait_running_time (GstInputSelector * sel,
|
||||||
gst_input_selector_activate_sinkpad (sel, GST_PAD_CAST (selpad));
|
gst_input_selector_activate_sinkpad (sel, GST_PAD_CAST (selpad));
|
||||||
active_selpad = GST_SELECTOR_PAD_CAST (active_sinkpad);
|
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);
|
running_time = GST_BUFFER_TIMESTAMP (buf);
|
||||||
/* If possible try to get the running time at the end of the buffer */
|
/* If possible try to get the running time at the end of the buffer */
|
||||||
if (GST_BUFFER_DURATION_IS_VALID (buf))
|
if (GST_BUFFER_DURATION_IS_VALID (buf))
|
||||||
running_time += GST_BUFFER_DURATION (buf);
|
running_time += GST_BUFFER_DURATION (buf);
|
||||||
/* Only use the segment to convert to running time if the segment is
|
/* Only use the segment to convert to running time if the segment is
|
||||||
* in TIME format, otherwise do our best to try to sync */
|
* 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) {
|
if (running_time > seg->stop) {
|
||||||
running_time = seg->stop;
|
running_time = seg->stop;
|
||||||
}
|
}
|
||||||
|
@ -792,6 +797,14 @@ gst_input_selector_wait_running_time (GstInputSelector * sel,
|
||||||
|
|
||||||
active_seg = &active_selpad->segment;
|
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 */
|
/* Get active pad's running time, if no configured segment yet keep at -1 */
|
||||||
if (active_seg->format == GST_FORMAT_TIME)
|
if (active_seg->format == GST_FORMAT_TIME)
|
||||||
cur_running_time = gst_segment_to_running_time (active_seg,
|
cur_running_time = gst_segment_to_running_time (active_seg,
|
||||||
|
|
Loading…
Reference in a new issue