diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c index 78cc81dd7b..909736e722 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c @@ -1908,6 +1908,10 @@ gst_hls_demux_stream_select_bitrate (GstAdaptiveDemux2Stream * stream, gdouble play_rate = gst_adaptive_demux_play_rate (demux); gboolean changed = FALSE; + /* If not calculated yet, continue using start bitrate */ + if (bitrate == 0) + bitrate = hlsdemux->start_bitrate; + /* Handle variant streams */ GST_DEBUG_OBJECT (hlsdemux, "Checking playlist change for main variant stream"); diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c index eb492b61f8..48991516fa 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c @@ -665,6 +665,7 @@ gst_hls_demux_process_initial_manifest (GstAdaptiveDemux * demux, GstHLSVariantStream *variant; GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux); gchar *playlist = NULL; + guint start_bitrate = hlsdemux->start_bitrate; gboolean ret; GstHLSMediaPlaylist *simple_media_playlist = NULL; @@ -699,19 +700,16 @@ gst_hls_demux_process_initial_manifest (GstAdaptiveDemux * demux, gst_adaptive_demux_get_manifest_ref_uri (demux), NULL); } + if (start_bitrate == 0) + start_bitrate = demux->connection_speed; + /* select the initial variant stream */ - if (demux->connection_speed == 0) { - variant = hlsdemux->master->default_variant; - } else if (hlsdemux->start_bitrate > 0) { + if (start_bitrate > 0) { variant = gst_hls_master_playlist_get_variant_for_bitrate (hlsdemux->master, - FALSE, hlsdemux->start_bitrate, demux->min_bitrate, - hlsdemux->failed_variants); + FALSE, start_bitrate, demux->min_bitrate, hlsdemux->failed_variants); } else { - variant = - gst_hls_master_playlist_get_variant_for_bitrate (hlsdemux->master, - FALSE, demux->connection_speed, demux->min_bitrate, - hlsdemux->failed_variants); + variant = hlsdemux->master->default_variant; } if (variant == NULL) {