]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavformat/mpjpegdec: make sure we seek back to the ensured buffer
Marton Balint [Sat, 26 Sep 2020 18:36:25 +0000 (20:36 +0200)]
avformat/mpjpegdec: make sure we seek back to the ensured buffer

It was possible for the old code to seek back before the most recently read
data if start of a new multipart was across read boundaries. Now we read some
small sections multiple times to avoid this, but that is OK.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mpegts: make sure mpegts_resync do not run out of the initially requested...
Marton Balint [Sat, 26 Sep 2020 18:30:27 +0000 (20:30 +0200)]
avformat/mpegts: make sure mpegts_resync do not run out of the initially requested probe buffer

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/aviobuf: fix checks in ffio_ensure_seekback
Marton Balint [Sat, 19 Sep 2020 22:01:48 +0000 (00:01 +0200)]
avformat/aviobuf: fix checks in ffio_ensure_seekback

The new buf_size was detemined too conservatively, maybe because of the
off-by-one issue which was fixed recently in fill_buffer. We can safely
substract 1 more from the new buffer size, because max_buffer_size space must
only be guaranteed when we are reading the last byte of the requested window.

Comparing the new buf_size against filled did not make a lot of sense, what
makes sense is that we want to reallocate the buffer if the new buf_size is
bigger than the old, therefore the change in the check.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/aviobuf: check if requested seekback buffer is already read
Marton Balint [Sat, 26 Sep 2020 17:20:50 +0000 (19:20 +0200)]
avformat/aviobuf: check if requested seekback buffer is already read

Existing code did not check if the requested seekback buffer is
already read entirely. In this case, nothing has to be done to guarantee
seekback.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/aviobuf: write data into the IO buffer till the very end of the buffer
Marton Balint [Sun, 20 Sep 2020 07:32:44 +0000 (09:32 +0200)]
avformat/aviobuf: write data into the IO buffer till the very end of the buffer

There was an off-by-one error when checking if the IO buffer still has enough
space till the end. One more byte can be safely written.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavfilter/vf_minterpolate: Remove redundant code for freeing
Andreas Rheinhardt [Tue, 6 Oct 2020 13:10:43 +0000 (15:10 +0200)]
avfilter/vf_minterpolate: Remove redundant code for freeing

ad73b32d2922f4237405043d19763229aee0e59e added some code for freeing in
the input's config_props function, yet this is unnecessary as uninit is
called anyway if config_props fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_minterpolate: Fix left shift of negative value
Andreas Rheinhardt [Tue, 6 Oct 2020 12:52:11 +0000 (14:52 +0200)]
avfilter/vf_minterpolate: Fix left shift of negative value

This has happened when initializing the motion estimation context if
width or height of the video was smaller than the block size used
for motion estimation and if the motion interpolation mode indicates
not to use motion estimation.

The solution is of course to only initialize the motion estimation
context if the interpolation mode uses motion estimation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_minterpolate: Reject too small dimensions
Andreas Rheinhardt [Tue, 6 Oct 2020 12:35:25 +0000 (14:35 +0200)]
avfilter/vf_minterpolate: Reject too small dimensions

The latter code relies upon the dimensions to be not too small;
otherwise one will call av_clip() with min > max lateron which aborts
in case ASSERT_LEVEL is >= 2 or one will get a nonsense result that may
lead to a heap-buffer-overflow/underflow. The latter has happened in
ticket #8248 which this commit fixes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/rtsp: allocate correct max number of pollfds
Andriy Gelman [Sat, 26 Sep 2020 22:26:30 +0000 (18:26 -0400)]
avformat/rtsp: allocate correct max number of pollfds

There is one general rtsp connection plus two connections per stream (rtp/rtcp).

Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavformat/rtspdec: add newline in log message
Andriy Gelman [Sat, 26 Sep 2020 22:26:29 +0000 (18:26 -0400)]
avformat/rtspdec: add newline in log message

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoFATE/dnn: only run unit test when CONFIG_DNN enabled
Peter Ross [Thu, 8 Oct 2020 11:00:56 +0000 (22:00 +1100)]
FATE/dnn: only run unit test when CONFIG_DNN enabled

Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
3 years agoavcodec/magicyuvenc: Use more correct cast in compare function
Andreas Rheinhardt [Thu, 8 Oct 2020 19:14:28 +0000 (21:14 +0200)]
avcodec/magicyuvenc: Use more correct cast in compare function

