[FFmpeg-devel] [PATCH v2] avformat/hlsenc: merge mpegts and fmp4 workflow to one workflow

Michael Niedermayer michael at niedermayer.cc
Fri Aug 2 13:46:06 EEST 2019


On Wed, Jul 31, 2019 at 04:07:22PM +0800, Steven Liu wrote:
> write mpegts or fmp4 context into buffer, and flush the buffer into
> output file when split fragment. merge two format split workflow into
> one workflow
> 
> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> ---
>  libavformat/hlsenc.c | 200 ++++++++++++++++++++-----------------------
>  1 file changed, 92 insertions(+), 108 deletions(-)

make -j5 ffmpeg && ./ffmpeg -f lavfi -re -i testsrc -c:v h264 -hls_flags delete_segments -hls_key_info_file file.keyinfo -t 2 /tmp/file-hlsencry.m3u8
...
Output #0, hls, to '/tmp/file-hlsencry.m3u8':
  Metadata:
    encoder         : Lavf58.30.100
    Stream #0:0: Video: h264 (libx264), yuv444p, 320x240 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.56.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[hls @ 0x24a1800] Opening '/tmp/file-hlsencry0.ts' for writingA speed=   0x    
*** Error in `./ffmpeg': free(): invalid size: 0x0000000002b4aa50 ***
Aborted (core dumped)


[hls @ 0x25662840] Opening '/tmp/file-hlsencry0.ts' for writing speed=   0x    
==13307== Invalid read of size 8
==13307==    at 0x6BD2FE: avio_close_dyn_buf (in ffmpeg/ffmpeg_g)
==13307==    by 0x6F5742: hls_write_trailer (in ffmpeg/ffmpeg_g)
==13307==    by 0x763E0A: av_write_trailer (in ffmpeg/ffmpeg_g)
==13307==    by 0x4D390A: transcode (in ffmpeg/ffmpeg_g)
==13307==    by 0x4B1E1C: main (in ffmpeg/ffmpeg_g)
==13307==  Address 0x3dcc6f50 is 8 bytes after a block of size 8 alloc'd
==13307==    at 0x4C2A6C5: memalign (vg_replace_malloc.c:727)
==13307==    by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876)
==13307==    by 0x116963F: av_mallocz (in ffmpeg/ffmpeg_g)
==13307==    by 0x6BBA37: ffio_open_whitelist (in ffmpeg/ffmpeg_g)
==13307==    by 0x78B1E9: io_open_default (in ffmpeg/ffmpeg_g)
==13307==    by 0x6F353D: hls_start (in ffmpeg/ffmpeg_g)
==13307==    by 0x6F7312: hls_init (in ffmpeg/ffmpeg_g)
==13307==    by 0x761D12: avformat_init_output (in ffmpeg/ffmpeg_g)
==13307==    by 0x762434: avformat_write_header (in ffmpeg/ffmpeg_g)
==13307==    by 0x4C9D58: check_init_output_file (in ffmpeg/ffmpeg_g)
==13307==    by 0x4CB23D: init_output_stream.constprop.23 (in ffmpeg/ffmpeg_g)
==13307==    by 0x4D079F: reap_filters (in ffmpeg/ffmpeg_g)
==13307== 
[hls @ 0x25662840] Opening '/tmp/file-hlsencry.m3u8.tmp' for writing

if you cannot reproduce, tell me and ill rebuild and provide better
debug info

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190802/f80bfc9d/attachment.sig>


More information about the ffmpeg-devel mailing list