From 025e4464709087e4addca773899f03e6e7be7ce4 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Thu, 11 Aug 2022 05:17:05 +1000 Subject: [PATCH] hlsdemux2: Fix reference leak of variant stream When switching back to the previous variant stream in gst_hls_demux_change_playlist(), fix a couple of paths that would leak a reference to the previous variant. Part-of: --- .../ext/adaptivedemux2/hls/gsthlsdemux.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c index da5c8bb3b7..9995ccd49a 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c @@ -2673,16 +2673,22 @@ retry_failover_protection: } gst_hls_demux_set_current_variant (demux, previous_variant); + /* Try a lower bitrate (or stop if we just tried the lowest) */ if (previous_variant->iframe) { lowest_ivariant = demux->master->iframe_variants->data; - if (new_bandwidth == lowest_ivariant->bandwidth) + if (new_bandwidth == lowest_ivariant->bandwidth) { + gst_hls_variant_stream_unref (previous_variant); return FALSE; + } } else { lowest_variant = demux->master->variants->data; - if (new_bandwidth == lowest_variant->bandwidth) + if (new_bandwidth == lowest_variant->bandwidth) { + gst_hls_variant_stream_unref (previous_variant); return FALSE; + } } + gst_hls_variant_stream_unref (previous_variant); return gst_hls_demux_change_playlist (demux, new_bandwidth - 1, changed); }