From patchwork Mon Jun 29 19:00:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 20719 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp3036327ybm; Mon, 29 Jun 2020 12:06:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySF2fot0mbdiFkDCFEXhe6by2XQsCHhK5rQJnJu37UA+Bv5QmD1wtcjkW9TnWahnN2rB+G X-Received: by 2002:adf:de01:: with SMTP id b1mr17917420wrm.305.1593457604264; Mon, 29 Jun 2020 12:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593457604; cv=none; d=google.com; s=arc-20160816; b=IjVTF66z51Q+ovJlL2ZQ/4972G47+2jvG4iKAaGZdpuApqIepn3L/xTVGgcuM3x6EC dPg/pgp3CLVFbxqBSzzqBis3nBDcGvop8Kje50n98BDUsl3wONNDF7Q/NjLp6YjYbkmv dMO+xzzGNSqcc6s2OICTioIu+nn8h874130vq3MNnAked0+0siB8twogYx55wCdPJ/J/ +tLC2o9oPilIdn98PYD/FIbquzFNCK6sdfgwFwjrlUKmnISYPQ+QvVtcvdeEjXTlN6rR YX/sMfRspYETI7qPb+J6+R2Z9E+1yI6gFxPd6IUcc9hBUm3P17+MHu+IrAC9AgbDfmVF euDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to; bh=DsKUAS/32t4985oMeLRZi2HTLMWe3oO6Mospwgpuzyw=; b=naTmgXkGrkOY0p7xyk3iOy+rya/NoumVDmSOO8T/ivnjMyrPxAkcCNyC2m1YIhpPl5 gl32zbfhQVZ6RPv1SQFcoUtWI+Phj5uXlQNZ90nSGsyXaOP5SKcBp8XEnhwYjv1MghjH hmvWCKC4fu8awxigoeb2/agq5nh/XrOn7iVe1+P62nCQ60iQ1FpimOT14t7m631U3mAW iXV4L+s5alGKH4QAknuW/LLcsWw5thnuLMHmx0iDlkuZVuaPeCqUecBRKhrDcUhterRk Twvj4mgtGYQR7kP3XiKZWp9eUBzd/K1v/H7WelXHav2xeTQwWbHrPEsaIobHTjj+S1qH NWUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q24si618303wrc.462.2020.06.29.12.06.43; Mon, 29 Jun 2020 12:06:44 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 952C36880A5; Mon, 29 Jun 2020 22:06:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-1.mx.upcmail.net (vie01a-dmta-pe06-1.mx.upcmail.net [84.116.36.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 09B64680A07 for ; Mon, 29 Jun 2020 22:06:34 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1jpz1m-0000iz-08 for ffmpeg-devel@ffmpeg.org; Mon, 29 Jun 2020 21:01:14 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id pz0nj7LMx6Jy6pz0njkjQD; Mon, 29 Jun 2020 21:00:14 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=GKl27dFK c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=416HjqsIZXbvg6xVpDoA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 29 Jun 2020 21:00:13 +0200 Message-Id: <20200629190013.26657-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfMtTB0PZSHKEmO3Fw8pdyDvoohywstAPcuUWB1FmnmihNtYL5BtbT5NSgut622MwH9TlVm6NXmF0cAbqQiOOI+DrxOLxtzoNMDXh0VsKQYvIT9maG9cc CpSRr5u+vCH4DcvP5u/eTz7ioVoZaO5wrh6zvMlqg16KBYlcuQploOyD Subject: [FFmpeg-devel] [PATCH] avformat/hls: Pass a copy of the URL for probing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VKD4V5f042ga Content-Length: 2473 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 --- libavformat/hls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 3798bdd5d1..ba17c4ed96 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1946,6 +1946,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())) { @@ -1983,8 +1984,9 @@ static int hls_read_header(AVFormatContext *s) read_data, NULL, NULL); pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4; pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TIME_BASE; - 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