summaryrefslogtreecommitdiffstats
path: root/libavformat/flvdec.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/flvdec: Set broken_sizes for FlixEngine.Nikolas Bowe2018-02-231-2/+4
| | | | | | | | | | | | | | | we found some very old videos which suffered from corruption after 9e6a2427558a718be0c1fffacffd935f630a7a8d, but were fine before. These had "End of AC stream reached in vp6_parse_coeff" warnings in logs. These also had flv Packet mismatch warnings. Adding FlixEngine to the list of flv muxers which produce broken packet sizes fixes this corruption. FlixEngine is very old and not maintained or available anymore (since 2010), so we won't need to worry about newer versions fixing the issue. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f'James Almer2017-10-281-0/+6
|\ | | | | | | | | | | | | * commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f': flv: Validate the packet size Merged-by: James Almer <jamrial@gmail.com>
| * flv: Validate the packet sizeLuca Barbato2017-04-201-0/+6
| | | | | | | | | | | | | | Size can be negative at that point. Bug-Id: 1041 CC: libav-stable@libav.org
| * flvdec: Set avg_frame_rate for video streamsCarl Eugen Hoyos2017-03-221-0/+9
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* | flvdec: Check the avio_seek return value after reading a metadata packetMartin Storsjö2017-10-271-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | merge from libav: 585dc1aecef0371ad6f16cb3750ae2a6da9cf00a If the metadata packet is corrupted, flv_read_metabody can accidentally read past the start of the next packet. If the start of the next packet had been flushed out of the IO buffer, we would be unable to seek to the right position (on a nonseekable stream). Prefer to clearly error out instead of silently trying to read from a desynced stream which will only be interpreted as garbage.
* | Revert "flvdec: Check the avio_seek return value after reading a metadata ↵Steven Liu2017-10-271-7/+1
| | | | | | | | | | | | packet" This reverts commit ef7fe81b8554a2865d47a55edf47420878fa3d91.
* | flvdec: Check the avio_seek return value after reading a metadata packetSteven Liu2017-09-071-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | merge from libav: 585dc1aecef0371ad6f16cb3750ae2a6da9cf00a If the metadata packet is corrupted, flv_read_metabody can accidentally read past the start of the next packet. If the start of the next packet had been flushed out of the IO buffer, we would be unable to seek to the right position (on a nonseekable stream). Prefer to clearly error out instead of silently trying to read from a desynced stream which will only be interpreted as garbage. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* | avformat/flvdec: Set need_context_update when setting the initial extradataAlex Converse2017-09-031-0/+1
| | | | | | | | | | | | Fixes ticket 6398. Debugged with the help of James Almer and Hendrik Leppkes.
* | avformat/flvdec: check FLVHeader PreviousTagSize0Steven Liu2017-03-281-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | refer to SPEC: Annex E. The FLV File Format said: E.3 TheFLVFileBody have a table: Field Type Comment PreviousTagSize0 UI32 Always 0 Reviewed-by: Bela Bodecs <bodecsb@vivanet.hu> Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* | Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-211-3/+4
|\ \ | |/ | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-301-1/+2
| | | | | | | | | | | | | | | | It is supposed to be a flag. The only currently defined value is AVIO_SEEKABLE_NORMAL, but other ones may be added in the future. However all the current lavf code treats this field as a bool (mainly for historical reasons). Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
* | avformat/flvdec: remove meaningless warningwm42017-03-061-1/+0
| | | | | | | | | | | | Ever since the codecpar changes, this has been always printed when opening a flv file. This is because the codecpar changes made all streams to be added lazily as read_packet is called.
* | refine avformat/flvdec set bit_rateSteven Liu2016-11-261-1/+2
| |
* | avformat/flvdec: move set bit_rate from parse AMF OBJECT toSteven Liu2016-11-261-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | create_stream before patch: Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x714 [SAR 1:1 DAR 640:357], 25 fps, 25 tbr, 1k tbn, 50 tbc after patch: Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x714 [SAR 1:1 DAR 640:357], 2576 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc Signed-off-by: Steven Liu <lq@chinaffmpeg.org> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/flvdec: Set avg_frame_rate for video streams.Carl Eugen Hoyos2016-11-251-1/+8
| | | | | | | | | | Requested-by: qw, applemax82 at 163 dot com Reviewed-by: Steven Liu
* | flvdec: require need_context_update when changing codec idAndreas Cadhalpun2016-11-251-6/+21
| | | | | | | | | | | | | | | | Otherwise the codec context and codecpar might disagree on the codec id, triggering asserts in av_parser_parse2. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | avformat/flvdec: add debug message to list keyframes index metadataSteven Liu2016-11-191-0/+2
| | | | | | | | | | | | | | when parsing keyframe index metadata, list the message by trace log Signed-off-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Fix regression loosing streamsMichael Niedermayer2016-10-281-1/+11
| | | | | | | | | | | | | | Fixes: unknown_video.flv Found-by: Thierry Foucu <tfoucu@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/flvdec: init AVPacket::pos to FLVTAG offsetSuman-2016-10-261-0/+1
| | | | | | | | | | | | Current code doesn't initialize AVPacket::pos. Made it point to FLVTAG so flv_read_packet can decode from pos Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: parse keyframe before a\v stream was created ↵Xinzheng Zhang2016-07-271-2/+6
| | | | | | | | | | | | add_keyframes_index() when stream created or keyframe parsed Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: splitting add_keyframes_index() out from ↵Xinzheng Zhang2016-07-271-16/+60
| | | | | | | | | | | | parse_keyframes_index() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Do not check last size if it could not be read due to EOFMichael Niedermayer2016-06-221-0/+1
| | | | | | | | | | Fixes part of Ticket5648 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Also print sum_flv_tag_size on size mismatchesMichael Niedermayer2016-06-221-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Accept last size if its off by 1Michael Niedermayer2016-06-221-1/+1
| | | | | | | | | | | | Fixes part of Ticket5648 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-2/+2
|\ \ | |/ | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-2/+2
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avformat: add AVFormatContext to ff_get_extradata()Paul B Mahol2016-04-141-1/+1
| | | | | | | | | | | | Needed for av_log() inside that function. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-101-141/+137
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-231-122/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
* | lavf/flvdec: Allow files where the PreviousTagSize is not set according to ↵Thierry Foucu2016-01-291-1/+5
| | | | | | | | | | | | | | | | | | | | the spec. Some muxer use the FLV field PreviousTagSize to be the sum of tag length. Without this change, the flv demuxer think the file is broken and the re-sync will fail. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'e4eb13ca77624401ea7cef1ed6ad8e2d13fd2063'Derek Buitenhuis2016-01-271-11/+13
|\ \ | |/ | | | | Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * flvdec: Add sanity checking of the last packet sizeMartin Storsjö2016-01-191-7/+9
| | | | | | | | | | | | | | | | For http, this avoids spurious warnings about failed requests (e.g. HTTP error 416 Requested Range Not Satisfiable), if the last packet is truncated and the size read is bogus. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '09f4822e4eaf61513b9092414450f3ae920ccd9d'Derek Buitenhuis2016-01-271-1/+2
|\ \ | |/ | | | | Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * flvdec: perform duration search just onceMichael Niedermayer2016-01-191-1/+4
| | | | | | | | | | | | | | | | When loading a truncated flv file, it would previously try to do a seek to the end of every packet read. For some input protocols (such as http), such repeated seek attempts are cripple the reading performance. Signed-off-by: Martin Storsjö <martin@martin.st>
| * flvdec: do not create any streams in read_header()Anton Khirnov2015-12-121-9/+2
| | | | | | | | | | | | | | | | | | | | | | The current muxer behaviour is to create streams in read_header() based on the audio/video presence flags, but fill in the stream parameters later when we actually get some packets for them. This is rather shady, since other demuxers set the stream parameters immediately when the stream is created and do not touch the stream codec context after that. Change the flv demuxer to behave in the same way as other similar demuxers -- create the streams only when we get a packet for them.
* | avformat/flvdec: Fix left shift of 137 by 24 places cannot be represented in ↵Michael Niedermayer2015-12-041-1/+1
| | | | | | | | | | | | | | | | | | type int Fixes: 3c857d4d90365731524716e6d051e43a/signal_sigsegv_7f4f59bcc29e_1386_20abd2c8e655cb9c75b24368e65fe3b1.flv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-041-1/+1
| |
* | lavf/flvdec: use FFERROR_REDO instead of AVERROR(EAGAIN).Nicolas George2015-12-031-7/+7
| | | | | | | | Fix trac ticket #5041.
* | Replace remaining occurances of av_free_packet with av_packet_unrefHendrik Leppkes2015-10-271-1/+1
| |
* | avformat/flvdec: set broken_sizes for "metadatacreator : MEGA"Michael Niedermayer2015-10-121-0/+2
| | | | | | | | | | | | | | | | The 2nd size value is wrong for the sample file Fixes: Ticket4903 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Print stream type in case a new stream is discovered after ↵Michael Niedermayer2015-10-071-1/+1
| | | | | | | | | | | | the header Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Remove dead loopMichael Niedermayer2015-10-061-3/+0
| | | | | | | | | | | | Fixes CID1325682 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: accept sizes if they are off by 11Michael Niedermayer2015-10-021-1/+3
| | | | | | | | | | | | | | | | | | This error was produced by rtmproto.c, it is possibly such streams where dumped, this commit is needed to support them Fixes: z0e.flv Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavformat/flvdec.c: free always the packet after a resync.Thierry Foucu2015-09-291-1/+1
| | | | | | | | | | | | | | | | In case of resync, always free the packet, but retry only if the resync did not get to the end of the file. Otherwise, there is a memory leak when the last packet in the file is corrupted. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Detect broken sizes (OBS 0.655b), disable resync for ↵Michael Niedermayer2015-09-191-1/+12
| | | | | | | | | | | | | | affected files Fixes Ticket4867 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Check that sizes match and resync if notMichael Niedermayer2015-09-161-1/+47
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Change packet loop to return EAGAIN instead of looping ↵Michael Niedermayer2015-09-161-6/+12
| | | | | | | | | | | | until a valid packet is foud Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Use the first index entry to find the first packet if there ↵Michael Niedermayer2015-09-131-0/+7
| | | | | | | | | | | | | | | | was a parsing error in the header Fixes: unknow_codec.flv Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Print last packet size at trace levelMichael Niedermayer2015-09-131-2/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Print terminator value found if it differs from ↵Michael Niedermayer2015-09-131-2/+6
| | | | | | | | | | | | AMF_END_OF_OBJECT in AMF_DATA_TYPE_MIXEDARRAY Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
OpenPOWER on IntegriCloud