Message ID | 20170215154549.13637-1-lq@chinaffmpeg.org |
---|---|
State | Superseded |
Headers | show |
On Wed, Feb 15, 2017 at 11:45:49PM +0800, Steven Liu wrote: > When the http method is not set, the method will use POST for ts, > PUT for m3u8, it is not unify, now set it unify. > This ticket id: 5315 > > Signed-off-by: Steven Liu <lq@chinaffmpeg.org> > --- > libavformat/hlsenc.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) this breaks fate-filter-hls-append heres a backtrace, sorry for the missing line numbers i can rebuild with debug stuff if you cannot reproduce ==19211== Process terminating with default action of signal 11 (SIGSEGV) ==19211== Access not within mapped region at address 0x0 ==19211== at 0x4C2FC89: strspn (mc_replace_strmem.c:1491) ==19211== by 0x62FAEC: url_find_protocol (in ffmpeg_g) ==19211== by 0x630938: avio_find_protocol_name (in ffmpeg_g) ==19211== by 0x664595: hls_window (in ffmpeg_g) ==19211== by 0x666A20: hls_write_trailer (in ffmpeg_g) ==19211== by 0x6C5BAC: av_write_trailer (in ffmpeg_g) ==19211== by 0x4C3951: transcode (in ffmpeg_g) ==19211== by 0x4A5257: main (in ffmpeg_g) [...]
On Wed, Feb 15, 2017 at 23:45:49 +0800, Steven Liu wrote: > + proto = avio_find_protocol_name(hls->basename); > + if (hls->method || (proto && !av_strcasecmp(proto, "http"))) { Would this also need to apply to https? (I'm not sure whether those protocols are distinguished.) > + av_log(c, AV_LOG_WARNING, "You forget set http method, hls muxer auto set default method to PUT\n"); "No HTTP method set, hls muxer defaulting to method PUT.\n" (If you actually want to keep the original sentence: "You forget to set http method, hls muxer automatically set default method to PUT\n". I would avoid the use of "you"...) Moritz
2017-02-16 4:59 GMT+08:00 Moritz Barsnick <barsnick@gmx.net>: > On Wed, Feb 15, 2017 at 23:45:49 +0800, Steven Liu wrote: > > + proto = avio_find_protocol_name(hls->basename); > > + if (hls->method || (proto && !av_strcasecmp(proto, "http"))) { > > Would this also need to apply to https? (I'm not sure whether those > protocols are distinguished.) > have add to patch. > > > + av_log(c, AV_LOG_WARNING, "You forget set http method, hls > muxer auto set default method to PUT\n"); > > "No HTTP method set, hls muxer defaulting to method PUT.\n" > > (If you actually want to keep the original sentence: "You forget to set > http method, hls muxer automatically set default method to PUT\n". I > would avoid the use of "you"...) > merge to patch. > > Moritz > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
2017-02-16 4:19 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>: > On Wed, Feb 15, 2017 at 11:45:49PM +0800, Steven Liu wrote: > > When the http method is not set, the method will use POST for ts, > > PUT for m3u8, it is not unify, now set it unify. > > This ticket id: 5315 > > > > Signed-off-by: Steven Liu <lq@chinaffmpeg.org> > > --- > > libavformat/hlsenc.c | 14 +++++++++++--- > > 1 file changed, 11 insertions(+), 3 deletions(-) > > this breaks fate-filter-hls-append > > heres a backtrace, sorry for the missing line numbers i can rebuild > with debug stuff if you cannot reproduce > > ==19211== Process terminating with default action of signal 11 (SIGSEGV) > ==19211== Access not within mapped region at address 0x0 > ==19211== at 0x4C2FC89: strspn (mc_replace_strmem.c:1491) > ==19211== by 0x62FAEC: url_find_protocol (in ffmpeg_g) > ==19211== by 0x630938: avio_find_protocol_name (in ffmpeg_g) > ==19211== by 0x664595: hls_window (in ffmpeg_g) > ==19211== by 0x666A20: hls_write_trailer (in ffmpeg_g) > ==19211== by 0x6C5BAC: av_write_trailer (in ffmpeg_g) > ==19211== by 0x4C3951: transcode (in ffmpeg_g) > ==19211== by 0x4A5257: main (in ffmpeg_g) > localhost:test StevenLiu$ lldb -c /cores/core.83014 ./ffmpeg_g (lldb) target create "./ffmpeg_g" --core "/cores/core.83014" warning: (x86_64) /cores/core.83014 load command 94 LC_SEGMENT_64 has a fileoff + filesize (0x2e918000) that extends beyond the end of the file (0x2e917000), the segment will be truncated to match warning: (x86_64) /cores/core.83014 load command 95 LC_SEGMENT_64 has a fileoff (0x2e918000) that extends beyond the end of the file (0x2e917000), ignoring this section Core file '/cores/core.83014' (x86_64) was loaded. (lldb) bt * thread #1: tid = 0x0000, 0x00007fffa1c12f68 libsystem_c.dylib`strspn + 22, stop reason = signal SIGSTOP * frame #0: 0x00007fffa1c12f68 libsystem_c.dylib`strspn + 22 frame #1: 0x00000001027fea23 ffmpeg_g`url_find_protocol(filename=0x0000000000000000) + 51 at avio.c:255 [opt] frame #2: 0x00000001027ff286 ffmpeg_g`avio_find_protocol_name(url=<unavailable>) + 6 at avio.c:475 [opt] frame #3: 0x0000000102837f54 ffmpeg_g`hls_window [inlined] set_http_options(c=0x00007ff48181cc00) + 12 at hlsenc.c:669 [opt] frame #4: 0x0000000102837f48 ffmpeg_g`hls_window(s=0x00007ff48181c600, last=<unavailable>) + 264 at hlsenc.c:720 [opt] frame #5: 0x00000001028368e2 ffmpeg_g`hls_write_trailer(s=0x00007ff48181c600) + 562 at hlsenc.c:1431 [opt] frame #6: 0x0000000102899736 ffmpeg_g`av_write_trailer(s=<unavailable>) + 278 at mux.c:1329 [opt] frame #7: 0x00000001026a4a8c ffmpeg_g`transcode + 19740 at ffmpeg.c:4430 [opt] frame #8: 0x000000010269f5e1 ffmpeg_g`main(argc=<unavailable>, argv=<unavailable>) + 337 at ffmpeg.c:4598 [opt] frame #9: 0x00007fffa1b81255 libdyld.dylib`start + 1 frame #10: 0x00007fffa1b81255 libdyld.dylib`start + 1 I have reproduced and fixed it. > > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Complexity theory is the science of finding the exact solution to an > approximation. Benchmarking OTOH is finding an approximation of the exact > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 930e94b..c2c47c3 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -251,6 +251,7 @@ static int hls_delete_old_segments(HLSContext *hls) { char *path = NULL; AVDictionary *options = NULL; AVIOContext *out = NULL; + const char *proto = NULL; segment = hls->segments; while (segment) { @@ -300,7 +301,8 @@ static int hls_delete_old_segments(HLSContext *hls) { av_strlcat(path, segment->filename, path_size); } - if (hls->method) { + proto = avio_find_protocol_name(hls->basename); + if (hls->method || (proto && !av_strcasecmp(proto, "http"))) { av_dict_set(&options, "method", "DELETE", 0); if ((ret = hls->avf->io_open(hls->avf, &out, path, AVIO_FLAG_WRITE, &options)) < 0) goto fail; @@ -321,7 +323,7 @@ static int hls_delete_old_segments(HLSContext *hls) { av_strlcpy(sub_path, dirname, sub_path_size); av_strlcat(sub_path, segment->sub_filename, sub_path_size); - if (hls->method) { + if (hls->method || (proto && !av_strcasecmp(proto, "http"))) { av_dict_set(&options, "method", "DELETE", 0); if ((ret = hls->avf->io_open(hls->avf, &out, sub_path, AVIO_FLAG_WRITE, &options)) < 0) { av_free(sub_path); @@ -665,8 +667,14 @@ static void hls_free_segments(HLSSegment *p) static void set_http_options(AVDictionary **options, HLSContext *c) { - if (c->method) + const char *proto = avio_find_protocol_name(c->basename); + + if (c->method) { av_dict_set(options, "method", c->method, 0); + } else if (proto && !av_strcasecmp(proto, "http")) { + av_log(c, AV_LOG_WARNING, "You forget set http method, hls muxer auto set default method to PUT\n"); + av_dict_set(options, "method", "PUT", 0); + } } static void write_m3u8_head_block(HLSContext *hls, AVIOContext *out, int version,
When the http method is not set, the method will use POST for ts, PUT for m3u8, it is not unify, now set it unify. This ticket id: 5315 Signed-off-by: Steven Liu <lq@chinaffmpeg.org> --- libavformat/hlsenc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)