There is no need to cast const away (even if it was harmless) and to
copy the object at all.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/magicyuvenc: Avoid sorting Huffman table unnecessarily
Andreas Rheinhardt [Mon, 28 Sep 2020 13:11:52 +0000 (15:11 +0200)]
avcodec/magicyuvenc: Avoid sorting Huffman table unnecessarily

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mjpegdec: Remove redundant initialization
Andreas Rheinhardt [Thu, 8 Oct 2020 18:08:12 +0000 (20:08 +0200)]
avcodec/mjpegdec: Remove redundant initialization

Now that the correct number of codes is used, it is no longer necessary
to initialize the lengths of the codes at all any more as the length of
the actually used codes is set later anyway.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mjpegdec: Remove use_static from build_vlc()
Andreas Rheinhardt [Thu, 8 Oct 2020 18:02:17 +0000 (20:02 +0200)]
avcodec/mjpegdec: Remove use_static from build_vlc()

It is always zero; it referred to the INIT_VLC_USE_STATIC flag which has
been removed in 595324e143b57a52e2329eb47b84395c70f93087.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/libopenmpt: Don't discard const
Andreas Rheinhardt [Thu, 8 Oct 2020 13:46:06 +0000 (15:46 +0200)]
avformat/libopenmpt: Don't discard const

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mjpegdec: Use correct number of codes when init default VLCs
Andreas Rheinhardt [Thu, 8 Oct 2020 17:35:02 +0000 (19:35 +0200)]
avcodec/mjpegdec: Use correct number of codes when init default VLCs

Commit bbc0d0c1fe2b7ecdc4367295594f084f85ad22f5 made the mjpeg decoder
use default Huffman tables when none are given, yet when initializing
the default Huffman tables, it did not use the correct number of entries
of the arrays used to initialize the tables, but instead it used the
biggest entry + 1 (as if it were a continuous array 0..biggest entry).
This worked because the ff_init_vlc_sparse() (and its predecessors)
always skipped entries with a length of zero and the length of the
corresponding elements was always initialized to zero with only the
sizes of the actually existing elements being set to a size > 0 lateron.

Yet since commit 1249698e1b424cff8e77e6a83cfdbc9d11e01aa7 this is no
longer so, as build_vlc() actually read the array containing the values
itself. This implies that the wrong length now leads to a read beyond
the end of the given array; this could lead to crashs (but usually
doesn't); it is detectable by ASAN* and this commit fixes it.

*: AddressSanitizer: global-buffer-overflow on address xy
...
xy is located 0 bytes to the right of global variable 'avpriv_mjpeg_val_ac_luminance'

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mjpegdec: Use correct number of codes for VLC tables
Andreas Rheinhardt [Thu, 8 Oct 2020 17:22:35 +0000 (19:22 +0200)]
avcodec/mjpegdec: Use correct number of codes for VLC tables

Commit 1249698e1b424cff8e77e6a83cfdbc9d11e01aa7 made
ff_mjpeg_decode_dht() call build_vlc() with a wrong (too hight)
number of codes. The reason it worked is that the lengths of the extraneous
entries is initialized to zero and ff_init_vlc_sparse() ignores codes
with a length of zero. But using a too high number of codes was
nevertheless bad, because a) the assert in build_vlc() could have been
triggered (namely if the real amount of codes is 256) and b) the loop in
build_vlc() uses initialized data (leading to Valgrind errors [1]).
Furthermore, the old code spend CPU cycles in said loop although the
result won't be used anyway.

[1]: http://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-valgrind&time=20201008025137

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoVP9 Profile 2 VDPAU support
ManojGuptaBonda [Thu, 8 Oct 2020 06:18:51 +0000 (11:48 +0530)]
VP9 Profile 2 VDPAU support

Added VDPAU to list of supported formats for VP9 420 10 and 12 bit
formats. Add VP9 10/12 Bit support for VDPAU

Signed-off-by: Philip Langdale <philipl@overt.org>
3 years agoavformat/dashdec: Reset pointer to NULL after freeing it
Andreas Rheinhardt [Thu, 8 Oct 2020 13:40:02 +0000 (15:40 +0200)]
avformat/dashdec: Reset pointer to NULL after freeing it

This is currently safe here, because the effective lifetime of
adaptionset_lang is parse_manifest_adaptationset() (i.e. the pointer
gets overwritten each time on entry to the function and gets freed
before exiting the function), but it is nevertheless safer to reset the
pointer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoconfigure: add missing atsc_a53 dependencies to hevcparse and h264_parser
James Almer [Thu, 8 Oct 2020 13:09:39 +0000 (10:09 -0300)]
configure: add missing atsc_a53 dependencies to hevcparse and h264_parser

