mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
adaptivedemux2: track: Fix buffering time calc before output
Use the lowest track input time as the output time when calculating track buffering levels before anything has been dequeued. Fixes multi-period DASH not advancing to the next period in some cases. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2650>
This commit is contained in:
parent
16a04f7697
commit
61e4f058ef
1 changed files with 16 additions and 6 deletions
|
@ -45,7 +45,8 @@ gst_adaptive_demux_track_flush (GstAdaptiveDemuxTrack * track)
|
||||||
gst_event_store_flush (&track->sticky_events);
|
gst_event_store_flush (&track->sticky_events);
|
||||||
|
|
||||||
gst_segment_init (&track->input_segment, GST_FORMAT_TIME);
|
gst_segment_init (&track->input_segment, GST_FORMAT_TIME);
|
||||||
track->lowest_input_time = track->input_time = 0;
|
track->lowest_input_time = GST_CLOCK_STIME_NONE;
|
||||||
|
track->input_time = 0;
|
||||||
track->input_segment_seqnum = GST_SEQNUM_INVALID;
|
track->input_segment_seqnum = GST_SEQNUM_INVALID;
|
||||||
|
|
||||||
gst_segment_init (&track->output_segment, GST_FORMAT_TIME);
|
gst_segment_init (&track->output_segment, GST_FORMAT_TIME);
|
||||||
|
@ -470,6 +471,9 @@ track_queue_data_locked (GstAdaptiveDemux * demux,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update track input time and level */
|
/* Update track input time and level */
|
||||||
|
if (!GST_CLOCK_STIME_IS_VALID (track->lowest_input_time))
|
||||||
|
track->lowest_input_time = track->input_time;
|
||||||
|
|
||||||
if (track->input_segment.rate > 0.0) {
|
if (track->input_segment.rate > 0.0) {
|
||||||
if (input_time > track->input_time) {
|
if (input_time > track->input_time) {
|
||||||
track->input_time = input_time;
|
track->input_time = input_time;
|
||||||
|
@ -494,11 +498,17 @@ track_queue_data_locked (GstAdaptiveDemux * demux,
|
||||||
* this item's "buffering running time" */
|
* this item's "buffering running time" */
|
||||||
item.runningtime_buffering = track->input_time;
|
item.runningtime_buffering = track->input_time;
|
||||||
|
|
||||||
if (GST_CLOCK_STIME_IS_VALID (track->output_time))
|
/* Configure the track output time if nothing was dequeued yet,
|
||||||
output_time =
|
* so buffering level is updated correctly */
|
||||||
MAX (track->output_time, demux->priv->global_output_position);
|
if (!GST_CLOCK_STIME_IS_VALID (track->output_time)) {
|
||||||
else
|
track->output_time = track->lowest_input_time;
|
||||||
output_time = track->input_time;
|
GST_LOG_OBJECT (track->sinkpad,
|
||||||
|
"track %s (period %u) set output_time = lowest input_time = %"
|
||||||
|
GST_STIME_FORMAT, track->stream_id, track->period_num,
|
||||||
|
GST_STIME_ARGS (track->output_time));
|
||||||
|
}
|
||||||
|
|
||||||
|
output_time = MAX (track->output_time, demux->priv->global_output_position);
|
||||||
|
|
||||||
if (track->input_time >= output_time)
|
if (track->input_time >= output_time)
|
||||||
track->level_time = track->input_time - output_time;
|
track->level_time = track->input_time - output_time;
|
||||||
|
|
Loading…
Reference in a new issue