summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* 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>
* avformat/ifv: Check for EOF in read_index()Michael Niedermayer2019-07-19
| | | | | | | | | Fixes: Timeout Fixes: 15567/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5758451487080448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* matroskadec: Remove redundant constAndreas Rheinhardt2019-07-18
| | | | | | | | | | The typedef used to define EbmlSyntax already includes a const qualifier so that it is unnecessary to include another const qualifier in future definitions and declarations. Given that MSVC warns about this, this commit removes these redundant const qualifiers. Suggested-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* matroskadec: Add sizes to forward declarationsAndreas Rheinhardt2019-07-18
| | | | | | | | | | | | | | | | Unknown-length elements end when an element not allowed in them, but allowed at a higher level is encountered. In order to check for this, c1abd95a added a pointer to every syntax level's parent to each EbmlSyntax. Given that the parent must of course also reference the child in order to be able to enter said child level, one needs to use forward declarations. These forward declarations constitute tentative definitions and tentative definitions with internal linkage (like our syntaxes) must not be an incomplete type. Yet they were an incomplete type and while GCC and Clang did not even warn about this (on default warning levels), it broke compilation with MSVC. Therefore this commit adds the sizes. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/rawdec: Make the raw packet size configurableMichael Niedermayer2019-07-17
| | | | | | | | This allows testing parsers with a wider range of input packet sizes. Which is important and usefull for regression testing, some of our parsers in fact to not work if the packet size is changed from 1024 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/takdec: Check for multiple streaminfoMichael Niedermayer2019-07-17
| | | | | | | | Fixes: memleak Fixes: 15446/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5662875831500800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/takdec: Free buffer on error pathesMichael Niedermayer2019-07-17
| | | | | | | | Fixes: memleak Fixes: 15446/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5662875831500800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/matroskadec: Improve check for level 1 duplicatesAndreas Rheinhardt2019-07-16
| | | | | | | | | | | | | | | | If a file uses unknown-length level 1 elements besides clusters and such elements are after the first cluster, then these elements will usually be parsed twice: Once during parsing of the file header and once when reading the file reaches the position where these elements are located. The second time the element is parsed leads to a "Duplicate element" error message. Known-length elements are not affected by this as they are skipped except during parsing the header. This commit fixes this by explicitly adding a check for whether the position of the element to be parsed is the same as the position of the already known level 1 element. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Use file offsets for level 1 elementsAndreas Rheinhardt2019-07-16
| | | | | | | | | | | | This commit converts the MatroskaLevel1Element struct to use file-based offsets, as opposed to the current practice of using offsets relative to the beginning of the segment in it. This also includes a change from uint64_t to int64_t. This is in preparation to another patch that improves the check for duplicate level 1 elements. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Reindent after previous commitAndreas Rheinhardt2019-07-16
| | | | | | Also use the smallest scope possible for a loop variable. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Accept more unknown-length elements IIAndreas Rheinhardt2019-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, one last kind of unknown-length element hasn't been properly handled: Unknown-length elements that are supposed to be skipped, i.e. the level 1 elements that might reside after the clusters. This commit changes this. To do this, ebml_parse got a mode that essentially tries to skip everything except when parsing is needed (namely for unknown-length elements for which parsing is necessary as they can't be skipped). This mode is selected by using a NULL as destination where the parsed data should be written to. It is used to parse the level 1 elements in matroska_parse_cluster. The syntax list used for parsing must of course include links to the syntax of all the master elements that might need to be parsed. In other words: Instead of matroska_clusters (which contained every level 1 element except clusters as EBML_NONE elements designated to be skipped) matroska_segment is needed and used; matroska_clusters has been removed. Furthermore, matroska_segment has been reordered so that clusters are at the front as this is now the most common case for this list. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Fix probing of unknown-length headersAndreas Rheinhardt2019-07-16
| | | | | | | | matroska_probe did not support the case of an unknown-length EBML header at all; given that libavformat's Matroska muxer used to produce such files in the streaming case, support for them has been added. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Accept more unknown-length elementsAndreas Rheinhardt2019-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current Matroska specifications mandate that only two elements may use an unknown-length length: Segments and clusters. But this was not always so: For the greater part of Matroska's existence, all master elements were allowed to make use of the unknown-length feature. And there were muxers creating such files: For several years libavformat's Matroska muxer used unknown-length for all master elements when the output wasn't seekable. This only stopped in March 2010 with 2529bb30. And even afterwards it was possible (albeit unlikely) for libavformat to create unknown-length master elements that are in violation of today's specifications, namely if the master element was so big that the seek backwards to update the size could no longer be performed inside the AVIOContext's write buffer. This has only been fixed in October 2016 (with the patches that introduced support for writing CRC-32 elements). Libavformat's Matroska demuxer meanwhile has never really supported unknown-length elements besides segments and clusters. Support for the latter was hardcoded. This commit changes this: Now all master elements for which a syntax to parse them is available are supported. This includes the files produced by old versions of libavformat's muxer. More precisely, master elements that have unknown length and are about to be parsed (not skipped) are supported; only a warning is emitted for them. For normal files, this means that level 1 elements after the clusters that are encountered after the clusters have been parsed (i.e. not because they are referenced by the seekhead at the beginning of the file) are still unsupported (they would be skipped at this point if their length were known). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Improve invalid length error handlingAndreas Rheinhardt2019-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Up until now, the error message for EBML numbers whose length exceeds the limits imposed upon them because of the element's type did not distinguish between known-length and unknown-length elements. As a consequence, the numerical value of the define constant EBML_UNKNOWN_LENGTH was emitted as part of the error message which is of course not appropriate. This commit changes this by adding error messages designed for unknown-length elements. 2. We impose some (arbitrary) sanity checks on the lengths of certain element types; these checks were conducted before the checks depending on whether the element exceeds its containing master element. Now the order has been reversed, because a failure at the (formerly) latter check implies that the file is truly erroneous and not only fails our arbitrary length limit. Moreover, this increases the informativeness of the error messages. 3. Furthermore, the error message in general has been changed by replacing the type of the element (something internal to this demuxer and therefore suitable as debug output at best, not as an error message intended for ordinary users) with the element ID. The element's position has been added, too. 4. Finally, the length limit for EBML_NONE elements has been changed so that all unknown-length elements of EBML_NONE-type trigger an error. This is done because unknown-length elements can't be skipped and need to be parsed, but there is no syntax to parse available for EBML_NONE elements. This is done in preparation for a further patch which allows more unknown-length elements than just clusters and segments. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Don't skip too much when unseekableAndreas Rheinhardt2019-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | The Matroska (and WebM) file format achieves forward-compability by insisting that demuxers ignore and skip elements they don't know about. Unfortunately, this complicates the detection of errors as errors resulting from loosing sync can't be reliably distinguished from unknown elements that are part of a future version of the standard. Up until now, the strategy to deal with this situation was to skip all unknown elements that are not obviously erroneous; if an error happened, it was tried to seek to the last known good position to resync from (and resync to level 1 elements). This is working fine if the input is seekable, but if it is not, then the skipped data can usually not be rechecked lateron. This is particularly acute if unknown-length clusters are in use, as the check for whether a child element exceeds the containing master element is ineffective in this situation. To remedy this, a new heuristic has been introduced: If an unknown element is encountered in non-seekable mode, an error is presumed to have happened based upon a combination of the length of the row of the already encountered unknown elements and of how far away skipping this element would take us. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Typos, nits and cosmeticsAndreas Rheinhardt2019-07-16
| | | | | | | | | Cosmetics include reordering EbmlType so that EBML_SINT is adjacent to the other numbers (and matches the order in the switch in ebml_parse) and also reordering the switch for assignment of default values so that it matches the order in EbmlType. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Reuse positionsAndreas Rheinhardt2019-07-16
| | | | | | | | | | | | | | Up until now, avio_tell was used multiple times in ebml_parse and its subroutines, although the result of these calls can usually be simply derived from the result of earlier calls to avio_tell. This has been changed. Unnecessary calls to avio_tell in ebml_parse are avoided now. Furthermore, there has been a slight change in the output of some error messages relating to elements exceeding their containing master element: The reported position of the element now points to the first byte of the element ID and no longer to the first byte of the element's payload. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>