Found-by: Chris Miceli <chris@miceli.net.au>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolibavformat/dashdec: Fix issue with dash on Windows
Christopher Degawa [Thu, 8 Oct 2020 12:45:21 +0000 (12:45 +0000)]
libavformat/dashdec: Fix issue with dash on Windows

Use xmlFree instead of av_freep

snip from libxml2:

 * xmlGetProp:
...
 * Returns the attribute value or NULL if not found.
 *     It's up to the caller to free the memory with xmlFree().

According to libxml2, you are supposed to use xmlFree instead of free
on the pointer returned by it, and also using av_freep on Windows will
call _aligned_free instead of normal free, causing _aligned_free to raise
SIGTRAP and crashing ffmpeg and ffplay.

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
3 years agolavf/img2dec: Auto-detect Cintel scanner images.
Carl Eugen Hoyos [Thu, 8 Oct 2020 07:34:55 +0000 (09:34 +0200)]
lavf/img2dec: Auto-detect Cintel scanner images.

3 years agoavcodec/mjpegdec: improve decoding of DNG files
Paul B Mahol [Sat, 3 Oct 2020 12:34:01 +0000 (14:34 +0200)]
avcodec/mjpegdec: improve decoding of DNG files

That have unused symbols coded in DHT.

3 years agoavcodec/tiff: do not abort decoding if strips are available
Paul B Mahol [Fri, 2 Oct 2020 10:16:49 +0000 (12:16 +0200)]
avcodec/tiff: do not abort decoding if strips are available

Even if such files are invalid, they can be decoded just fine.
Also stored tiles may have bigger dimensions than displayed ones,
so do not abort decoding in such cases.

3 years agoavcodec: add Cintel RAW decoder
Paul B Mahol [Thu, 1 Oct 2020 13:54:24 +0000 (15:54 +0200)]
avcodec: add Cintel RAW decoder

3 years agoavfilter/vf_v360: use quaternions for rotation
Paul B Mahol [Tue, 6 Oct 2020 11:51:52 +0000 (13:51 +0200)]
avfilter/vf_v360: use quaternions for rotation

Fixes gimbal lock issues, and round-off errors.

3 years agolibswcale/input: use more accurate planer rgb16 yuv conversions
Mark Reid [Sat, 3 Oct 2020 23:31:58 +0000 (16:31 -0700)]
libswcale/input: use more accurate planer rgb16 yuv conversions

These conversion appears to be exhibiting the same rounding error as the rgbf32 formats where.
I seperated the rounding value from the 16 and 128 offsets, I think it makes it a little more clear.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/av1dec: avoid probing with av1dec
James Almer [Tue, 6 Oct 2020 14:20:24 +0000 (11:20 -0300)]
avcodec/av1dec: avoid probing with av1dec

av1dec should no longer attempt to output empty frames if another decoder
was used for probing and it sucessfully set a pix_fmt ever since 05872c67a4,
so we can re-add the AV_CODEC_CAP_AVOID_PROBING cap.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavf/avs2dec.c: optimize code style
hwren [Mon, 5 Oct 2020 15:56:10 +0000 (23:56 +0800)]
lavf/avs2dec.c: optimize code style

Signed-off-by: hwren <hwrenx@126.com>
3 years agolavc/avs2_parser.c: optimize code style
hwren [Thu, 20 Aug 2020 06:58:52 +0000 (14:58 +0800)]
lavc/avs2_parser.c: optimize code style

Signed-off-by: hwren <hwrenx@126.com>
3 years agolavf/davs2.c: rename as avs2dec.c for better understanding
hwren [Thu, 20 Aug 2020 06:52:15 +0000 (14:52 +0800)]
lavf/davs2.c: rename as avs2dec.c for better understanding

Signed-off-by: hwren <hwrenx@126.com>
3 years agolavc/avs2_parser.c,lavf/davs2.c: add AVS2_* prefix
hwren [Thu, 20 Aug 2020 06:47:42 +0000 (14:47 +0800)]
lavc/avs2_parser.c,lavf/davs2.c: add AVS2_* prefix

Add AVS2_* prefix to macro definitions to avoid confusion

Signed-off-by: hwren <hwrenx@126.com>
3 years agolavc,doc: add libuavs3d video decoder wrapper
hwren [Mon, 5 Oct 2020 12:16:25 +0000 (20:16 +0800)]
lavc,doc: add libuavs3d video decoder wrapper

Signed-off-by: hbj <hanbj@pku.edu.cn>
Signed-off-by: hwren <hwrenx@126.com>
3 years agolavf/avs3dec: add raw avs3 demuxer
hwren [Mon, 5 Oct 2020 12:10:45 +0000 (20:10 +0800)]
lavf/avs3dec: add raw avs3 demuxer

