Commit Graph

100620 Commits

Author SHA1 Message Date
Bas Nieuwenhuizen 4386060164 kmsgrab: Do not require the modifier to stay constant.
As we get a new set of objects each frame anyway, we
do not gain anything by keeping the modifier constant.

This helps with capturing when switching your setup a
bit, e.g. from ingame to desktop or from X11 to wayland.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2021-01-13 23:08:02 +00:00
Bas Nieuwenhuizen 03f4b203ba kmsgrab: Use invalid modifier if modifiers weren't used.
The kernel defaults to initializing the field to 0 when modifiers
are not used and this happens to be linear. If we end up actually
passing the modifier to a driver, tiling issues happen.

So if the kernel doesn't return a modifier set it explicitly to
INVALID. That way later processing knows there is no explicit
modifier.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2021-01-13 23:07:36 +00:00
Lynne 06a8596825
lavu: support arbitrary-point FFTs and all even (i)MDCT transforms
This patch adds support for arbitrary-point FFTs and all even MDCT
transforms.
Odd MDCTs are not supported yet as they're based on the DCT-II and DCT-III
and they're very niche.

With this we can now write tests.
2021-01-13 17:34:13 +01:00
AlexisWilke ca21cb1e36 avformat/allformats: test pointer to be used
Two tests check the opposite pointer before using it. If only one of these
is set to a valid pointer, one of these functions will crash, the other will
ignore the pointer.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-01-12 00:17:30 -03:00
Michael Niedermayer 88519be8db avformat/mxfdec: Free all types for both Descriptors
Fixes: memleak
Fixes: 26352/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5201158714687488

Suggested-by: Tomas Härdin <tjoppen@acc.umu.se>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-11 23:23:36 +01:00
Michael Niedermayer 90e4862ffa avutil/eval: Unconditionally check argument of e_div
Fixes: division by zero
Fixes: 26451/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVO_fuzzer-4756955832516608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-11 23:21:05 +01:00
Michael Niedermayer b0259aa248 avformat/utils: wrap_timestamp() is only needed for less than 64 bits
Fixes: shift exponent 64 is too large for 64-bit type 'unsigned long long'
Fixes: 26497/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-5690188355076096
Fixes: 26903/clusterfuzz-testcase-minimized-ffmpeg_dem_LUODAT_fuzzer-5641466929741824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-11 23:17:36 +01:00
Michael Niedermayer fcc263caa9 avformat/aaxdec: Check string before strcmp()
Fixes: NULL ptr dereference
Fixes: 26508/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-5694725249826816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-11 23:15:04 +01:00
Michael Niedermayer 7186ec88b9 uavformat/rsd: check for EOF in extradata
Fixes: OOM
Fixes: 26503/clusterfuzz-testcase-minimized-ffmpeg_dem_RSD_fuzzer-6530816735444992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-11 23:15:04 +01:00
Nuo Mi 2ad21ee9d4 avcodec/cbs_h2645: Move zero_byte check to its own function
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2021-01-11 21:34:43 +00:00
Nuo Mi 71de4ebede avcodec/cbs_h265: fix undef SEI_TYPE_X
Signed-off-by: James Almer <jamrial@gmail.com>
2021-01-11 17:03:15 -03:00
Nuo Mi ebdd33086a avcodec: add vvc codec id and profiles
Signed-off-by: James Almer <jamrial@gmail.com>
2021-01-11 17:01:34 -03:00
James Almer 9219ed213d avcodec/cbs: constify decompose_unit_types
CBS doesn't change its contents in any way whatsoever internally, and most
users already set it to a const array.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-01-10 19:23:07 -03:00
Paul B Mahol a0acc44106 avfilter/vf_convolution: use correct stride variable 2021-01-10 17:27:27 +01:00
Gyan Doshi 0fff6c039c doc/ffmpeg: document max_error_rate 2021-01-10 19:14:37 +05:30
Marton Balint 2e2891383e avformat: remove some mpegts details from AVStream
These fields were added to support -merge_pmt_versions, but the mpegts demuxer
is also keeping track its programs internally, so that should be a better place
to handle it.

Also it is not a very good idea to keep fields like program_num or
pmt_stream_idx in an AVStream, because a single stream can be part of multiple
programs, multiple PMTs, so the stream attributes can refer to any program the
stream is part of.

Since they are not part of public API, lets simply remove them, or rather
replace them with placeholders for ABI compatibility with libavdevice.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 22:38:12 +01:00
Marton Balint e57879ec18 avformat/mpegts: use stream index based lookup with merge_pmt_versions if stream identifier matches multiple streams
Also make sure we are checking the old state of the streams because otherwise
some streams might already have the newly parsed stream identifiers which
corrupts matching.

