Message ID | 010001781e17f6e0-4bae9a44-0672-440e-95f8-3543a4a344aa-000000@email.amazonses.com |
---|---|
State | Accepted |
Commit | 63344337f945843e8f247b3b15fa0f0e7b0f0a7c |
Headers | show |
Series | libavformat/hls: Reset options after open_url_keepalive() fails | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
> 2021年3月11日 上午5:43,lists@edman007.com 写道: > > From: Ed Martin <edman007@edman007.com> > > open_url_keepalive() unsets the options when it uses them, this > includes the offsets for the Range: header. When using the HLS > tag #EXT-X-BYTERANGE along with multiple files, the range options > must be preserved after open_url_keepalive() returns EOF so that > the new file can be opened. Failure to do this results in ignoring > the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file. > > To fix it, reset the options before calling io_open() following > open_url_keepalive() reaching EOF > --- > libavformat/hls.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavformat/hls.c b/libavformat/hls.c > index af2468ad9b..d08d00cf24 100644 > --- a/libavformat/hls.c > +++ b/libavformat/hls.c > @@ -677,6 +677,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, > av_log(s, AV_LOG_WARNING, > "keepalive request failed for '%s' with error: '%s' when opening url, retrying with new connection\n", > url, av_err2str(ret)); > + av_dict_copy(&tmp, *opts, 0); > + av_dict_copy(&tmp, opts2, 0); > ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp); > } > } else { > -- > 2.30.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". LGTM Thanks Steven Liu
On 3/10/21 10:16 PM, Steven Liu wrote: >> 2021年3月11日 上午5:43,lists@edman007.com 写道: >> >> From: Ed Martin <edman007@edman007.com> >> >> open_url_keepalive() unsets the options when it uses them, this >> includes the offsets for the Range: header. When using the HLS >> tag #EXT-X-BYTERANGE along with multiple files, the range options >> must be preserved after open_url_keepalive() returns EOF so that >> the new file can be opened. Failure to do this results in ignoring >> the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file. >> >> To fix it, reset the options before calling io_open() following >> open_url_keepalive() reaching EOF >> --- >> libavformat/hls.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/libavformat/hls.c b/libavformat/hls.c >> index af2468ad9b..d08d00cf24 100644 >> --- a/libavformat/hls.c >> +++ b/libavformat/hls.c >> @@ -677,6 +677,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, >> av_log(s, AV_LOG_WARNING, >> "keepalive request failed for '%s' with error: '%s' when opening url, retrying with new connection\n", >> url, av_err2str(ret)); >> + av_dict_copy(&tmp, *opts, 0); >> + av_dict_copy(&tmp, opts2, 0); >> ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp); >> } >> } else { >> -- >> 2.30.1 >> >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> To unsubscribe, visit link above, or email >> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > > LGTM > > Thanks > > Steven Liu > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". Thanks for the review, if it's all good can someone commit the patch?
diff --git a/libavformat/hls.c b/libavformat/hls.c index af2468ad9b..d08d00cf24 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -677,6 +677,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, av_log(s, AV_LOG_WARNING, "keepalive request failed for '%s' with error: '%s' when opening url, retrying with new connection\n", url, av_err2str(ret)); + av_dict_copy(&tmp, *opts, 0); + av_dict_copy(&tmp, opts2, 0); ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp); } } else {
From: Ed Martin <edman007@edman007.com> open_url_keepalive() unsets the options when it uses them, this includes the offsets for the Range: header. When using the HLS tag #EXT-X-BYTERANGE along with multiple files, the range options must be preserved after open_url_keepalive() returns EOF so that the new file can be opened. Failure to do this results in ignoring the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file. To fix it, reset the options before calling io_open() following open_url_keepalive() reaching EOF --- libavformat/hls.c | 2 ++ 1 file changed, 2 insertions(+)