Signed-off-by: hbj <hanbj@pku.edu.cn>
Signed-off-by: hwren <hwrenx@126.com>
3 years agolavc/avs3_parser: add avs3 parser
hwren [Mon, 5 Oct 2020 12:09:20 +0000 (20:09 +0800)]
lavc/avs3_parser: add avs3 parser

Signed-off-by: hbj <hanbj@pku.edu.cn>
Signed-off-by: hwren <hwrenx@126.com>
3 years agolavc/avs3.h: add AVS3 related definitions
hwren [Mon, 5 Oct 2020 12:08:06 +0000 (20:08 +0800)]
lavc/avs3.h: add AVS3 related definitions

Signed-off-by: hwren <hwrenx@126.com>
3 years agolavc: add AVS3 codec id and desc
hwren [Mon, 5 Oct 2020 12:07:01 +0000 (20:07 +0800)]
lavc: add AVS3 codec id and desc

Signed-off-by: hbj <hanbj@pku.edu.cn>
Signed-off-by: hwren <hwrenx@126.com>
3 years agoavcodec/h264_slice: use av_buffer_replace() to simplify code
James Almer [Mon, 28 Sep 2020 14:25:41 +0000 (11:25 -0300)]
avcodec/h264_slice: use av_buffer_replace() to simplify code

Based on eff289ce9f030f023e218ee7ce354d4f0e035b6d.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/movenc: Avoid allocation for timecode track
Andreas Rheinhardt [Mon, 28 Sep 2020 17:27:20 +0000 (19:27 +0200)]
avformat/movenc: Avoid allocation for timecode track

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/movenc: Don't forget to free fragment buffers
Andreas Rheinhardt [Mon, 28 Sep 2020 16:36:06 +0000 (18:36 +0200)]
avformat/movenc: Don't forget to free fragment buffers

The buffers used when fragmented output is enabled have up until now not
been freed in the deinit function; they leak e.g. if one errors out of
mov_write_trailer() before one reaches the point where they are normally
written out and freed. This can e.g. happen if allocating new vos_data
fails at the beginning of mov_write_trailer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/movenc: Free old vos_data before overwriting it
Andreas Rheinhardt [Mon, 28 Sep 2020 16:05:44 +0000 (18:05 +0200)]
avformat/movenc: Free old vos_data before overwriting it

Otherwise the old data leaks whenever extradata needs to be rewritten
(e.g. when encoding FLAC with our encoder that sends an updated
extradata packet at the end).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/movenc: Don't free AVCodecParameters manually
Andreas Rheinhardt [Mon, 28 Sep 2020 11:30:07 +0000 (13:30 +0200)]
avformat/movenc: Don't free AVCodecParameters manually

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/qsv: Fix leak of options on error
Andreas Rheinhardt [Sun, 27 Sep 2020 08:06:27 +0000 (10:06 +0200)]
avcodec/qsv: Fix leak of options on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/movenc: Make some AVCodecTag tables static
Andreas Rheinhardt [Wed, 30 Sep 2020 16:29:51 +0000 (18:29 +0200)]
avformat/movenc: Make some AVCodecTag tables static

They are not used anywhere else.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/movenc: Fix segfault when remuxing rtp hint stream
Andreas Rheinhardt [Tue, 29 Sep 2020 08:21:34 +0000 (10:21 +0200)]
avformat/movenc: Fix segfault when remuxing rtp hint stream

When remuxing an rtp hint stream (or any stream with the tag "rtp "),
the mov muxer treats this as one of the rtp hint tracks it creates
internally when ordered to do so; yet this track lacks the
AVFormatContext for the hinting rtp muxer, leading to segfaults in
mov_write_udta_sdp() if a "trak" atom is written for this stream; if not,
the stream's codecpar is freed by mov_free() as if the mov muxer owned
it (it does for the internally created "rtp " tracks), but without
resetting st->codecpar, leading to double-frees lateron. This commit
therefore ignores said tag which makes rtp hint streams unremuxable.

This fixes tickets #8181 and #8186.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/dvenc: Fix undefined left shift of negative numbers
Andreas Rheinhardt [Tue, 29 Sep 2020 12:58:24 +0000 (14:58 +0200)]
avcodec/dvenc: Fix undefined left shift of negative numbers

The earlier code was based on the assumption that AVFrame.linesize can
not be negative.

Fixes ticket #8280.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_v360: fix possible out of range values
Paul B Mahol [Sun, 4 Oct 2020 17:06:58 +0000 (19:06 +0200)]
avfilter/vf_v360: fix possible out of range values

