summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* lavf/utils: fix error like "offset 0x1f85: partial file"tomajsjiang2019-08-15
| | | | | | | | | fix error like "offset 0x1f85: partial file", the root cause is when read the mp4 file from http, and the moov in the end of the mp4 file, reconfig the buffer will drop some data. Signed-off-by: Jun Zhao <barryjzhao@tencent.com> Signed-off-by: Zhongxing Jiang <tomajsjiang@tencent.com>
* lavf/avio: add a ffio_realloc_buf API for AVIO buffer realloctomajsjiang2019-08-15
| | | | | | Add new API ffio_realloc_buf for AVIO buffer realloc. Signed-off-by: Zhongxing Jiang <tomajsjiang@tencent.com>
* avformat/mux: Use av_packet_rescale_tsAndreas Rheinhardt2019-08-15
| | | | | | | | | ff_write_chained essentially duplicated the functionality of av_packet_rescale_ts. This has been changed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: Use const AVPacket * in compare functionsAndreas Rheinhardt2019-08-15
| | | | | | | | | There is no reason for these functions to modify the given packets at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpegtsenc: remove deprecated resend_headers optionMarton Balint2019-08-14
| | | | | | Deprecated since 2014. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: fix PCR generation intervalsMarton Balint2019-08-14
| | | | | | | | | | | | | | | | | | | | | | | | PCR generation was based on counting packets for both CBR and VBR streams. Couting packets might have worked for CBR streams (when muxrate was specified) but it only took into account the packets of a service (or the packets of the PCR stream lately), so even that was problematic for multi program streams. The new code works on actual timestamps for both CBR and VBR streams. For VBR streams the behaviour of the old code is simulated by selecting a PCR interval which is the highest multiple of the frame duration but still less than 100 ms. It should be trivial to add support for setting the PCR interval for VBR streams as well in a later patch. The accuracy of PCR packets for CBR streams was greatly improved by preemtively sending them at PCR intervals even if sending the payload of another stream is in progress. This may fix these tickets: - #5750 - #7524 Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: use increasing numbers in default service namesMarton Balint2019-08-14
| | | | | | Maybe we should use service ID instead of increasing numbers? Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: remove section_write_packet forward declarationMarton Balint2019-08-14
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: factorize setting up servicesMarton Balint2019-08-14
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: fix incorrect PCR selection with multiple programsMarton Balint2019-08-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MPEG-TS muxer had a serious bug related to the use of multiple programs: in that case, the PCR pid selection was incomplete for all services except one. This patch solves this problem and selects a stream to become PCR for each service, preferably the video stream. This patch also moves pcr calculation attributes to MpegTSWriteStream from MpegTSService. PCR is a per-stream and not per-service thing, so it was misleading to refer to it as something that is per-service. Also remove *service from MpegTSWriteStream because a stream can belong to multiple services so it was misleading to select one for each stream. You can check the result with this example command: ./ffmpeg -loglevel verbose -y -f lavfi -i \ "testsrc=s=64x64:d=10,split=2[out0][tmp1];[tmp1]vflip[out1];sine=d=10,asetnsamples=1152[out2]" \ -flags +bitexact -fflags +bitexact -sws_flags +accurate_rnd+bitexact \ -codec:v libx264 -codec:a mp2 -pix_fmt yuv420p \ -map '0:v:0' \ -map '0:v:1' \ -map '0:a:0' \ -program st=0:st=2 -program st=1:st=2 -program st=2 -program st=0 -f mpegts out.ts You should now see this: [mpegts @ 0x37505c0] service 1 using PCR in pid=256 [mpegts @ 0x37505c0] service 2 using PCR in pid=257 [mpegts @ 0x37505c0] service 3 using PCR in pid=258 [mpegts @ 0x37505c0] service 4 using PCR in pid=256 Fixes ticket #8039. v2: a video is stream is preferred if there are no programs, just like before the patch. Signed-off-by: Marton Balint <cus@passwd.hu>
* libavformat/subfile: Fix SEEK_CUR and SEEK_END seekingAndreas Rheinhardt2019-08-13
| | | | | | | | | | | Up until now, when performing a SEEK_END seek, the subfile protocol ignored the desired position (relative to EOF) and used the current absolute offset in the input file instead. And when performing a SEEK_CUR seek, the current position has been ignored. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavf/concat: implement FFSEEK_SIZE.Nicolas George2019-08-13
|
* lavf/aviobuf: make AVSEEK_SIZE usable from outside.Nicolas George2019-08-13
|
* avformat/vividas: Fix another infinite loopMichael Niedermayer2019-08-11
| | | | | | | Not found by the fuzzer Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vividas: Fix infinite loop in header parserMichael Niedermayer2019-08-11
| | | | | | | | | Fixes: Timeout (Infinite -> Finite) Fixes: 16010/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5638616102993920 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/dump: Fix cpb bitrate type after next major bump.Carl Eugen Hoyos2019-08-10
|
* lavf/dump: Fix vbv_delay type specifier.Carl Eugen Hoyos2019-08-10
| | | | Spotted-by: James Almer
* avformat/rtpdec_mpeg4: Fix integer parameters size check in SDP fmtp lineOlivier Maignial2019-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | === PROBLEM === I was trying to record h264 + aac streams from an RTSP server to mp4 file. using this command line: ffmpeg -v verbose -y -i "rtsp://<ip>/my_resources" -codec copy -bsf:a aac_adtstoasc test.mp4 FFmpeg then fail to record audio and output this logs: [rtsp @ 0xcda1f0] The profile-level-id field size is invalid (40) [rtsp @ 0xcda1f0] Error parsing AU headers ... [rtsp @ 0xcda1f0] Could not find codec parameters for stream 1 (Audio: aac, 48000 Hz, 1 channels): unspecified sample format In SDP provided by my RTSP server I had this fmtp line: a=fmtp:98 streamType=5; profile-level-id=40; mode=AAC-hbr; config=1188; sizeLength=13; indexLength=3; indexDeltaLength=3; In FFmpeg code, I found a check introduced by commit 24130234cd9dd733116d17b724ea4c8e12ce097a. It disallows values greater than 32 for fmtp line parameters. RFC-4566 (SDP: Session Description Protocol) do not give any limit of size on interger parameters given in an fmtp line. However, In RFC-6416 (RTP Payload Format for MPEG-4 Audio/Visual Streams) give examples of "profile-level-id" values for AAC, up to 55. === FIX === As each parameter may have its own min and max values I propose to introduce a range for each parameter. For this patch I used RFC-3640 and ISO/IEC 14496-1 as reference for validity ranges. This patch fix my problem and I now can record my RTSP AAC stream to mp4. It has passed the full fate tests suite sucessfully. Signed-off-by: Olivier Maignial <olivier.maignial@smile.fr> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/hls: add http_seekable option for HTTP partial requestsJun Zhao2019-08-08
| | | | | | | | | | 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>
* Revert "avformat/rtpdec_rfc4175: Fix incorrect copy_offset calculation"Michael Niedermayer2019-08-06
| | | | | | Reverted at the request of the Author due to potential regression with SMPTE 2110-20 This reverts commit 9051092e73666e95986eb2d596cc0867aea05c3d.
* avformat/rtpdec_rfc4175: Fix incorrect copy_offset calculationJacob Siddall2019-08-05
| | | | | | | | | | | | | | | | | The previous calculation code did not account for the fact that the copy_offset for the start of the frame array is at index 0, yet the scan line number from the rfc4175 RTP header starts at 1. This caused 2 issues to appear: - The first scan line was being copied into the array where the second scan line should be. This caused the resulting video to have a green line at the top of it. - Since the packet containing the last scan line would fail the calculation, the packet with the RTP marker would not be processed which caused a log message saying "Missed previous RTP marker" to be outputted for each frame. Signed-off-by: Jacob Siddall <kobe@live.com.au> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/realtextdec: Check for duplicate extradata in realtext_read_header()Michael Niedermayer2019-08-05
| | | | | | | | Fixes: memleak Fixes: 16140/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5684008052064256 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vividas: Fix memleak of AVIOContext in track_header()Michael Niedermayer2019-08-05
| | | | | | | | Fixes: memleak Fixes: 16127/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5649290914955264 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vividas: Check that value from ffio_read_varlen() does not overflowMichael Niedermayer2019-08-03
| | | | | | | | Fixes: signed integer overflow: -1241665686 + -1340629419 cannot be represented in type 'int' Fixes: 15922/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5692826442006528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vividas: forward errors from track_header()Michael Niedermayer2019-08-03
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vividas: Check buffer size before allocationMichael Niedermayer2019-08-03
| | | | | | | | Fixes: out of array access Fixes: 15365/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5716153105645568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/vividas: Check if extradata was read successfullyMichael Niedermayer2019-08-03
| | | | | | | | Fixes: OOM Fixes: 15575/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5654666781655040 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dashenc: fix writing the AV1 codec string in mp4 modeJames Almer2019-08-03
| | | | | | | | | | From https://aomediacodec.github.io/av1-isobmff/#codecsparam, the parameters sample entry 4CC, profile, level, tier, and bitDepth are all mandatory fields. All the other fields are optional, mutually inclusive (all or none). Fixes ticket #8049 Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashenc: update stream extradata from packet side dataJames Almer2019-08-03
| | | | | | | | | codecpar->extradata is not going to change between packets. New extradata is instead propagated using packet side data. Use ff_alloc_extradata() as well. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/av1: combine high_bitdepth and twelve_bit into a single bitdepth valueJames Almer2019-08-03
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/av1: rename some AV1SequenceParameters fieldsJames Almer2019-08-03
| | | | | | Cosmetic change. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/av1: split off sequence header parsing from the av1C writing functionJames Almer2019-08-03
| | | | | | It will be used by the dash muxer Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/av1: add color config values to AV1SequenceParametersJames Almer2019-08-03
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mpc: deallocate frames array on errorsMichael Niedermayer2019-07-31
| | | | | | | | Fixes: memleak on error path Fixes: 15984/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5679918412726272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/av1: fix AV1CodecConfigurationBox name in doxyJames Almer2019-07-30
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/hlsenc: Fix overflow of int for durations computeSteven Liu2019-07-29
| | | | | | | Fix ticket: 8037 Reported-by: DusanBrejka Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avcodec/adpcm: add support for 5.1 ADPCM MSPaul B Mahol2019-07-26
|
* lafv/wavdec: Fail bext parsing on incomplete readsMatt Wolenetz2019-07-26
| | | | | | | | | | | | | | | | | avio_read can successfully return even when less than the requested amount of input was read. wavdec's bext parsing mistakenly assumed a successful avio_read always read the full amount that was requested. The result could be dictionary tags populated with partially uninitialized values. This change also fixes a broken assertion in wav_parse_bext_string that was off-by-one, though no known current usage of that method hits that broken case. Chromium bug: 987270 Signed-off-by: Matt Wolenetz <wolenetz@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/hls: replace the same code logic with ensure_playlist()vacingfang2019-07-26
| | | | | | | | 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>
* lavf/hls: remove redundancy reset_packet() after av_packet_unref()Jun Zhao2019-07-26
| | | | | | | | 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>
* avformat/mxfenc: fix index byte count in partition headerBaptiste Coudurier2019-07-22
|
* avformat/mov: fix return code for trun box with no sample entriesGyan Doshi2019-07-22
| | | | | | | A value of zero for sample_count in trun box is not prohibited by 14496-12 section 8.8.8. 4a9d32baca disallowed this which led the demuxer to error out when reading the header of valid files.
* avformat/dashenc: add descriptor which is useful to the scheme defined by ↵Leo Zhang2019-07-22
| | | | | | ISO/IEC 23009-1:2014/Amd.2:2015. Signed-off-by: leozhang <leozhang@qiyi.com>
* Bump minor versions again on master to keep 4.2 versions separate from masterMichael Niedermayer2019-07-21
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump minor versions to separate 4.2 from masterMichael Niedermayer2019-07-21
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/avio: remove ffio_open2_wrapper functionJun Zhao2019-07-21
| | | | | | Remove the function ffio_open2_wrapper, it's not being used anymore. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/aacdec: resync to the next adts frame on invalid data instead of ↵James Almer2019-07-20
| | | | | | | | aborting Should fix ticket #6634 Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/aacdec: factorize the adts frame resync codeJames Almer2019-07-20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mux: correct error msg for when BSF filtering failsGyan Doshi2019-07-20
|
* avformat/utils: Check rfps_duration_sum for overflowMichael Niedermayer2019-07-19
| | | | | | | | Fixes: signed integer overflow: 9151595917793558550 + 297519050751678697 cannot be represented in type 'long' Fixes: 15496/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5722866475073536 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>