hlsdemux2: Make start-bitrate property work without connection-speed

Makes "start-bitrate" work without setting "connection-speed" property. Having
another property set as a requirement for this one to work is unexpected.

This commit allows to request some initial bitrate for first segment, then
go into adaptive streaming for the rest of media playback.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3895>
This commit is contained in:
Rafał Dzięgiel 2023-02-05 16:21:57 +01:00
parent b5357cbcbc
commit 38028c9873
2 changed files with 11 additions and 9 deletions

View file

@ -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");

View file

@ -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) {