3 years agoavfilter/vf_v360: add mitchell interpolation
Paul B Mahol [Sun, 4 Oct 2020 12:36:30 +0000 (14:36 +0200)]
avfilter/vf_v360: add mitchell interpolation

3 years agoavformat/moflex: Check m->size before seeking
Michael Niedermayer [Fri, 2 Oct 2020 12:59:15 +0000 (14:59 +0200)]
avformat/moflex: Check m->size before seeking

Fixes: Infinite loop
Fixes: 26016/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6195663833137152
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>
3 years agoavcodec/dxtory: Fix negative stride shift in dx2_decode_slice_420()
Michael Niedermayer [Fri, 2 Oct 2020 12:59:13 +0000 (14:59 +0200)]
avcodec/dxtory: Fix negative stride shift in dx2_decode_slice_420()

Fixes: left shift of negative value -640
Fixes: 26044/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXTORY_fuzzer-5631057602543616
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>
3 years agoavcodec/av1dec: partially clean state on frame decoding errors
James Almer [Sun, 4 Oct 2020 13:21:59 +0000 (10:21 -0300)]
avcodec/av1dec: partially clean state on frame decoding errors

Fixes: member access within null pointer of type 'TileGroupInfo' (aka 'struct TileGroupInfo')
Fixes: 25725/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5166692706287616
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat: add tri-ACE demuxer
Paul B Mahol [Thu, 24 Sep 2020 15:55:03 +0000 (17:55 +0200)]
avformat: add tri-ACE demuxer

3 years agoavformat/adxdec: demux multiple blocks at once
Paul B Mahol [Fri, 18 Sep 2020 10:08:42 +0000 (12:08 +0200)]
avformat/adxdec: demux multiple blocks at once

Improves decoding speed by 24x

3 years agolibwavpackenc: remove libwavpackenc wrapper
Lynne [Mon, 7 Sep 2020 00:41:19 +0000 (02:41 +0200)]
libwavpackenc: remove libwavpackenc wrapper

The manual states "there is virtually no reason to use that encoder.".

It supports less sample formats than the native encoder, is less efficient
than the native encoder and is also slower and pretty much remains untested.
libwavpack also isn't being fuzzed, which given that we plug the parameters
without any sanitizing them looks concerning.

3 years agoavformat/movenc: handle tracks w/o AVStreams in calculate_mpeg4_bit_rates
Jan Ekström [Mon, 28 Sep 2020 14:23:07 +0000 (17:23 +0300)]
avformat/movenc: handle tracks w/o AVStreams in calculate_mpeg4_bit_rates

The generated text streams for chapters lack an AVStream since they
are but an internal concept within movenc.

Fixes #8910

3 years agoavformat/asfdec_f: Change order or operations slightly
Michael Niedermayer [Sat, 12 Sep 2020 17:44:35 +0000 (19:44 +0200)]
avformat/asfdec_f: Change order or operations slightly

Fixes: signed integer overflow: 20 * 5184056935931942919 cannot be represented in type 'long'
Fixes: 25466/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4798660247552000
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/dxa: Use av_rescale() for duration computation
Michael Niedermayer [Wed, 2 Sep 2020 21:13:00 +0000 (23:13 +0200)]
avformat/dxa: Use av_rescale() for duration computation

Fixes: signed integer overflow: 8224000000 * 1629552639 cannot be represented in type 'long'
Fixes: 24908/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4658478506049536
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/vc1_block: Fix integer overflow in ac value
Michael Niedermayer [Wed, 2 Sep 2020 20:42:05 +0000 (22:42 +0200)]
avcodec/vc1_block: Fix integer overflow in ac value

Fixes: signed integer overflow: 25488 * 87381 cannot be represented in type 'int'
Fixes: 24765/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5108259565076480
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibswcale/input: use more accurate rgbf32 yuv conversions
Mark Reid [Tue, 29 Sep 2020 03:44:34 +0000 (20:44 -0700)]
libswcale/input: use more accurate rgbf32 yuv conversions

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibswscale/tests: add floatimg_cmp test
Mark Reid [Tue, 29 Sep 2020 03:44:33 +0000 (20:44 -0700)]
libswscale/tests: add floatimg_cmp test

changes since v1:
- made into fate test
- fixed c90 warnings
- tests more intermediate formats
- tested on BE mips too

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/rtsp: fix parse_rtsp_message
Zhao Zhili [Sun, 27 Sep 2020 11:50:27 +0000 (19:50 +0800)]
avformat/rtsp: fix parse_rtsp_message

