mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
adaptivedemux2: Initialize and use stream start/current position
The stream start and current position would be properly set when seeking or activating a stream after playback started. But it would never be properly initialized. Set it to NONE initially to indicate to subclasses that no position has been tracked yet. This will allow them to detect initial stream usage. Futhermore, once the initial streams setup is done, make sure that it is set to a valid initial value: * The minimum stream time in live * Or else the period start Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
This commit is contained in:
parent
7c40fcb66e
commit
4eac7f0e06
2 changed files with 12 additions and 0 deletions
|
@ -63,6 +63,8 @@ gst_adaptive_demux2_stream_init (GstAdaptiveDemux2Stream * stream)
|
|||
stream->fragment_bitrates =
|
||||
g_malloc0 (sizeof (guint64) * NUM_LOOKBACK_FRAGMENTS);
|
||||
|
||||
stream->start_position = stream->current_position = GST_CLOCK_TIME_NONE;
|
||||
|
||||
gst_segment_init (&stream->parse_segment, GST_FORMAT_TIME);
|
||||
}
|
||||
|
||||
|
|
|
@ -1812,6 +1812,16 @@ gst_adaptive_demux_prepare_streams (GstAdaptiveDemux * demux,
|
|||
GST_TIME_ARGS (period_start), GST_STIME_ARGS (min_stream_time),
|
||||
&demux->segment);
|
||||
|
||||
/* Synchronize stream start/current positions */
|
||||
if (min_stream_time == GST_CLOCK_STIME_NONE)
|
||||
min_stream_time = period_start;
|
||||
else
|
||||
min_stream_time += period_start;
|
||||
for (iter = new_streams; iter; iter = g_list_next (iter)) {
|
||||
GstAdaptiveDemux2Stream *stream = iter->data;
|
||||
stream->start_position = stream->current_position = min_stream_time;
|
||||
}
|
||||
|
||||
for (iter = new_streams; iter; iter = g_list_next (iter)) {
|
||||
GstAdaptiveDemux2Stream *stream = iter->data;
|
||||
stream->compute_segment = TRUE;
|
||||
|
|
Loading…
Reference in a new issue