summaryrefslogtreecommitdiff
path: root/libavformat/hlsenc.c
Commit message (Collapse)AuthorAge
...
* avformat/hlsenc: Fix memleak when deleting old segmentsAndreas Rheinhardt2020-04-08
| | | | | | | | | | | if the directory name of the segments contains "%v". This memleak is caused by masking the pointer that will eventually be freed by a variable of the same name in a smaller scope. Therefore the pointer that gets freed is always NULL when it is freed and the allocated data leaks. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/hlsenc: set the options when open the key info filesSteven Liu2020-03-12
| | | | | | make the options same as segments for the http put method Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/hlsenc: Fix initial setting for start_ptsHongcheng Zhong2020-03-12
| | | | | | | | | | | This patch fixes Bug #8469 If x264 baseline profile is used with other profiles, start_pts will be initialized to audio stream's first pts, while the duration is calculated based on video stream's pts. In this patch the start_pts is initialized with the correct stream's first pts. Signed-off-by: Hongcheng Zhong <sj.hc_Zhong@sjtu.edu.cn> Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/hlsenc: allow a custom SDT and PAT periodMarton Balint2020-02-05
| | | | | | | The default is not to write SDT and PAT periodically, only in the beginning of every segment. After this patch the user might override this if needed. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hlsenc: fix hls_ts_options with mpegtsMarton Balint2020-01-31
| | | | | | Was broken since cdbf8847ea97a985dfd55432e1384bb7fe5d2d3b. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hlsenc: fix default AES key file url with variant streamsBela Bodecs2020-01-20
| | | | | | | | | | | | | | Currently when hls_enc is active and there are multiple variant stream outputs, default key file url construction does not work, because it is based on the FormatContext' url field. But in case of multiple variant streams, it contains the variant m3u8 output playlist url that contains the %v placeholder. So the result key file url will hold the %v placeholder causing run time error message about "could not write the key file". This patch correct this behaviour, and use the master playlist url for constructing the output key file url when master playlist is vailable. Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
* avformat/hlsenc: program_date_time and append_list flags conflictBela Bodecs2020-01-20
| | | | | | | | | | | | | | | | | | | | | | When program_date_time flag is present, in m3u8 playlist file each segment has a corresponding EXT-X-PROGRAM-DATE-TIME value. The intial program-date-time value is the actual current time at init and each new segment increments this value by its duration. When append_list flags is also present, existing playlist parsing by hls_append_segment treats existing segments as new segments regarding the program-date-time calculation. But it should not do that, because this way all real the new segments' EXT-X-PROGRAM-DATE-TIME values will be shifted erroneously by the sum duration of existing segments. Instead it should have decremented the initial program-date-time value by its duration. This would ensure that the first new segment's program-date-time value had the current time as it is expected. This patch corrects this behaviour and prevent existing segments to increment the value of initial_prog_date_time variable but decrements it. Reviewed-by: Steven Liu <lq@onvideo.cn> Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
* avformat/hlsenc: compare without the last directory separator in ↵Steven Liu2020-01-20
| | | | | | | | | | get_relative_url fix ticket: 8461 there is no problem before commit 75aea52a1051a22bdebd0b7a8098ac6479a529a0 Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat: remove unneeded avio_flush() calls before calling avio_close_dyn_buf()Marton Balint2020-01-07
| | | | | | avio_close_dyn_buf() also does avio_flush(). Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hlsenc: use AV_OPT_TYPE_DICT for hls_ts_optionsMarton Balint2020-01-01
| | | | | | Simplifies code and avoids memory leaks. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hlsenc: Fix check for presence of webvtt muxerAndreas Rheinhardt2019-12-23
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: Fix memleaks with repeating parametersAndreas Rheinhardt2019-12-23
| | | | | | | | | | | When a parameter like e.g. language is contained more than once in the part of var_stream_map pertaining to a single VariantStream, the later one just overwrites the pointer to the earlier one, leading to a memleak. This commit changes this by handling the situation gracefully: The earlier string is silently freed first, so that the last one wins. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: Fix return value from localtime_r failureAndreas Rheinhardt2019-12-23
| | | | | | | | | "If an error is detected, localtime_r() shall return a null pointer and set errno to indicate the error." Yet in case this happened in hls_init(), AVERROR(ENOMEM) has been returned. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: Fix potential segfault upon allocation failureAndreas Rheinhardt2019-12-23
| | | | | | | | | | | | | | | | | | | | | | | | | The hls muxer allocates an array of VariantStreams, a structure that contains pointers to objects that need to be freed on their own. This means that the number of allocated VariantStreams needs to be correct when they are freed; yet the number of VariantStreams is set in update_variant_stream_info() resp. parse_variant_stream_mapstring() before the allocation has been checked for success, so that upon error an attempt would be made to free the objects whose pointers are positioned at position NULL (the location of VariantStreams) + offsetof(VariantStream, the corresponding pointer). Furthermore d1fe1344 added another possibility for the first function to leave an inconsistent state behind: If an allocation of one of the objects referenced by the VariantStream fails, the VariantStream will be freed, but the number of allocated VariantStreams isn't reset, leading to the same problem as above. (This was done in the mistaken belief that the VariantStreams array would leak otherwise.) Essentially the same also happens for the number of cc-streams. It has been fixed, too. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: Fix leak of options when writing packetsAndreas Rheinhardt2019-12-23
| | | | | | | | | | | | | | | | | | | | | Under certain circumstances hls_write_packet() would add options to an AVDictionary. Said dictionary was never explicitly freed, instead it was presumed that these options would be consumed when opening a new IO-context. This left several possibilities for memleaks: a) When no new IO-context would be opened at all. This is possible when using both the flags temp_file and single_file together with a file output. b) When an error happens before one actually tries to open the new IO-context. c) When the new IO-context does not consume all options. All three have been fixed; furthermore, the AVDictionary has been put into a smaller scope (namely the only part of hls_write_packet() where it is actually used). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: Fix leak of options when initializing muxing failsAndreas Rheinhardt2019-12-23
| | | | | | | | | | | | | | | | | hls_mux_init() currently leaks an AVDictionary if opening a dynamic buffer fails or if avformat_init_output fails. This has been fixed by moving the initialization resp. the freeing of the dictionary around: In the former case to a place after opening the dynamic buffer, in the latter to a place before the check for initialization failure so that it is done unconditionally. Furthermore, the dictionary is now only copied and freed if the options in it are actually used (namely when in SEGMENT_TYPE_FMP4 mode). Finally, a similar situation in hls_start() has been fixed, too. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: Only allocate when data is known to be neededAndreas Rheinhardt2019-12-23
| | | | | | | | | hls_init() would allocate a buffer, although it is only needed in one of two branches that follow. This commit moves the allocation to the branch that actually needs the buffer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: Fix typo in error messageAndreas Rheinhardt2019-12-23
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: Fix leak of child AVFormatContextAndreas Rheinhardt2019-12-23
| | | | | | | | | | Before ed897633, the hls muxer would free its child AVFormatContexts and reset the pointer to these contexts to NULL immediately afterwards; ed897633 moved the former to later (into a separate function), but kept the resetting, ensuring that the child context leaks. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Steven Liu <lq@onvideo.cn>
* avformat/hlsenc: remove duplicate code blockSteven Liu2019-12-11
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* Remove redundant ;Michael Niedermayer2019-12-10
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hlsenc: set strict_std_compliance from the parent AVFormatContextSteven Liu2019-11-26
| | | | | | | fix ticket: 8388 Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: free the original malloc pointer to avoid error when system ↵Limin Wang2019-11-13
| | | | | | function used in the following patch Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: fix the av_dirname path isn't include separator in the end ↵Limin Wang2019-10-31
| | | | | | | of string Reviewed-by: Liu Steven <lq@chinaffmpeg.org> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: move freep segment from sls_flags_filename_process after ↵Steven Liu2019-10-28
| | | | | | caller failed Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: check av_strdup() return valueSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* lavf/hlsenc: fix memory leakJun Zhao2019-10-18
| | | | | | | fix memory leak Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/hlsenc: replace with av_freep for all av_freeLimin Wang2019-10-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: replace with av_dirname to get the directoryLimin Wang2019-10-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: remove the unnecessary null pointer checkLimin Wang2019-10-08
| | | | | Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: add logging context to logSteven Liu2019-10-08
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: make fix code style of hls_write_trailerSteven Liu2019-09-14
| | | | change vs->avf to oc
* avformat/hlsenc: Fix memleak when using single_fileAndreas Rheinhardt2019-09-14
| | | | | | | | | | This commit fixes a memleak in the hls muxer when one uses a single file as output. It has been forgotten to free the temporary buffers used to write the packets so that the size of the leaks basically amounts to the size of the output file. This commit adds the necessary free. Reviewed-by: Steven Liu <lq@onvideo.cn> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* hlsenc: flush segments to guarantuee atomic single file hlsDaniel Oberhoff2019-09-14
|
* avformat/hlsenc: fix memleak at hls_write_trailerSteven Liu2019-09-12
| | | | | Found-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: print warning at the end when upload the last segment failedSteven Liu2019-09-12
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: merge fmp4 and mpegts segment type m3u8 list AVIOConextSteven Liu2019-09-12
| | | | | | | hlsenc has been merge fmp4 and mpegts workflow before so it can merge m3u8 list AVIOContext now. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: fix compiling error of hlsencSteven Liu2019-09-06
|
* avformat/hlsenc: fix code styleSteven Liu2019-09-06
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: move the warning message from every segment upload to init partSteven Liu2019-09-06
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: avformat/hlsenc: reopen new http session for http_persistentSteven Liu2019-09-06
| | | | | | | | fix ticket: 7975 Tested-by: Ian Klassen <ian@virtualfunc.com> Suggested-by: Ian Klassen <ian@virtualfunc.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* lavf/hlsenc: refine the get_relative_url function to avoid extra malloc for ↵Limin Wang2019-09-02
| | | | | | | relation path Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: remove unused valueSteven Liu2019-08-26
| | | | | CID: 1452644 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: fix memleak of filenameSteven Liu2019-08-26
| | | | | CID: 1452445 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: fix memleak in hls_write_trailerSteven Liu2019-08-26
| | | | | | fix CID: 1426931 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: avformat/hlsenc: simplified codeSteven Liu2019-08-21
| | | | | | simplified code for get dirname string in hls_delete_old_segments Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: simplified code of use_localtime in hls_initSteven Liu2019-08-21
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: fix memleak in update_variant_stream_infoSteven Liu2019-08-21
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: reindent codeSteven Liu2019-08-20
| | | | and remove redundant empty line
* avformat/hlsenc: remove unuse comment of the codeSteven Liu2019-08-20
|