1. Remove the assumption that the message method is TEARDOWN.
2. Don't ignore the error code of ff_rtsp_parse_streaming_commands.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 years agortsp: Fix infinite loop in listen mode with UDP transport
Martin Storsjö [Wed, 30 Sep 2020 09:27:00 +0000 (12:27 +0300)]
rtsp: Fix infinite loop in listen mode with UDP transport

In listen mode with UDP transport, once the sender has sent
the TEARDOWN and closed the connection, poll will indicate that
one can read from the connection (indicating that the socket has
reached EOF and should be closed by the receiver as well). In this
case, parse_rtsp_message won't try to parse the command (because
it's no longer in state STREAMING), but previously just returned
zero.

Prior to f6161fccf8c5720ceac1ed1df8ba60ff8fed69f5, this caused
udp_read_packet to return zero, which is treated as EOF by
read_packet. But after that commit, udp_read_packet would continue
if parse_rtsp_message didn't return an explicit error code.

To keep the original behaviour from before that commit, more
explicitly return an error in parse_rtsp_message when in the wrong
state.

Fixes: #8840
Signed-off-by: Martin Storsjö <martin@martin.st>
3 years agoavutil/pixdesc: add missing FF_API_PSEUDOPAL check
James Almer [Fri, 2 Oct 2020 03:18:13 +0000 (00:18 -0300)]
avutil/pixdesc: add missing FF_API_PSEUDOPAL check

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/utils: add missing FF_API_LAVF_AVCTX check
James Almer [Fri, 2 Oct 2020 01:47:51 +0000 (22:47 -0300)]
avformat/utils: add missing FF_API_LAVF_AVCTX check

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/sdp: add missing FF_API_LAVF_AVCTX check
James Almer [Fri, 2 Oct 2020 01:45:34 +0000 (22:45 -0300)]
avformat/sdp: add missing FF_API_LAVF_AVCTX check

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/utils: add missing FF_API_TAG_STRING check
James Almer [Fri, 2 Oct 2020 01:43:28 +0000 (22:43 -0300)]
avcodec/utils: add missing FF_API_TAG_STRING check

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/options: add missing FF_API_COPY_CONTEXT checks
James Almer [Fri, 2 Oct 2020 01:43:03 +0000 (22:43 -0300)]
avcodec/options: add missing FF_API_COPY_CONTEXT checks

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/libvpxenc: add missing FF_API_ERROR_FRAME check
James Almer [Fri, 2 Oct 2020 01:42:37 +0000 (22:42 -0300)]
avcodec/libvpxenc: add missing FF_API_ERROR_FRAME check

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cuviddec: avoid copy of uninitialized extradata pointer
Timo Rothenpieler [Thu, 1 Oct 2020 19:09:34 +0000 (21:09 +0200)]
avcodec/cuviddec: avoid copy of uninitialized extradata pointer

3 years agoavcodec/cuviddec: use correct type for extradata_size
Timo Rothenpieler [Thu, 1 Oct 2020 18:49:59 +0000 (20:49 +0200)]
avcodec/cuviddec: use correct type for extradata_size

3 years agoavcodec/cuviddec: fix copy&paste error
Timo Rothenpieler [Thu, 1 Oct 2020 18:20:48 +0000 (20:20 +0200)]
avcodec/cuviddec: fix copy&paste error

3 years agoavformat/movenc: Fix stack overflow when remuxing timecode tracks
Andreas Rheinhardt [Wed, 30 Sep 2020 12:36:23 +0000 (14:36 +0200)]
avformat/movenc: Fix stack overflow when remuxing timecode tracks

There are two possible kinds of timecode tracks (with tag "tmcd") in the
mov muxer: Tracks created internally by the muxer and timecode tracks
sent by the user. If any of the latter exists, the former are
deactivated. The former all belong to another track, the source
track; the latter don't have a source track set, but the index of the
source track is initially zeroed by av_mallocz_array(). This is a
problem since 3d894db700cc1e360a7a75ab9ac8bf67ac6670a3: Said commit added
a function that calculates the duration of tracks and the duration of
timecode tracks is calculated by rescaling the duration (calculated by
the very same function) of the source track. This gives an infinite
recursion if the first track (the one that will be treated as source
track for all timecode tracks) is a timecode track itself, leading to a
stack overflow.

