[FFmpeg-cvslog] avformat/hls: Pass a copy of the URL for probing

Michael Niedermayer git at videolan.org
Tue Jul 7 21:41:36 EEST 2020


ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Mon Jun 29 19:49:41 2020 +0200| [57970c41f59319f54879993fc26c55147854c52f] | committer: Michael Niedermayer

avformat/hls: Pass a copy of the URL for probing

The segments / url can be modified by the io read when reloading

This may be an alternative or additional fix for Ticket8673
as a further alternative the reload stuff could be disabled during
probing

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit b5e39880fb7269b1b3577cee288e06aa3dc1dfa2)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57970c41f59319f54879993fc26c55147854c52f
---

 libavformat/hls.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index fb2af90b92..48d133b87a 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1878,6 +1878,7 @@ static int hls_read_header(AVFormatContext *s)
     /* Open the demuxer for each playlist */
     for (i = 0; i < c->n_playlists; i++) {
         struct playlist *pls = c->playlists[i];
+        char *url;
         ff_const59 AVInputFormat *in_fmt = NULL;
 
         if (!(pls->ctx = avformat_alloc_context())) {
@@ -1914,8 +1915,9 @@ static int hls_read_header(AVFormatContext *s)
         ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls,
                           read_data, NULL, NULL);
         pls->pb.seekable = 0;
-        ret = av_probe_input_buffer(&pls->pb, &in_fmt, pls->segments[0]->url,
-                                    NULL, 0, 0);
+        url = av_strdup(pls->segments[0]->url);
+        ret = av_probe_input_buffer(&pls->pb, &in_fmt, url, NULL, 0, 0);
+        av_free(url);
         if (ret < 0) {
             /* Free the ctx - it isn't initialized properly at this point,
              * so avformat_close_input shouldn't be called. If



More information about the ffmpeg-cvslog mailing list