1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

220 Commits

Author SHA1 Message Date
Marvin Scholz
c3bb6efef2 avformat/hls: propagate icy to child AVIOContexts
When the user decides they do not want to to send the Icy-MetaData
header, this should be respected for all requests, not just the first
one.

Fix #5578

Reviewed-by: Liu Steven <lq@chinaffmpeg.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-27 14:57:25 -03:00
Andreas Rheinhardt
5b42d33571 avformat/hls: Use av_packet_move_ref() for packet ownership transfer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-12-23 15:39:49 +08:00
Steven Liu
afee801276 avformat/hls: correct grammatical errors of m3u8_hold_counters option
Suggested-by: Gyan <ffmpeg@gyani.pro>
Suggested-by: Rodney Baker <rodney.baker@iinet.net.au>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-11-27 19:04:00 +08:00
Steven Liu
d5e3d8e2f7 avformat/hls: add option for the m3u8 list load max times
set max times for load m3u8 when the m3u8 list refresh do not with new
segments any times.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-11-25 11:12:20 +08:00
Steven Liu
4e0860e363 avformat/hls: continue to play enabled playlist when have failed playlist
fix ticket: 7811

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-11-13 16:40:09 +08:00
Jun Zhao
5307c12acb lavf/hls: support probesize/max_analyze_duration when open sub-demuxer
Add probesize/max_analyze_duration support when open the sub-demuxer,
it's will be used to minimizing the initial delay.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao
bbf061c7ca lavf/hls: fix the log context setting in log message
Fix the log context setting in log message

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Philip Langdale
d6ac6650b9 avformat/hls: Set AVFMT_TS_DISCONT flag on HLS input format
There have been many reports over the years about problems when
taking an HLS stream as input to `ffmpeg` where there are timestamp
discontinuities present. This is explicitly supported in the
HLS spec (EXT-X-DISCONTINUITY) and often used for ad injection.

Various fixes and work-arounds have been proposed over the years,
but one step that seems obvious, even if it's not a complete fix,
is to mark the HLS input format as supporting discontinuities. This
will prevent timestamp fixup logic in ffmpeg.c kicking in that ends
up mangling the timestamps unnecessarily.

I've tested this out with an example provided by Joe Koberg early
last year, and it is sufficient to allow `ffmpeg` to download and
mux the stream correctly. Joe had briefly suggested that other
situations can still be handled incorrectly, but this seems like
a strict improvement.

Joe's example:

https://s3.amazonaws.com/playon-test-videos/discont_test_new/discont_test.m3u8

Reviewed-by: Steven Liu <lq@onvideo.cn>
Reviewed-by: Dennis Mungai <dmngaie@gmail.com>
2019-10-30 17:59:02 +08:00
vectronic
e149be38a8 avformat/hls: fix missing segment offset reset on last segment when http_multiple is enabled.
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
2019-10-08 14:58:47 +08:00
vectronic
b21c5ef501 avformat/hls: pass http offset options to http request
made with persistent connections to prevent incorrect reset of
offset when demuxing HLS+FMP4

Signed-off-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
2019-10-08 14:57:53 +08:00
Jun Zhao
0c5726a332 lavf/hls: fix memory leak in error handling path for option tmp
fix memory leak in error handling path for option tmp.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-14 10:02:00 +08:00
Jun Zhao
90a5bebd19 lavf/hls: remove redundancy seekable setting
ffio_init_context with NULL seek callback will setting seekable with 0, so
remove the redundancy seekable setting.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-14 10:01:19 +08:00
Jun Zhao
eada079e71 lavf/hls: drop unnecessary check before ff_format_io_close
ff_format_io_close will check the AVIOContext pointer pb, so drop
the unnecessary check before ff_format_io_close.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-14 10:00:12 +08:00
Jun Zhao
48d96ce29a lavf/hls: refine the log message
refine the log message, it's will help the debugging

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-14 10:00:03 +08:00
Jun Zhao
5e829262a6 lavf/hls: add http_seekable option for HTTP partial requests
Add http_seekable option for HTTP partial requests, when The
EXT-X-BYTERANGE tag indicates that a Media Segment is a sub-range
of the resource identified by its URI, we can use HTTP partial
requests to get the Media Segment.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-08-08 17:53:32 +08:00
vacingfang
d83a3117e2 lavf/hls: replace the same code logic with ensure_playlist()
Replace the same code logic with ensure_playlist(), it's will
help reusable blocks of code.

Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: vacingfang <vacingfang@tencent.com>
2019-07-26 09:39:47 +08:00
Jun Zhao
606be4cb50 lavf/hls: remove redundancy reset_packet() after av_packet_unref()
av_packet_unref have reseted the AVPacket, so don't need to call
reset_packet after that.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-07-26 09:37:03 +08:00
Jun Zhao
6f82bf9dd3 lavf/hls: More log message
More log message, it's will help the debugging

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-06-14 13:21:38 +08:00
Steven Liu
bee0fba7e6 avformat/hls: add http 2.0 version number compare for the http_multiple
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-06-14 10:53:35 +08:00
Steven Liu
5d0652916f avformat/hls: avformat_find_stream_info when the audio list in the variant
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-06-14 10:53:29 +08:00
Jun Zhao
1e7a8b92ee lavf/hls: Update av_log() log message
Pass correct pointer to av_log() and update some error/warning message,
it's will help the debugging

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-06-07 11:30:15 +08:00
Jun Zhao
d6489ddb7a lavf/hls: Remove HLSContext.strict_std_compliance field
After the commit 9f61abc811, we can use AVFormatContext.strict_std_compliance
instead of HLSContext.strict_std_compliance to avoid the code redundancy.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-04-27 15:49:26 +08:00
Jun Zhao
abfeba9724 lavf/hls: Cleanup the applehttp
Cleanup the applehttp as demuxer name, when use the command :

