Commit 6053155d19 for ffmpeg

commit 6053155d19335e5a501d186fde4bd24eaf93724e
Author: Kacper Michajłow <kasper93@gmail.com>
Date:   Tue Sep 29 11:34:15 2026 +0200

    avformat/hls: use the playlist of the new variant in ensure_playlist()

    new_playlist() returns the known playlist for a duplicate URL, which is not
    necessarily the last one in c->playlists. Take it from the variant, so media
    tags of a Master Playlist do not end up in an unrelated playlist.

    Fixes: 54f0296dfe
    Signed-off-by: Kacper Michajłow <kasper93@gmail.com>

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 730e8b98fe..97755da3a3 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -657,9 +657,10 @@ static int ensure_playlist(HLSContext *c, struct playlist **pls, const char *url
 {
     if (*pls)
         return 0;
-    if (!new_variant(c, NULL, url, NULL))
+    struct variant *var = new_variant(c, NULL, url, NULL);
+    if (!var)
         return AVERROR(ENOMEM);
-    *pls = c->playlists[c->n_playlists - 1];
+    *pls = var->playlists[0];
     return 0;
 }