hlsdemux2: Fix buffering threshold calculation and handling

* The checks for smaller values were wrong
* Properly initialize the stream default recommended buffering threshold so that
  a default (10s) value is used until the subclass can provide a proper value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883>
This commit is contained in:
Edward Hervey 2023-01-04 11:16:14 +01:00 committed by GStreamer Marge Bot
parent eb1eb64506
commit 3129970c8a
2 changed files with 4 additions and 2 deletions

View file

@ -86,6 +86,8 @@ gst_adaptive_demux2_stream_init (GstAdaptiveDemux2Stream * stream)
stream->last_ret = GST_FLOW_OK;
stream->next_input_wakeup_time = GST_CLOCK_STIME_NONE;
stream->recommended_buffering_threshold = GST_CLOCK_TIME_NONE;
stream->fragment_bitrates =
g_malloc0 (sizeof (guint64) * NUM_LOOKBACK_FRAGMENTS);

View file

@ -2547,7 +2547,7 @@ gst_hls_media_playlist_recommended_buffering_threshold (GstHLSMediaPlaylist *
&& threshold > playlist->hold_back)
threshold = playlist->hold_back;
else if (GST_CLOCK_TIME_IS_VALID (playlist->targetduration)
&& threshold > playlist->targetduration)
&& threshold > 3 * playlist->targetduration)
threshold = 3 * playlist->targetduration;
if (low_latency) {
@ -2555,7 +2555,7 @@ gst_hls_media_playlist_recommended_buffering_threshold (GstHLSMediaPlaylist *
&& threshold > playlist->part_hold_back)
threshold = playlist->part_hold_back;
else if (GST_CLOCK_TIME_IS_VALID (playlist->partial_targetduration)
&& threshold > playlist->partial_targetduration)
&& threshold > 3 * playlist->partial_targetduration)
threshold = 3 * playlist->partial_targetduration;
}
}