Fixes streams having the same identifier mixed up on pmt version change.

Fixes ticket #9006.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 22:38:12 +01:00
Marton Balint f143a6c151 avformat/mpegts: only clear programs which no longer exist or have a new PMT
Otherwise there can be a small period when the programs only contain the PMT
pid.

Also make sure skip_clear only affects AVProgram clear, and that pmt_pid is
always kept as the first entry of the PID list of the programs. Also reject
PMTs for programs on the wrong PID.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 22:38:12 +01:00
Marton Balint 10c8e53294 avformat/mpegts: rework clearing and adding pid to program
And use better function names.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 22:38:12 +01:00
Marton Balint 5ea37923a8 avformat/mpegts: never discard PAT pid
PID 0 was removed from the pid list when then PMT was parsed, it is better
to explictly avoid it from being discarded instead of keeing it in the list of
every program.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 22:38:12 +01:00
Marton Balint 9298e8eb61 avformat/utils: do not overwrite already existing program with defaults in av_new_program
av_new_program returns the existing program if that already exists, in that
case it makes no sense to overwrite existing attributes.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 22:38:12 +01:00
Lynne 91e1625db1
lavu/tx: clip when converting table values to fixed-point
INT32_MAX (2147483647) isn't exactly representable by a floating point
value, with the closest being 2147483648.0. So when rescaling a value
of 1.0, this could overflow when casting the 64-bit value returned from
lrintf() into 32 bits.
Unfortunately the properties of integer overflows don't match up well
with how a Fourier Transform operates. So clip the value before
casting to a 32-bit int.

Should be noted we don't have overflows with the table values we're
currently using. However, converting a Kaiser-Bessel window function
with a length of 256 and a parameter of 5.0 to fixed point did create
overflows. So this is more of insurance to save debugging time
in case something changes in the future.
The macro is only used during init, so it being a little slower is
not a problem.
2021-01-09 20:54:56 +01:00
Arnaud Vrac 29993b2947 sbc: do not set sample format in parser
Commit bdd31feec9 changed the SBC decoder to only set the output
sample format on init, instead of setting it explicitly on each frame,
which is correct. But the SBC parser overrides the sample format to S16,
which triggers a crash when combining the parser and the decoder.

Fix the issue by not setting the sample format anymore in the parser,
which is wrong.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-01-09 15:24:32 -03:00
Christopher Degawa eacad3406e avdevice/decklink_dec: mark get_frame_timecode and get_bmd_timecode static
The function is not used anywhere else and is causing mingw-w64 clang
builds to fail with

ffmpeg-git/libavdevice/decklink_dec.cpp:792:5: error: no previous prototype for function 'get_bmd_timecode' [-Werror,-Wmissing-prototypes]
int get_bmd_timecode(AVFormatContext *avctx, AVTimecode *tc, AVRational frame_rate, BMDTimecodeFormat tc_format, IDeckLinkVideoInputFrame *videoFrame)

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 17:37:02 +01:00
Matthieu Bouron 2e17435480 avformat/mov: adjust skip_samples according to seek timestamp
Currently skip_samples is set to start_pad if sample_time is lesser or
equal to 0. This can cause issues if the stream starts with packets that
have negative pts. Calling avformat_seek_file() with ts set to 0 on such
streams makes the mov demuxer return the right corresponding packets
(near the 0 timestamp) but set skip_samples to start_pad which is
incorrect as the audio decoder will discard the returned samples
according to skip_samples from the first packet it receives (which has
its timestamp near 0).

For example, considering the following audio stream with start_pad=1344:

 [PKT pts=-1344] [PKT pts=-320] [PKT pts=704] [PKT pts=1728] [...]

Calling avformat_seek_file() with ts=0 makes the next call to
av_read_frame() return the packet with pts=-320 and a skip samples
side data set to 1344 (start_pad). This makes the audio decoder
incorrectly discard (1344 - 320) samples.

This commit makes the move demuxer adjust skip_samples according to the
stream start_pad, seek timestamp and first sample timestamp.