This commit fixes this by not using the nonexistent source track
when calculating the duration of timecode tracks not created internally
by the mov muxer.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/utils: Reindentation
Andreas Rheinhardt [Thu, 24 Sep 2020 21:59:15 +0000 (23:59 +0200)]
avcodec/utils: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/utils: Also free encoder extradata on avcodec_open2() error
Andreas Rheinhardt [Sat, 26 Sep 2020 09:18:13 +0000 (11:18 +0200)]
avcodec/utils: Also free encoder extradata on avcodec_open2() error

It is owned by libavcodec for encoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/utils: Don't forget cleaning up when allocating priv_data fails
Andreas Rheinhardt [Thu, 24 Sep 2020 21:54:17 +0000 (23:54 +0200)]
avcodec/utils: Don't forget cleaning up when allocating priv_data fails

Allocating an AVCodecContext's priv_data used to be the first object
allocated in avcodec_open2(), so it was unnecessary to goto free_and_end
(which does the cleanup) upon error here. But this is no longer so since
f3a29b750a5979ae6847879fba758faf1fae88d0.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/utils: Improve check for freeing codec private options
Andreas Rheinhardt [Thu, 24 Sep 2020 21:41:24 +0000 (23:41 +0200)]
avcodec/utils: Improve check for freeing codec private options

Don't check for AVCodec.priv_data_size (which is always true if
AVCodec.priv_class is set). Instead check for AVCodecContext.priv_data
to actually exist.

