Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-04-12lavf/hls: use ff_get_chomp_lineJun Zhao
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-04lavf/hls: Remove the dead code in parse_playlist()Jun Zhao
Signed-off-by: Jun Zhao <mypopydev@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
2018-02-07avformat/hls: Support metadata updates from subdemuxersRichard Shaffer
If a subdemuxer has the updated metadata event flag set, the metadata is copied to the corresponding stream. The flag is cleared on the subdemuxer and the appropriate event flag is set on the stream. Signed-off-by: wm4 <nfxjfg@googlemail.com>
2018-02-01avformat/hls: store referer message in HLS http requestSteven Liu
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-01-29avformat/hls: migrate to AVFormatContext->urlMarton Balint
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-27hls: don't print a certain warning if playlist loading is abortedwm4
AVERROR_EXIT happens when the user's interrupt callback signals that playback should be aborted. In this case, the demuxer shouldn't print a warning, as it's expected that all network accesses are stopped.
2018-01-27avformat, hls: add a flag to signal unavailability of seekingwm4
The seek function can just return an error if seeking is unavailable, but often this is too late. Add a flag that signals that the stream is unseekable, and use it in HLS.
2018-01-27hls: do not allow fallback to generic seekingwm4
This makes little sense due to how HLS works, and only causes some additional annoyances if the HLS read_seek function fails (for example if it's a live stream). It was most likely unintended.
2017-12-31avformat/hls: release mem resource to fix memleakSteven Liu
fix CID: 1426991 Signed-off-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-12-31avformat/hls: ignore http_persistent for segments requring cryptoAman Gupta
Encrypted HLS segments have regular http:// urls, but open_input() actually prefixes them with crypto+ before calling open_url(), so they end up using the crypto protocol and not the http protocol. This means invoking ff_http_do_new_request will fail, so we avoid calling it in the first place. After the earlier http.c commit, the failure results in a warning printed to the user. In earlier versions, the failure would cause a segfault. Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-27avformat/hls: enable http_multiple only for http/1.1 serversAman Gupta
Some http/1.0 implementations, like python's SimpleHTTPServer, can only support one client connection at a time. Making a second request while the first is still connected leads to a deadlock. This change enables multiple connections for http/1.1 servers only, which need to support keepalive by default and should have no problem with concurrent requests. Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-27avformat/hls: respect http_persistent only for http playlist urlsAman Gupta
Fixes a segfault when reading a live playlist (without end tag) from non-http url (like a file on disk). Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-27avformat/hls: return AVERROR_PROTOCOL_NOT_FOUND when http protocol is not ↵Aman Gupta
available Fixes compile error when building with network or protocols disabled. This code would never be reached (because the demuxer fails much earlier on http playlists or segments), so it doesn't matter much what we do here as long as it compiles. Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-27avformat/hls: remove repeated http proto_name checks in open_url()Aman Gupta
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-24avformat/hls: fix SEGV in previous commitAman Gupta
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-24avformat/hls: fix memory leak with non-http segmentsAman Gupta
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-24avformat/hls: fix CID 1426930Aman Gupta
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-23avformat/hls: hide misleading warning when http reconnect is requiredAman Gupta
AVERROR_EOF is an internal error which means the http socket is no longer valid for new requests. It informs the caller that a new connection must be established, and as such does not need to be surfaced to the user as a warning. Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-12-23avformat/hls: add http_multiple optionAman Gupta
This improves network throughput of the hls demuxer by avoiding the latency introduced by downloading segments one at a time. The problem is particularly noticable over high-latency network connections: for instance, if RTT is 250ms, there will a 250ms idle period between when one segment response is read and the next one starts. The obvious solution to this is to use HTTP pipelining, where a second request can be sent (on the persistent http/1.1 connection) before the first response is fully read. Unfortunately the way the http protocol is implemented in avformat makes implementing pipleining very complex. Instead, this commit simulates pipelining using two separate persistent http connections. This has the advantage of working independently of the http_persistent option, and can be used with http/1.0 servers as well. The pair of connections is swapped every time a new segment starts downloading, and a request for the next segment is sent on the secondary connection right away. This means the second response will be ready and waiting by the time the current response is fully read. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2017-12-23avformat/hls: allow open_input to be re-usedAman Gupta
Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2017-12-23avformat/hls: add http_persistent optionAman Gupta
This teaches the HLS demuxer to use the HTTP protocols multiple_requests=1 option, to take advantage of "Connection: Keep-Alive" when downloading playlists and segments from the HLS server. With the new option, you can avoid TCP connection and TLS negotiation overhead, which is particularly beneficial when streaming via a high-latency internet connection. Similar to the http_persistent option recently implemented in hlsenc.c Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2017-11-28avformat/hls: Obey AVProgram discard flagsAnssi Hannula
Currently HLS demuxer only obeys AVStream discard flags but not AVProgram (which bandwidth variants appear as) discard flags. Fix that.
2017-11-28avformat/hls: Factor playlist need check to a common functionAnssi Hannula
2017-09-26Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'James Almer
* commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3': Mark some arrays that never change as const. Merged-by: James Almer <jamrial@gmail.com>
2017-08-27avformat/hls: Fix DoS due to infinite loopMichael Niedermayer
Fixes: loop.m3u The default max iteration count of 1000 is arbitrary and ideas for a better solution are welcome Found-by: Xiaohei and Wangchu from Alibaba Security Team Previous version reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-05avformat/hls: Check local file extensionsMichael Niedermayer
This reduces the attack surface of local file-system information leaking. It prevents the existing exploit leading to an information leak. As well as similar hypothetical attacks. Leaks of information from files and symlinks ending in common multimedia extensions are still possible. But files with sensitive information like private keys and passwords generally do not use common multimedia filename extensions. It does not stop leaks via remote addresses in the LAN. The existing exploit depends on a specific decoder as well. It does appear though that the exploit should be possible with any decoder. The problem is that as long as sensitive information gets into the decoder, the output of the decoder becomes sensitive as well. The only obvious solution is to prevent access to sensitive information. Or to disable hls or possibly some of its feature. More complex solutions like checking the path to limit access to only subdirectories of the hls path may work as an alternative. But such solutions are fragile and tricky to implement portably and would not stop every possible attack nor would they work with all valid hls files. Developers have expressed their dislike / objected to disabling hls by default as well as disabling hls with local files. There also where objections against restricting remote url file extensions. This here is a less robust but also lower inconvenience solution. It can be applied stand alone or together with other solutions. limiting the check to local files was suggested by nevcairiel This recommits the security fix without the author name joke which was originally requested by Nicolas. Found-by: Emil Lerner and Pavel Cheremushkin Reported-by: Thierry Foucu <tfoucu@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-05Revert "avformat/hls: Check local file extensions"Michael Niedermayer
Requested-by: Paul B Mahol <onemda@gmail.com> This reverts commit caf7d6178a4d5f24c915da48410a9790b21703aa.
2017-06-05avformat/hls: Check local file extensionsSysiphus
This reduces the attack surface of local file-system information leaking. It prevents the existing exploit leading to an information leak. As well as similar hypothetical attacks. Leaks of information from files and symlinks ending in common multimedia extensions are still possible. But files with sensitive information like private keys and passwords generally do not use common multimedia filename extensions. It does not stop leaks via remote addresses in the LAN. The existing exploit depends on a specific decoder as well. It does appear though that the exploit should be possible with any decoder. The problem is that as long as sensitive information gets into the decoder, the output of the decoder becomes sensitive as well. The only obvious solution is to prevent access to sensitive information. Or to disable hls or possibly some of its feature. More complex solutions like checking the path to limit access to only subdirectories of the hls path may work as an alternative. But such solutions are fragile and tricky to implement portably and would not stop every possible attack nor would they work with all valid hls files. Developers have expressed their dislike / objected to disabling hls by default as well as disabling hls with local files. There also where objections against restricting remote url file extensions. This here is a less robust but also lower inconvenience solution. It can be applied stand alone or together with other solutions. limiting the check to local files was suggested by nevcairiel Found-by: Emil Lerner and Pavel Cheremushkin Reported-by: Thierry Foucu <tfoucu@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-29libavformat/hls: Observe Set-Cookie headersMicah Galizia
Signed-off-by: Micah Galizia <micahgalizia@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-22lavf/hls: do not transfer custom IO flagClément Bœsch
See 0dcac9c3f0f8f32009098edb704fac4b08bac951
2017-03-23hls: consistent use of user_agentJan Berkel
This came up while debugging a problem with mpv: https://github.com/mpv-player/mpv/issues/4155 Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-09hls: pass AVFormatContext flags to sub demuxerwm4
2017-02-01Mark some arrays that never change as const.Anton Khirnov
2016-11-07hls: fix leaking avio_opts on hls_read_header errorAndreas Cadhalpun
Use the hls_close function to reduce code duplication. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07hls: move hls_close above hls_read_headerAndreas Cadhalpun
This is needed for the following commit. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07avformat/hls: Add missing error check for avcodec_parameters_copy()Anssi Hannula
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2016-11-07avformat/hls: Fix probing mpegts audio streams that use probingAnssi Hannula
Commit 04964ac311abe670f ("avformat/hls: Fix missing streams in some cases with MPEG TS") caused a regression where subdemuxer streams that use probing (e.g. dts/eac3/mp2 in mpegts) no longer get probed properly. This is because the codec parameters from the subdemuxer stream, once probed, are not passed on to the main stream. Fix that by updating the codec parameters if the codec id changes. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2016-11-07avformat/hls: Factor copying stream info to a separate functionAnssi Hannula
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2016-09-24avformat/hls: Fix handling of EXT-X-BYTERANGE streams over 2GBAnssi Hannula
Replace uses of atoi() with strtoll() when trying to read values into int64_t variables. Fixes Kodi trac #16926: http://trac.kodi.tv/ticket/16926
2016-07-28avformat/hls: Fix missing streams in some cases with MPEG TSAnssi Hannula
HLS demuxer calls the subdemuxer avformat_find_stream_info() while overriding the subdemuxer AVFMTCTX_NOHEADER flag by clearing it. However, this prevents some streams in some MPEG TS streams from being detected properly. Simply removing the clearing of the flag would cause the inner avformat_find_stream_info() call to take longer in some cases, without a way to control it. To fix the issue, do not clear the flag but propagate it to HLS demuxer. To avoid the above-mentioned mandatory delay, the call to avformat_find_stream_info() is dropped except in the HLS ID3 timestamped case. The HLS demuxer user should be calling avformat_find_stream_info() on the HLS demuxer if it wants to find the stream info. The main streams are now created dynamically after read_header time if the subdemuxer uses AVFMTCTX_NOHEADER (mpegts). Subdemuxer avformat_find_stream_info() is still called for the HLS ID3 timestamped case as the HLS demuxer needs to know the packet durations to properly interleave ID3 timestamped streams with MPEG TS streams on sub-segment level. Fixes ticket #4930.
2016-07-28avformat/hls: Move stream propagation to a separate functionAnssi Hannula
Creation of main demuxer streams from subdemuxer streams is moved to update_streams_from_subdemuxer() which can be called repeatedly. There should be no functional changes.
2016-07-28avformat/hls: Use an array instead of stream offset for stream mappingAnssi Hannula
This will be useful when the amount of streams per subdemuxer is not known at hls_read_header time in a following commit.
2016-07-28avformat/hls: Sync starting segment across variants on live streamsAnssi Hannula
This will avoid a large time difference between variants in the most common case.
2016-07-28avformat/hls: Fix regression with ranged media segmentsAnssi Hannula
Commit 81306fd4bdf ("hls: eliminate ffurl_* usage", merged in d0fc5de3a6) changed the hls demuxer to use AVIOContext instead of URLContext for its HTTP requests. HLS demuxer uses the "offset" option of the http demuxer, requesting the initial file offset for the I/O (http URLProtocol uses the "Range:" HTTP header to try to accommodate that). However, the code in libavformat/aviobuf.c seems to be doing its own accounting for the current file offset (AVIOContext.pos), with the assumption that the initial offset is always zero. HLS demuxer does an explicit seek after open_url to account for cases where the "offset" was not effective (due to the URL being a local file or the HTTP server not obeying it), which should be a no-op in case the file offset is already at that position. However, since aviobuf.c code thinks the starting offset is 0, this doesn't work properly. This breaks retrieval of ranged media segments. To fix the regression, just drop the seek call from the HLS demuxer when the HTTP(S) protocol is used.
2016-06-21Merge commit '5afb94c817abffad030c6b94d7003dca8aace3d5'Clément Bœsch
* commit '5afb94c817abffad030c6b94d7003dca8aace3d5': Mark read-only tables as static Merged-by: Clément Bœsch <u@pkh.me>
2016-05-05Mark read-only tables as staticDiego Biurrun
2016-04-10Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis
* commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-16hls: handle crypto in the protocol checksHendrik Leppkes
Fixes issue 5248
2016-03-16hls: read protocol options through the AVIOContextHendrik Leppkes
This reverts commit 9f9ed79d4cb40e5d9093899f8a79086ff23da844. The hlsopts member was never set anywhere and always NULL, furthermore the HLS demuxer needs to retrieve the proper options from the underlying http protocol (cookies, user-agent, etc), so a dummy context won't help. Instead, use the AVIOContext directly to access the options.
2016-03-04avformat: Add a protocol blacklisting APIDerek Buitenhuis
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>