The above example will now result in av_read_frame() still returning the
packet with pts=-320 but with a skip samples side data set to 320
(src_pad - (seek_timestamp - first_timestamp)). This makes the audio
decoder only discard 320 samples (from pts=-320 to pts=0).

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 17:08:27 +01:00
Lingjiang Fang c4407a3e00 doc/protocols: explain tcp listen option description
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 17:08:27 +01:00
Timo Rothenpieler 7a2d94cf1a avcodec/nvenc: fix timestamp offset ticks logic 2021-01-09 16:34:59 +01:00
Andreas Rheinhardt 42ee3898c8 avcodec/ac3dec: Make decoders init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-09 04:06:32 +01:00
Andreas Rheinhardt 10663312de avcodec/ac3dec: Check operations that can fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-09 04:06:32 +01:00
Andreas Rheinhardt 277281ac8e avcodec/ac3enc: Factor common end of float/fixed encode_frame out
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-09 04:06:32 +01:00
Andreas Rheinhardt 49a12ac4af avcodec/ac3enc_template: Perform compile-time checks at compile-time
Runtime checks for whether the encoder is fixed-point or not are
unnecessary here as this is a template; furthermore, there is no
fixed-point EAC-3 encoder, so some checks for whether one is in EAC-3
mode can be omitted when doing fixed-point encoding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-09 04:06:31 +01:00
Andreas Rheinhardt 496ff9f2e5 avcodec/[e]ac3enc: Don't invade CONFIG_ namespace
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-09 04:06:31 +01:00
Andreas Rheinhardt 953924781e avcodec/ac3enc: Set function pointers earlier
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-09 04:06:31 +01:00
Andreas Rheinhardt 505d4de064 avcodec/[e]ac3enc: Make encoders init-threadsafe, fix race
ff_eac3_exponent_init() set values twice when initializing a static
table; ergo the initialization code must not run concurrently with
a running EAC-3 encoder. Yet this code is executed every time an EAC-3
encoder is initialized. So use ff_thread_once() for this and also for a
similar initialization performed for all AC-3 encoders to make them all
init-threadsafe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-09 04:06:31 +01:00
Michael Niedermayer 69aeba8a19 avcodec/wmaprodec: Check packet size
Fixes: left shift of negative value -25824
Fixes: 27754/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5760255962906624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-08 18:08:57 +01:00
Michael Niedermayer 0a0b92b4b2 avformat/dhav: Check position for overflow
Fixes: signed integer overflow: 9223372036854775807 + 32768 cannot be represented in type 'long'
Fixes: 27744/clusterfuzz-testcase-minimized-ffmpeg_dem_DHAV_fuzzer-5179319491756032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-08 18:08:57 +01:00
Michael Niedermayer 380a3a0adf avcodec/rasc: Check frame before clearing
Fixes: null pointer dereference
Fixes: 27737/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5769028685266944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-08 18:08:56 +01:00
Michael Niedermayer ac5a568e6d avformat/utils: Change compute_chapters_end() from O(n²) to O(n log n)
Fixes: Timeout (49sec -> 9sec)
Fixes: 27427/clusterfuzz-testcase-minimized-ffmpeg_dem_FFMETADATA_fuzzer-5140589838073856

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-08 18:02:55 +01:00
Andreas Rheinhardt a454a0c14f avcodec/fft_template: Only check for FF_FFT_PERM_AVX on ARCH_X86
Also do it for FFT_FLOAT only, as this is the only combination for which
it can be set.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 06:52:51 +01:00
Andreas Rheinhardt 482aeda8bf avfilter/vsrc_testsrc: Deduplicate options
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 06:08:03 +01:00
Andreas Rheinhardt 6fed8a6cb0 avfilter/af_biquads: Don't redundantly set AVClass
It is already set generically in ff_filter_alloc().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:12 +01:00
Andreas Rheinhardt 2d48b69b3d avfilter/af_biquads: Deduplicate options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:12 +01:00
Andreas Rheinhardt a6fa1838e6 avfilter/vf_blend: Deduplicate options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:12 +01:00
Andreas Rheinhardt c51887c56a avfilter/af_asupercut: Deduplicate options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:12 +01:00
Andreas Rheinhardt d1de1d95a6 avfilter/vf_neighbor: Deduplicate options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:12 +01:00
Andreas Rheinhardt 096cb41624 avfilter/vf_convolution: Deduplicate filter options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:11 +01:00
Andreas Rheinhardt cb4c3b6162 avformat/hashenc: Deduplicate (stream)hash options
Also saves relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:11 +01:00
Andreas Rheinhardt 5e11dcf52f avcodec/wavpack: Deduplicate exp and log tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:11 +01:00
Andreas Rheinhardt ac0e75b647 avformat/mxf: Deduplicate random_index_pack_key
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:05:13 +01:00
Andreas Rheinhardt a91b18f368 avfilter/vf_qp: Deduplicate variable names arrays
This also avoids relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:05:10 +01:00