[FFmpeg-devel] [FFmpeg-cvslog] avformat/hls: add http_persistent option

Aman Gupta ffmpeg at tmm1.net
Mon Dec 25 20:08:11 EET 2017


On Mon, Dec 25, 2017 at 9:58 AM Michael Niedermayer <michael at niedermayer.cc>
wrote:

> On Fri, Dec 22, 2017 at 11:00:34PM +0000, Aman Gupta wrote:
> > ffmpeg | branch: master | Aman Gupta <aman at tmm1.net> | Wed Oct  4
> 14:52:52 2017 -0700| [b7d6c0cd48dac7869b9e6803e2d47d05a4fa373b] |
> committer: Aman Gupta
> >
> > avformat/hls: add http_persistent option
> >
> > 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 at tmm1.net>
> > Signed-off-by: Anssi Hannula <anssi.hannula at iki.fi>
> >
> > >
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7d6c0cd48dac7869b9e6803e2d47d05a4fa373b
> > ---
> >
> >  doc/demuxers.texi |  4 ++++
> >  libavformat/hls.c | 72
> +++++++++++++++++++++++++++++++++++++++++++++++++++----
> >  2 files changed, 72 insertions(+), 4 deletions(-)
>
> This causes ffmpeg to infinite loop with simplehttpd.py


Is that the same as SimpleHTTPServer.py?

Sounds like it doesn't support persistent connections, but also isn't
returning "Connection: close" in the response.

I can investigate if you tell me where to find that httpd server.

Aman