ffmpeg -formats, get the confused information like:
"
 E hls             Apple HTTP Live Streaming
D  hls,applehttp   Apple HTTP Live Streaming
"
we don't use applehttp as the demuxer/muxer name usually, so
cleanup the applehttp and update the documents.

After the change, get the information from "ffmpeg -formats":
"
DE hls             Apple HTTP Live Streaming
"

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-04-15 21:36:45 +08:00
Steven Liu
326cec3771 avformat/hls: make different warning message between open url and parse playlist
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-04-02 12:11:47 +08:00
Carl Eugen Hoyos
4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +01:00
Carl Eugen Hoyos
3aa6208db9 lavf: Constify AVInputFormat pointer. 2019-03-20 18:52:38 +01:00
Jun Zhao
32fb83e431 lavc/hls: Cosmetics: Fix indentation for free_segment_list
Commit 673d8cfd51 missed the indent

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2019-01-19 10:13:19 +08:00
vkot
3ee735901e avformat/hls.c: Properly free prev_segments dynarray after playlist parsing 2018-12-26 19:22:11 +08:00
Steven Liu
9e61141905 avformat/hls: support decryption AES128 fmp4 m3u8 list
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-08-22 19:15:15 +08:00
Aman Gupta
673d8cfd51 avformat/hls: fix seeking around EVENT playlist after media sequence changes
The seek functions use first_timestamp, so keep that up to date as
old segments drop off the playlist.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-16 10:19:34 -07:00
wm4
1d642ebfdb avformat/hls: don't propagate deprecated "user-agent" AVOption
This code will print a warning if any user agent is set - even if the
API user used the proper non-deprecated "user_agent" option.

This change should not even break anything, because even if the user
sets the deprecated "user-agent" option, http.c copies it to the
"user_agent" option anyway.
2018-05-04 14:16:38 +02:00
Steven Liu
223f3dff8c avformat/hls: remove redundant code
Suggested-by: Richard Shaffer <rshaffer@tunein.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-04-18 11:22:23 +08:00
Richard Shaffer
c116221d90 avformat/hls: clean up duplicate option fields
The HLSContext struct contains fields which duplicate the data stored in the
avio_opts field. This change removes those fields in favor of avio_opts, and
updates the code accordingly.
The original patch caused the buffer pointed to by new_cookies in open_url to be
leaked. The only thing that buffer is used for is to store the value until it
can be passed to av_dict_set. To fix the leak, v2 of the patch simply calls
av_dict_set with the AV_DICT_DONT_STRDUP_VAL flag, so that the dictionary takes
ownership of the memory instead of copying it again.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Richard Shaffer <rshaffer@tunein.com>
2018-04-17 14:40:06 +08:00
Richard Shaffer
6a1be7561c avformat/hls: copy rw_timeout from parent to child AVIOContexts.
The rw_timeout option is currently not applied when opening media playlist,
segment, or encryption key URLs. This can cause the HLS demuxer to block
indefinitely, even when the rw_timeout option has been specified. This change
simply enables carrying over the rw_timeout option when the demuxer opens these
URLs.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Richard Shaffer <rshaffer@tunein.com>
2018-04-17 14:39:26 +08:00
Steven Liu
0b3c1854cb Revert "avformat/hls: copy rw_timeout from parent to child AVIOContexts."
This reverts commit 36deec010c.
2018-04-17 14:33:36 +08:00
Steven Liu
36deec010c avformat/hls: copy rw_timeout from parent to child AVIOContexts.
The rw_timeout option is currently not applied when opening media playlist,
segment, or encryption key URLs. This can cause the HLS demuxer to block
indefinitely, even when the rw_timeout option has been specified. This change
simply enables carrying over the rw_timeout option when the demuxer opens these
URLs.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Richard Shaffer <rshaffer@tunein.com>
2018-04-17 14:25:07 +08:00
Steven Liu
6fbfb20faf avformat/hls: remove redundant code
Reviewed-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-04-17 13:16:33 +08:00
Jun Zhao
0e49118271 lavf/hls: use ff_get_chomp_line
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-12 16:04:58 +08:00
Jun Zhao
51e3010575 lavf/hls: Remove the dead code in parse_playlist()
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2018-04-04 11:04:56 +08:00
Richard Shaffer
651d5f9639 avformat/hls: Support metadata updates from subdemuxers
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-07 12:33:37 +01:00
Steven Liu
b1af0e23a3 avformat/hls: store referer message in HLS http request
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-02-01 10:57:29 +08:00
Marton Balint
45ec2e44be avformat/hls: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
wm4
23ffeb91fe hls: don't print a certain warning if playlist loading is aborted
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-27 04:10:52 +01:00
wm4
6194d7e564 avformat, hls: add a flag to signal unavailability of seeking
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-27 04:10:52 +01:00
wm4
637dfa3942 hls: do not allow fallback to generic seeking
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.
2018-01-27 04:10:52 +01:00
Steven Liu
2906363d1b avformat/hls: release mem resource to fix memleak
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-31 10:43:54 -08:00
Aman Gupta
97b89432e4 avformat/hls: ignore http_persistent for segments requring crypto
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-30 21:07:55 -08:00
Aman Gupta
1dd82edea5 avformat/hls: enable http_multiple only for http/1.1 servers
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-26 14:53:19 -08:00
Aman Gupta
ac19e63b18 avformat/hls: respect http_persistent only for http playlist urls
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-26 14:48:14 -08:00
Aman Gupta
a232a72d77 avformat/hls: return AVERROR_PROTOCOL_NOT_FOUND when http protocol is not 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-26 14:48:13 -08:00