(Note: av_opt_free(NULL) is a no-op.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/utils: Remove always-true check
Andreas Rheinhardt [Thu, 24 Sep 2020 21:24:20 +0000 (23:24 +0200)]
avcodec/utils: Remove always-true check

The first thing avcodec_open2() allocates is the AVCodecInternal. If
allocating it fails, a jump to end occurs; but if an error happens after
its allocation, a jump to free_and_end happens which frees all
allocations performed so far and then jumps to end. Yet free_and_end
contained a check for AVCodecInternal (after having already dereferenced
it to check whether ff_thread_free() needs to be called) which is of
course always true. So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoopusdec: do not fail when LBRR frames are present
Anton Khirnov [Fri, 11 Sep 2020 17:32:43 +0000 (19:32 +0200)]
opusdec: do not fail when LBRR frames are present

Decode and discard them.

Fixes ticket 4641.

3 years agofate: add scale filters for big-endian architectures.
Nicolas George [Mon, 14 Sep 2020 19:23:20 +0000 (21:23 +0200)]
fate: add scale filters for big-endian architectures.

Filters mostly work in native endianness, but they must output
a specified endianness, usually little: that requires a final
conversion for big endian.

I do not know what's the deal with gif-deal: inserting explicitly
the filters that are implicitly inserted result in less frames in
output. Probably a strange problem of duration.

3 years agoswresample/audioconvert: Fix left shift of negative value
Andreas Rheinhardt [Tue, 29 Sep 2020 14:06:31 +0000 (16:06 +0200)]
swresample/audioconvert: Fix left shift of negative value

Fixes ticket #8219.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/av1dec: call ff_cbs_flush() on decoder flush
James Almer [Thu, 24 Sep 2020 21:54:14 +0000 (18:54 -0300)]
avcodec/av1dec: call ff_cbs_flush() on decoder flush

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/av1dec: fix check for active sequence header
James Almer [Fri, 25 Sep 2020 14:05:30 +0000 (11:05 -0300)]
avcodec/av1dec: fix check for active sequence header

We clear the AV1RawSequenceHeader pointer on flush, not the relevant AVBufferRef.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/av1dec: parse dimensions from the sequence header in extradata
James Almer [Fri, 25 Sep 2020 14:20:41 +0000 (11:20 -0300)]
avcodec/av1dec: parse dimensions from the sequence header in extradata

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cbs_vp9: implement a CodedBitstreamType.flush() callback
James Almer [Fri, 25 Sep 2020 03:04:15 +0000 (00:04 -0300)]
avcodec/cbs_vp9: implement a CodedBitstreamType.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cbs_h2645: implement CodedBitstreamType.flush() callbacks
James Almer [Thu, 24 Sep 2020 21:19:05 +0000 (18:19 -0300)]
avcodec/cbs_h2645: implement CodedBitstreamType.flush() callbacks

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cbs_av1: implement a CodedBitstreamType.flush() callback
James Almer [Thu, 24 Sep 2020 21:06:35 +0000 (18:06 -0300)]
avcodec/cbs_av1: implement a CodedBitstreamType.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cbs: add a flush callback to CodedBitstreamType
James Almer [Thu, 24 Sep 2020 20:57:42 +0000 (17:57 -0300)]
avcodec/cbs: add a flush callback to CodedBitstreamType

Used to reset the codec's private internal state.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/vf_v360: stop using floats variables in xyz_to_octahedron
Paul B Mahol [Tue, 29 Sep 2020 22:05:02 +0000 (00:05 +0200)]
avfilter/vf_v360: stop using floats variables in xyz_to_octahedron

Use proper integer variables.

3 years agoavcodec/cuviddec: handle arbitrarily sized extradata
Timo Rothenpieler [Tue, 29 Sep 2020 21:19:23 +0000 (23:19 +0200)]
avcodec/cuviddec: handle arbitrarily sized extradata

3 years agoavcodec/utils: Only call codec->close if init has been called
Andreas Rheinhardt [Thu, 24 Sep 2020 21:05:29 +0000 (23:05 +0200)]
avcodec/utils: Only call codec->close if init has been called

avcodec_open2() also called the AVCodec's close function if an error
happened before init had ever been called if the AVCodec has the
FF_CODEC_CAP_INIT_CLEANUP flag set. This is against the documentation of
said flag: "The codec allows calling the close function for deallocation
even if the init function returned a failure."

E.g. the SVQ3 decoder is not ready to be closed if init has never been
called.

Fixes: NULL dereference
Fixes: 25762/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5716279070294016
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoRevert "avfilter/setparams: add FF_FILTER_FLAG_HWFRAME_AWARE"
Mark Thompson [Tue, 29 Sep 2020 16:01:22 +0000 (17:01 +0100)]
Revert "avfilter/setparams: add FF_FILTER_FLAG_HWFRAME_AWARE"

This reverts commit 5bbf58ab876279ca1a5a2f30563f271c99b93e62.

The setparams filters are not hwframe aware, so the default context
passthrough behaviour is needed to allow using them with hardware frames.

3 years agoavfilter/vf_v360: simplify input flipping
Paul B Mahol [Tue, 29 Sep 2020 12:16:32 +0000 (14:16 +0200)]
avfilter/vf_v360: simplify input flipping

3 years agoavfilter/vf_v360: split maps into slices
Paul B Mahol [Tue, 29 Sep 2020 08:48:54 +0000 (10:48 +0200)]
avfilter/vf_v360: split maps into slices

3 years agodnn/native: add native support for dense
Mingyu Yin [Tue, 22 Sep 2020 07:11:09 +0000 (15:11 +0800)]
dnn/native: add native support for dense

Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
3 years agolibavcodec/videotoolboxenc: Fix crash when frame received after error
Rick Kern [Tue, 29 Sep 2020 01:47:29 +0000 (21:47 -0400)]
libavcodec/videotoolboxenc: Fix crash when frame received after error

Signed-off-by: Rick Kern <kernrj@gmail.com>
3 years agoavcodec/videotoolboxenc: move pthread_cond_signal after add buffer to the queue
Tian Qi [Fri, 28 Aug 2020 01:13:02 +0000 (09:13 +0800)]
avcodec/videotoolboxenc: move pthread_cond_signal after add buffer to the queue

In the VT encoding insertion by FFmpeg,
and vtenc_q_push is callback to add the encoded data
to the singly linked list group in VTEncContext,
and consumers are notified to fetch it.
However, because it first informs consumers of pthread_cond_signal,
and then inserts the data into the tail,
there is a multi-thread safety hazard.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Rick Kern <kernrj@gmail.com>
3 years agoavcodec/videotoolboxenc: don't wait when flushing data
Tian Qi [Thu, 27 Aug 2020 02:53:27 +0000 (10:53 +0800)]
avcodec/videotoolboxenc: don't wait when flushing data

because there is run in thread mode, few times will block
the workflow at the wait, so check the status is flushing data,
don't wait when flushing data.

Signed-off-by: Tian Qi <tianqi@kuaishou.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Rick Kern <kernrj@gmail.com>
3 years agoavcodec/videotoolboxenc: fix use after destroy
Zhao Zhili [Wed, 26 Aug 2020 21:38:45 +0000 (05:38 +0800)]
avcodec/videotoolboxenc: fix use after destroy

The lock is used in clear_frame_queue().

Signed-off-by: Rick Kern <kernrj@gmail.com>
3 years agoavcodec/videotoolboxenc: fix align issue
Zhao Zhili [Wed, 26 Aug 2020 21:38:44 +0000 (05:38 +0800)]
avcodec/videotoolboxenc: fix align issue

bool a53_cc is accessed as int:
src/libavutil/opt.c:129:9: runtime error: store to misaligned
address 0x7fbf454121a3 for type 'int', which requires 4 byte alignment

Signed-off-by: Rick Kern <kernrj@gmail.com>