>
> gdb --args ./ffmpeg_g -i http://127.0.0.1:7429/playlist.m3u8 -t 10
> file-hls1.avi
>
> if i stop this, it seems stuck around here:
>
> #0  0x00007ffff02d0c5d in poll () from /lib/x86_64-linux-gnu/libc.so.6
> #1  0x0000000000737301 in ff_network_wait_fd (fd=4, write=0) at
> libavformat/network.c:82
> #2  0x0000000000737378 in ff_network_wait_fd_timeout (fd=4, write=0,
> timeout=0, int_cb=0x21d9c10) at libavformat/network.c:94
> #3  0x00000000007b3f73 in tcp_read (h=0x21d9be0, buf=0x21e2990 "GET
> /fileSequence001.ts HTTP/1.1\r\nUser-Agent: Lavf/58.3.100\r\nAccept:
> */*\r\nConnection: keep-alive\r\nHost: 127.0.0.1:7429\r\nIcy-MetaData:
> 1\r\n\r\n", size=4096) at libavformat/tcp.c:223
> #4  0x0000000000653219 in retry_transfer_wrapper (h=0x21d9be0,
> buf=0x21e2990 "GET /fileSequence001.ts HTTP/1.1\r\nUser-Agent:
> Lavf/58.3.100\r\nAccept: */*\r\nConnection: keep-alive\r\nHost:
> 127.0.0.1:7429\r\nIcy-MetaData: 1\r\n\r\n", size=4096, size_min=1,
> transfer_func=0x7b3f23 <tcp_read>)
>     at libavformat/avio.c:376
> #5  0x000000000065334b in ffurl_read (h=0x21d9be0, buf=0x21e2990 "GET
> /fileSequence001.ts HTTP/1.1\r\nUser-Agent: Lavf/58.3.100\r\nAccept:
> */*\r\nConnection: keep-alive\r\nHost: 127.0.0.1:7429\r\nIcy-MetaData:
> 1\r\n\r\n", size=4096) at libavformat/avio.c:411
> #6  0x00000000006a20a7 in http_getc (s=0x21e2980) at libavformat/http.c:574
> #7  0x00000000006a2139 in http_get_line (s=0x21e2980, line=0x7fffffff5e20
> "", line_size=4096) at libavformat/http.c:594
> #8  0x00000000006a3bcd in http_read_header (h=0x21d97c0,
> new_location=0x7fffffff7f6c) at libavformat/http.c:1103
> #9  0x00000000006a4942 in http_connect (h=0x21d97c0, path=0x7fffffff93b0
> "/fileSequence001.ts", local_path=0x7fffffff93b0 "/fileSequence001.ts",
> hoststr=0x7fffffff83b0 "127.0.0.1:7429", auth=0x7fffffff87b0 "",
> proxyauth=0x7fffffff8bb0 "", new_location=0x7fffffff7f6c) at
> libavformat/http.c:1289
> #10 0x00000000006a104c in http_open_cnx_internal (h=0x21d97c0,
> options=0x7fffffffb460) at libavformat/http.c:239
> #11 0x00000000006a10fd in http_open_cnx (h=0x21d97c0,
> options=0x7fffffffb460) at libavformat/http.c:259
> #12 0x00000000006a154a in ff_http_do_new_request (h=0x21d97c0,
> uri=0x21d4e10 "http://127.0.0.1:7429/fileSequence001.ts") at
> libavformat/http.c:340
> #13 0x000000000069390e in open_url_keepalive (s=0x21d0080, pb=0x21d3a10,
> url=0x21d4e10 "http://127.0.0.1:7429/fileSequence001.ts") at
> libavformat/hls.c:612
> #14 0x0000000000693c51 in open_url (s=0x21d0080, pb=0x21d3a10,
> url=0x21d4e10 "http://127.0.0.1:7429/fileSequence001.ts", opts=0x21d83e0,
> opts2=0x22e0060, is_http=0x7fffffffbdf8) at libavformat/hls.c:663
> #15 0x00000000006959c9 in open_input (c=0x21d2780, pls=0x21d2900,
> seg=0x21d4da0) at libavformat/hls.c:1179
> #16 0x0000000000696502 in read_data (opaque=0x21d2900, buf=0x7fffeb4fa36c
> "", buf_size=32768) at libavformat/hls.c:1433
> #17 0x00000000006551cc in read_packet_wrapper (s=0x21d3900,
> buf=0x7fffeb4fa36c "", size=32768) at libavformat/aviobuf.c:533
> #18 0x000000000065545a in fill_buffer (s=0x21d3900) at
> libavformat/aviobuf.c:583
> #19 0x0000000000655813 in avio_read (s=0x21d3900, buf=0x7fffffffd080 "",
> size=188) at libavformat/aviobuf.c:676
> #20 0x0000000000655995 in ffio_read_indirect (s=0x21d3900,
> buf=0x7fffffffd080 "", size=188, data=0x7fffffffd060) at
> libavformat/aviobuf.c:711
> #21 0x0000000000715d4b in read_packet (s=0x21d86e0, buf=0x7fffffffd080 "",
> raw_packet_size=188, data=0x7fffffffd060) at libavformat/mpegts.c:2462
> #22 0x0000000000716076 in handle_packets (ts=0x22029a0, nb_packets=0) at
> libavformat/mpegts.c:2529
> #23 0x0000000000716da8 in mpegts_read_packet (s=0x21d86e0,
> pkt=0x7fffffffd310) at libavformat/mpegts.c:2783
> #24 0x00000000007c301d in ff_read_packet (s=0x21d86e0, pkt=0x7fffffffd310)
> at libavformat/utils.c:823
> #25 0x00000000007c60eb in read_frame_internal (s=0x21d86e0, pkt=0x21d3a38)
> at libavformat/utils.c:1526
> #26 0x00000000007c70dc in av_read_frame (s=0x21d86e0, pkt=0x21d3a38) at
> libavformat/utils.c:1723
> #27 0x0000000000697ed8 in hls_read_packet (s=0x21d0080,
> pkt=0x7fffffffd6a0) at libavformat/hls.c:2033
> #28 0x00000000007c301d in ff_read_packet (s=0x21d0080, pkt=0x7fffffffd6a0)
> at libavformat/utils.c:823
> #29 0x00000000007c60eb in read_frame_internal (s=0x21d0080,
> pkt=0x7fffffffdaa0) at libavformat/utils.c:1526
> #30 0x00000000007c70dc in av_read_frame (s=0x21d0080, pkt=0x7fffffffdaa0)
> at libavformat/utils.c:1723
> #31 0x000000000043a872 in get_input_packet (f=0x22f80a0,
> pkt=0x7fffffffdaa0) at fftools/ffmpeg.c:4113
> #32 0x000000000043ace1 in process_input (file_index=0) at
> fftools/ffmpeg.c:4236
> #33 0x000000000043cbe0 in transcode_step () at fftools/ffmpeg.c:4583
> #34 0x000000000043cd5c in transcode () at fftools/ffmpeg.c:4637
> #35 0x000000000043d52d in main (argc=6, argv=0x7fffffffe3d8) at
> fftools/ffmpeg.c:4843
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Good people do not need laws to tell them to act responsibly, while bad
> people will find a way around the laws. -- Plato
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list