]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agolavc: drop ff_ prefix from ff_(un)lock_avcodec
Anton Khirnov [Wed, 10 Mar 2021 08:01:00 +0000 (09:01 +0100)]
lavc: drop ff_ prefix from ff_(un)lock_avcodec

It is unnecessary and misleading, as those are static functions.

3 years agolavc: move decoder bsf init into decoder-specific code
Anton Khirnov [Tue, 9 Mar 2021 11:00:09 +0000 (12:00 +0100)]
lavc: move decoder bsf init into decoder-specific code

3 years agolavc: factor decoder validation/setup from avcodec_open2()
Anton Khirnov [Tue, 9 Mar 2021 10:35:47 +0000 (11:35 +0100)]
lavc: factor decoder validation/setup from avcodec_open2()

3 years agolavc/encode: reindent after previous commit
Anton Khirnov [Tue, 9 Mar 2021 10:39:42 +0000 (11:39 +0100)]
lavc/encode: reindent after previous commit

3 years agolavc: factor out encoder init/validation from avcodec_open2()
Anton Khirnov [Tue, 9 Mar 2021 10:35:47 +0000 (11:35 +0100)]
lavc: factor out encoder init/validation from avcodec_open2()

avcodec_open2() is massive, splitting it makes it more readable.

Also, add a missing error code to ticks_per_frame sanity check.

3 years agocmdutils: replace strncpy() with direct assignment
Anton Khirnov [Wed, 24 Feb 2021 10:19:27 +0000 (11:19 +0100)]
cmdutils: replace strncpy() with direct assignment

Only one character is actually rewritten.

Fixes truncation warnings, such as
warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation]
in gcc 10.2.0

3 years agolavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS
Anton Khirnov [Tue, 9 Mar 2021 17:35:56 +0000 (18:35 +0100)]
lavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS

This cap is currently used to mark multithreading-capable codecs that
wrap external libraries with their own multithreading code. The name is
highly confusing for our API users, since libavcodec ALWAYS handles
thread_count=0 (see commit message in previous commit). Therefore rename
the cap and update its documentation to make its meaning clear.

The old name is kept deprecated until next+1 major bump.

3 years agolavc: replace internal use of AV_CODEC_CAP_AUTO_THREADS with an internal cap
Anton Khirnov [Tue, 9 Mar 2021 17:00:44 +0000 (18:00 +0100)]
lavc: replace internal use of AV_CODEC_CAP_AUTO_THREADS with an internal cap

AV_CODEC_CAP_AUTO_THREADS was originally added in b4d44a45f9a to mark
codecs that spawn threads internally and are able to select an optimal
threads count by themselves (all such codecs are wrappers around
external libraries). It is used by lavc generic code to check whether it
should handle thread_count=0 itself or pass the zero directly to the
codec implementation. Within this meaning, it is clearly supposed to be
an internal cap rather than a public one, since from the viewpoint of a
libavcodec user, lavc ALWAYS handles thread_count=0. Whether it happens
in the generic code or within the codec internals is not a meaningful
difference for the caller.

External aspects of this flag will be dealt with in the following
commit.

3 years agodoc/encoders: Remove text about single bit-depth libx264 support
Tobias Rapp [Mon, 15 Mar 2021 13:07:27 +0000 (14:07 +0100)]
doc/encoders: Remove text about single bit-depth libx264 support

In the meanwhile libx264 allows to be configured for including both 8/10 bit
support within a single library. The new libx264 interface was enabled in
2f96190732d15510ba29471fa45d66841c0c3df1.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
3 years agoavformat/matroskadec: Check for EOF in resync loop
Michael Niedermayer [Fri, 29 Jan 2021 20:18:36 +0000 (21:18 +0100)]
avformat/matroskadec: Check for EOF in resync loop

Fixes: Timeout (too long -> instantly)
Fixes: 29136/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4586141227548672
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
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/utils: Use more bits for intermediate for AV_CODEC_ID_ADPCM_MS
Michael Niedermayer [Mon, 1 Feb 2021 18:55:03 +0000 (19:55 +0100)]
avcodec/utils: Use more bits for intermediate for AV_CODEC_ID_ADPCM_MS

Fixes: signed integer overflow: 1172577312 * 2 cannot be represented in type 'int'
Fixes: 29924/clusterfuzz-testcase-minimized-ffmpeg_dem_BOA_fuzzer-4882912874594304
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/ipmovie: Free packets allocated in header reading
Michael Niedermayer [Mon, 1 Feb 2021 18:47:16 +0000 (19:47 +0100)]
avformat/ipmovie: Free packets allocated in header reading

Fixes: memleaks
Fixes: 29905/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5679700745781248
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 agolibavformat/hls: Reset options after open_url_keepalive() fails
Ed Martin [Wed, 10 Mar 2021 21:43:10 +0000 (21:43 +0000)]
libavformat/hls: Reset options after open_url_keepalive() fails

open_url_keepalive() unsets the options when it uses them, this
includes the offsets for the Range: header. When using the HLS
tag #EXT-X-BYTERANGE along with multiple files, the range options
must be preserved after open_url_keepalive() returns EOF so that
the new file can be opened. Failure to do this results in ignoring
the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file.

To fix it, reset the options before calling io_open() following
open_url_keepalive() reaching EOF

Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
3 years agoavcodec/decode: Remove outdated comment
Andreas Rheinhardt [Sat, 13 Mar 2021 00:24:08 +0000 (01:24 +0100)]
avcodec/decode: Remove outdated comment

Removing it was forgotten in 417d473bde220a1f267bc694835c129a5adc4309.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavutil/avstring: Check for memory allocation error in av_escape
Andreas Rheinhardt [Tue, 9 Mar 2021 20:25:06 +0000 (21:25 +0100)]
avutil/avstring: Check for memory allocation error in av_escape

av_bprint_finalize() can still fail even when it has been checked that
the AVBPrint is currently complete: Namely if the string was so short
that it fit into the AVBPrint's internal buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavutil/avstring: Limit string length in av_escape to range of int
Andreas Rheinhardt [Tue, 9 Mar 2021 20:17:12 +0000 (21:17 +0100)]
avutil/avstring: Limit string length in av_escape to range of int

Otherwise the caller can't distinguish the return value from an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/h264_cavlc: Reindent after the previous commit
Andreas Rheinhardt [Tue, 9 Mar 2021 19:34:53 +0000 (20:34 +0100)]
avcodec/h264_cavlc: Reindent after the previous commit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/h264_cavlc: Remove redundant check
Andreas Rheinhardt [Tue, 9 Mar 2021 19:25:06 +0000 (20:25 +0100)]
avcodec/h264_cavlc: Remove redundant check

The only caller to ff_h264_decode_init_vlc() already uses
ff_thread_once() for the call; ergo the check via a simple int with
static storage duration in ff_h264_decode_init_vlc() is redundant.
And if it were not redundant, it would be a potential for data races.
So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodoc/APIchanges: Fill in some missing information
Michael Niedermayer [Wed, 10 Mar 2021 17:42:53 +0000 (18:42 +0100)]
doc/APIchanges: Fill in some missing information

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/jpegls: Check A[Q] for overflow in ff_jpegls_update_state_regular()
Michael Niedermayer [Tue, 2 Mar 2021 19:07:13 +0000 (20:07 +0100)]
avcodec/jpegls: Check A[Q] for overflow in ff_jpegls_update_state_regular()

Fixes: Timeout
Fixes: 30912/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5556235476795392
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/voc_packet: prevent remaining size from becoming negative in ff_voc_get_packet()
Michael Niedermayer [Tue, 2 Mar 2021 19:47:06 +0000 (20:47 +0100)]
avformat/voc_packet: prevent remaining size from becoming negative in ff_voc_get_packet()

Fixes: memleak
Fixes: 30909/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4886284057313280
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 agoavutil/timecode: Avoid fps overflow
Michael Niedermayer [Mon, 1 Mar 2021 12:44:12 +0000 (13:44 +0100)]
avutil/timecode: Avoid fps overflow

Fixes: Integer overflow and division by 0
Fixes: poc-202102-div.mov
Found-by: 1vanChen of NSFOCUS Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mvi: Check audio size for more overflows
Michael Niedermayer [Mon, 22 Feb 2021 19:20:48 +0000 (20:20 +0100)]
avformat/mvi: Check audio size for more overflows

Fixes: left shift of negative value -352256000
Fixes: 30837/clusterfuzz-testcase-minimized-ffmpeg_dem_MVI_fuzzer-5755626262888448
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/samidec: Deallocate hdr_buf
Michael Niedermayer [Mon, 22 Feb 2021 19:44:36 +0000 (20:44 +0100)]
avformat/samidec: Deallocate hdr_buf

Fixes: memleak
Fixes: 30841/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4521799196999680
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/cfhd: Fix negative shift in cfhd_decode()
Michael Niedermayer [Tue, 16 Feb 2021 23:02:04 +0000 (00:02 +0100)]
avcodec/cfhd: Fix negative shift in cfhd_decode()

Fixes: left shift of negative value -1
Fixes: 30714/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4867823371419648
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 agoavdevice/xcbgrab: Add option for grabbing a window
sgerwk [Wed, 10 Feb 2021 16:36:00 +0000 (17:36 +0100)]
avdevice/xcbgrab: Add option for grabbing a window

The option allows to select a specific window instead of the whole
screen.

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavcodec: add a mention about get_encode_buffer in the old encode API doxy
James Almer [Wed, 10 Mar 2021 01:24:16 +0000 (22:24 -0300)]
avcodec: add a mention about get_encode_buffer in the old encode API doxy

Direct users to the callback that should be used to keep supporting user
provided buffers with the new encode API.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/vf_xfade: drop unused frames from inactive inputs
Paul B Mahol [Sun, 14 Mar 2021 12:06:50 +0000 (13:06 +0100)]
avfilter/vf_xfade: drop unused frames from inactive inputs

3 years agodoc/filters: note default for zoompan's duration
Gyan Doshi [Sun, 14 Mar 2021 08:37:24 +0000 (14:07 +0530)]
doc/filters: note default for zoompan's duration

3 years agoavcodec/flacdec: Avoid undefined shift in error case
Michael Niedermayer [Mon, 8 Mar 2021 23:55:38 +0000 (00:55 +0100)]
avcodec/flacdec: Avoid undefined shift in error case

Fixes: flac_1040988
Reported-by: Thomas Guilbert <tguilbert@google.com>
Reviewed-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/cinedec: Fix index_entries size check
Michael Niedermayer [Sun, 31 Jan 2021 21:42:54 +0000 (22:42 +0100)]
avformat/cinedec: Fix index_entries size check

Fixes: out of array access
Fixes: 29868/clusterfuzz-testcase-minimized-ffmpeg_dem_CINE_fuzzer-5692001957445632
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/h264_metadata_bsf: Check nb_units before accessing the first in h264_metadata...
Michael Niedermayer [Sun, 31 Jan 2021 21:36:52 +0000 (22:36 +0100)]
avcodec/h264_metadata_bsf: Check nb_units before accessing the first in h264_metadata_update_fragment()

Fixes: null pointer dereference
Fixes: 29835/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_METADATA_fuzzer-4712125383704576
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/aaxdec: Check that segments table has been initialized
Michael Niedermayer [Sun, 31 Jan 2021 21:05:18 +0000 (22:05 +0100)]
avformat/aaxdec: Check that segments table has been initialized

Fixes: Timeout
Fixes: 29766/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-5635887566290944
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/ffv1dec: Check if trailer is available
Michael Niedermayer [Sun, 31 Jan 2021 20:22:11 +0000 (21:22 +0100)]
avcodec/ffv1dec: Check if trailer is available

Fixes: out of array read
Fixes: 29750/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4808377272238080.fuzz
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/exr: Check col/line for integer overflow
Michael Niedermayer [Mon, 1 Feb 2021 20:24:50 +0000 (21:24 +0100)]
avcodec/exr: Check col/line for integer overflow

Fixes: signed integer overflow: -2272 + -2147483360 cannot be represented in type 'int'
Fixes: 30009/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5005660322398208
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: add Changelog entry for librist and bump minor
Marton Balint [Sat, 6 Mar 2021 23:20:15 +0000 (00:20 +0100)]
avformat: add Changelog entry for librist and bump minor

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/librist: clarify and limit buffer_size
Marton Balint [Sat, 6 Mar 2021 22:36:03 +0000 (23:36 +0100)]
avformat/librist: clarify and limit buffer_size

As suggested by librist developers.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/librist: increase default loglevel
Marton Balint [Sat, 6 Mar 2021 21:53:21 +0000 (22:53 +0100)]
avformat/librist: increase default loglevel

Also remove AV_LOG_SIMULATE from the list as it is not used directly, and do
not use panic level on unknown loglevel, but make them warn. Also fix mapping of
NOTICE/INFO/VERBOSE and add documentation about when the option should actually
be used.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/librist: simplify secret strlcpy
Marton Balint [Sat, 6 Mar 2021 21:31:06 +0000 (22:31 +0100)]
avformat/librist: simplify secret strlcpy

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/librist: make packet size adjustable for writing, fix it for reading
Marton Balint [Sat, 6 Mar 2021 21:26:13 +0000 (22:26 +0100)]
avformat/librist: make packet size adjustable for writing, fix it for reading

Maximum packet size is 10000 (RIST_MAX_PACKET_SIZE, which is unfortunately
private) minus the RIST protocol overhead which is 28 bytes for the unencrypted
case, 36 for the encrypted case.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/librist: rework librist_read
Marton Balint [Sat, 6 Mar 2021 20:48:57 +0000 (21:48 +0100)]
avformat/librist: rework librist_read

Queue tracking makes no difference so remove it, return EAGAIN of no data is
available and rist data block needs to be freed even for zero sized packets.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agolibavformat: add librist protocol
Paul B Mahol [Sun, 28 Feb 2021 19:56:55 +0000 (20:56 +0100)]
libavformat: add librist protocol

This work is sponsored by Open Broadcast Systems.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agolibavutil/timer: Fix clang reserved-user-defined-literal
Christopher Degawa [Sat, 13 Mar 2021 04:20:37 +0000 (22:20 -0600)]
libavutil/timer: Fix clang reserved-user-defined-literal

clang errors when compiling with C++11 about needing spaces between
literal and identifier

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavdevice/pulse_audio_dec: do not read undersized frames
Marton Balint [Sat, 6 Feb 2021 18:48:51 +0000 (19:48 +0100)]
avdevice/pulse_audio_dec: do not read undersized frames

Keep on reading fragments until we got fragment_size amount of data, otherwise
we might get frames with 1-2 samples only if pa_stream_peek is called slightly
less frequently than sample rate.

Note that fragments might contain a lot less data than fragment_size, so
reading multiple fragments to get fragment_size amount of data is intentional.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavdevice/pulse_audio_dec: only set adjust latency flag if fragment_size is not set
Marton Balint [Thu, 11 Feb 2021 22:03:26 +0000 (23:03 +0100)]
avdevice/pulse_audio_dec: only set adjust latency flag if fragment_size is not set

Otherwise fragment_size is ignored.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavdevice/pulse_audio_dec: query actual fragment size
Marton Balint [Tue, 9 Feb 2021 23:15:00 +0000 (00:15 +0100)]
avdevice/pulse_audio_dec: query actual fragment size

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavdevice/alsa_dec: make sure we have enough data in non-blocking mode
Marton Balint [Tue, 9 Feb 2021 21:24:50 +0000 (22:24 +0100)]
avdevice/alsa_dec: make sure we have enough data in non-blocking mode

Otherwise we might return 1-2 samples per packet if av_read_frame() call rate is
only sligthly less than the stream sample rate.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec: add a get_encode_buffer() callback to AVCodecContext
James Almer [Sat, 20 Feb 2021 19:01:52 +0000 (16:01 -0300)]
avcodec: add a get_encode_buffer() callback to AVCodecContext

This callback is functionally the same as get_buffer2() is for decoders, and
implements for the new encode API the functionality of the old encode API had
where the user could provide their own buffers.

Reviewed-by: Lynne <dev@lynne.ee>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agocbs_sei: Detect payload overflows when reading SEI messages
Mark Thompson [Tue, 2 Feb 2021 20:58:11 +0000 (20:58 +0000)]
cbs_sei: Detect payload overflows when reading SEI messages

The top-level GetBitContext is sized for the whole NAL unit, so it fails
to detect overflows where a payload continues into the following message.
To fix that, we make a new context on the stack for reading each payload.

Fixes: 29892/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-6310830956216320
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Tested-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agocbs_h265: Detect more reference combinations which would overflow the DPB
Mark Thompson [Wed, 3 Feb 2021 21:34:07 +0000 (21:34 +0000)]
cbs_h265: Detect more reference combinations which would overflow the DPB

In total, the number of short term references (from the selected short
term ref pic set), the number of long term references (combining both the
used candidates from the SPS and those defined in the slice header) and
the number of instances of the current picture (usually one, but can be
two if current picture reference is enabled) must never exceed the size
of the DPB.  This is a generalisation of the condition associated with
num_long_term_pics in 7.4.7.1.

We use this to apply tighter bounds to the number of long term pictures
referred to in the slice header, and also to detect the invalid case where
the second reference to the current picture would not fit in the DPB (this
case can't be detected earlier because an STRPS with 15 pictures can still
be valid in the same stream when used with a different PPS which does not
require two DPB slots for the current picture).

Fixes: 24913/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-6261760693370880
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Tested-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/cbs_h26[45]: Remove redundant enum constants
Andreas Rheinhardt [Wed, 10 Mar 2021 10:26:52 +0000 (11:26 +0100)]
avcodec/cbs_h26[45]: Remove redundant enum constants

Unused since 8843607f495c95c1e67a3ce3d6f15dca6e252439.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/cbs_sei: Fix leak of AVBufferRef on error
Andreas Rheinhardt [Tue, 9 Mar 2021 21:11:52 +0000 (22:11 +0100)]
avcodec/cbs_sei: Fix leak of AVBufferRef on error

An AVBufferRef (and the corresponding AVBuffer and the underlying actual
buffer) would leak in ff_cbs_sei_add_message() on error in case an error
happened after its creation and before it has been attached to more
permanent storage. Fix this by only creating the AVBufferRef immediately
before attaching it to its intended target position.

(Given that no SEI message currently created is refcounted, the above
can't happen at the moment. But Coverity already nevertheless noticed:
This commit fixes Coverity issue #1473521.)

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/cbs_sei: Don't use -1th element of array
Andreas Rheinhardt [Tue, 9 Mar 2021 20:29:24 +0000 (21:29 +0100)]
avcodec/cbs_sei: Don't use -1th element of array

(This affected only suffix SEI messages; yet no such SEI messages are
currently inserted.)

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/cbs: Remove redundant checks for CodedBitstreamContext.codec
Andreas Rheinhardt [Tue, 9 Mar 2021 19:16:04 +0000 (20:16 +0100)]
avcodec/cbs: Remove redundant checks for CodedBitstreamContext.codec

Setting this field happens immediately after the allocation in
ff_cbs_init(), so the whole CBS code may presume that any
CodedBitstreamContext has this set. Lots of code already presumed this,
yet ff_cbs_close() did it inconsistently: It checked before checking
whether the CodedBitstreamType has a close function; yet it simply
unconditionally read ctx->codec->priv_class. Coverity complained about
this in issue #1473564, which this commit fixes.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/nvenc: base timestamps on frameIntervalP
Martin Storsjö [Fri, 12 Mar 2021 20:42:02 +0000 (22:42 +0200)]
avcodec/nvenc: base timestamps on frameIntervalP

If b-frames were enabled implicitly (if max_b_frames wasn't set by
the caller at all, since a0949d0bcb0eee2f3fffcf9a4810c0295d14c0dc),
we wouldn't offset dts at all, producing invalid pts/dts combinations
(causing loud warnings by ffmpeg, or muxer errors if passed without
an extra cleanup pass).

Instead use frameIntervalP for offsetting, which should always be
accurate.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agoavfilter/vf_uspp: Fix leak of packet side data
Andreas Rheinhardt [Fri, 12 Mar 2021 14:07:33 +0000 (15:07 +0100)]
avfilter/vf_uspp: Fix leak of packet side data

The uspp filter uses a special option ("no_bitstream") of
the Snow encoder to suppress it from generating output.
The filter therefore did not unref the packet after usage,
believing it to be blank. But this is wrong, as the Snow encoder
attaches quality stats side data to the packet.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_uspp: Fix leak of qp-table on error
Andreas Rheinhardt [Fri, 12 Mar 2021 13:55:53 +0000 (14:55 +0100)]
avfilter/vf_uspp: Fix leak of qp-table on error

Fixes Coverity issue #1473500.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/decode: Reindentation
Andreas Rheinhardt [Fri, 12 Mar 2021 16:40:07 +0000 (17:40 +0100)]
avcodec/decode: Reindentation

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/decode: Remove always-true check
Andreas Rheinhardt [Fri, 12 Mar 2021 16:29:28 +0000 (17:29 +0100)]
avcodec/decode: Remove always-true check

Forgotten in 1fd76277708cf83572ba243e98f9e848c652f83d.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/adp, svs: Remove redundant av_shrink_packet()
Andreas Rheinhardt [Fri, 12 Mar 2021 08:23:46 +0000 (09:23 +0100)]
avformat/adp, svs: Remove redundant av_shrink_packet()

av_get_packet() already makes sure that the packet size is accurate
and that the packet data is zero-padded even when one could not read as
much as desired.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/gopher: Add support for Gopher over TLS
parazyd [Sun, 28 Feb 2021 22:47:05 +0000 (23:47 +0100)]
avformat/gopher: Add support for Gopher over TLS

This commit adds a "gophers" handler to the gopher protocol. gophers
is a community-adopted protocol that acts the same way like normal
gopher with the added TLS encapsulation.

The gophers protocol is supported by gopher servers like geomydae(8),
and clients like curl(1), clic(1), and hurl(1).

This commit also adds compilation guards to both gopher and gophers,
since now there are two protocols in the file it makes sense to
have this addition.

Signed-off-by: parazyd <parazyd@dyne.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/gopher: Add default_whitelist to ff_gopher_protocol
parazyd [Sun, 28 Feb 2021 22:47:03 +0000 (23:47 +0100)]
avformat/gopher: Add default_whitelist to ff_gopher_protocol

Signed-off-by: parazyd <parazyd@dyne.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/gifenc: Actually use the shrunk palette
Derek Buitenhuis [Wed, 10 Mar 2021 15:18:41 +0000 (15:18 +0000)]
avcodec/gifenc: Actually use the shrunk palette

I have no idea how nobody, including myself, noticed this.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavcodec/h264_slice: don't copy frame data during error concealment
James Almer [Tue, 9 Mar 2021 02:10:10 +0000 (23:10 -0300)]
avcodec/h264_slice: don't copy frame data during error concealment

In addition to the fact that av_image_copy() cannot handle hardware pixel formats,
h->short_ref[0]->f may not be writable at this point.

Based on a patch by Hendrik Leppkes.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavdevice/decklink: add missing include for buffer_size_t
James Almer [Thu, 11 Mar 2021 16:39:36 +0000 (13:39 -0300)]
avdevice/decklink: add missing include for buffer_size_t

Should fix compilation broken in f7abb53cb427515faac582f114ab97cbbd590280.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavisynth: fix audio on big endian
Stephen Hutchinson [Sun, 3 Jan 2021 22:58:36 +0000 (17:58 -0500)]
avisynth: fix audio on big endian

AviSynth+ outputs audio in the same format as the
OS, so assuming little endian formats as input
on big endian OSes results in nothing but static.

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
3 years agoavisynth: populate field order
emcodem [Thu, 21 Jan 2021 17:59:45 +0000 (18:59 +0100)]
avisynth: populate field order

Fixes Trac ticket #8757

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
3 years agoavisynth: more intelligent RGB flipping
Stephen Hutchinson [Tue, 7 Apr 2020 23:47:43 +0000 (19:47 -0400)]
avisynth: more intelligent RGB flipping

avs_is_color_space provides a generic way of checking whether the
video is RGB, and has been available through AVSC_API since 2.6.
This means that GetProcAddress doesn't have to run on every frame.

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
3 years agoavformat/rawenc: Use init instead of write_header function
Andreas Rheinhardt [Mon, 8 Mar 2021 15:16:09 +0000 (16:16 +0100)]
avformat/rawenc: Use init instead of write_header function

force_one_stream() does not write anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/4xm: Check pre_gb in decode_i_block()
Michael Niedermayer [Tue, 9 Mar 2021 20:39:30 +0000 (21:39 +0100)]
avcodec/4xm: Check pre_gb in decode_i_block()

Fixes: Timeout
Fixes: 31257/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5150866229297152
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 agoavutil/buffer_internal: Include internal for buffer_size_t
Andreas Rheinhardt [Thu, 11 Mar 2021 10:39:58 +0000 (11:39 +0100)]
avutil/buffer_internal: Include internal for buffer_size_t

Fixes checkheaders.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_mathbinary: Fix leak upon error
Andreas Rheinhardt [Wed, 10 Mar 2021 17:45:07 +0000 (18:45 +0100)]
dnn/dnn_backend_native_layer_mathbinary: Fix leak upon error

Fixes Coverity issue #1473568.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_conv2d: Don't pretend convolution can fail
Andreas Rheinhardt [Wed, 10 Mar 2021 20:58:15 +0000 (21:58 +0100)]
dnn/dnn_backend_native_layer_conv2d: Don't pretend convolution can fail

It can't; these are just remnants of commit
3c7cad69f233252e5178f7732baa0da950d74bbd which let the worker threads
do the reallocation.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_conv2d: Check thread creation for errors
Andreas Rheinhardt [Wed, 10 Mar 2021 17:08:10 +0000 (18:08 +0100)]
dnn/dnn_backend_native_layer_conv2d: Check thread creation for errors

Fixes Coverity issue #1473533.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_conv2d: Check allocation
Andreas Rheinhardt [Wed, 10 Mar 2021 16:42:43 +0000 (17:42 +0100)]
dnn/dnn_backend_native_layer_conv2d: Check allocation

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_conv2d: Avoid separate, unchecked allocations
Andreas Rheinhardt [Wed, 10 Mar 2021 16:38:36 +0000 (17:38 +0100)]
dnn/dnn_backend_native_layer_conv2d: Avoid separate, unchecked allocations

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_conv2d: Fix memleak on error
Andreas Rheinhardt [Wed, 10 Mar 2021 16:22:29 +0000 (17:22 +0100)]
dnn/dnn_backend_native_layer_conv2d: Fix memleak on error

If an error happens when preparing the output data buffer, an already
allocated array would leak. Fix this by postponing its allocation.

Fixes Coverity issue #1473531.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_conv2d: Avoid allocation when single-threaded
Andreas Rheinhardt [Wed, 10 Mar 2021 16:03:01 +0000 (17:03 +0100)]
dnn/dnn_backend_native_layer_conv2d: Avoid allocation when single-threaded

Also fixes a memleak in single-threaded mode when an error happens
in preparing the output data buffer; and also removes an unchecked
allocation.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_conv2d: Join two arrays, avoid allocation
Andreas Rheinhardt [Wed, 10 Mar 2021 15:21:13 +0000 (16:21 +0100)]
dnn/dnn_backend_native_layer_conv2d: Join two arrays, avoid allocation

Fixes Coverity issue #1473507.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native_layer_conv2d: Fix memleak on realloc failure
Andreas Rheinhardt [Wed, 10 Mar 2021 14:40:36 +0000 (15:40 +0100)]
dnn/dnn_backend_native_layer_conv2d: Fix memleak on realloc failure

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native: Fix typo in log message
Andreas Rheinhardt [Wed, 10 Mar 2021 14:27:52 +0000 (15:27 +0100)]
dnn/dnn_backend_native: Fix typo in log message

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native: Don't use asserts for checks
Andreas Rheinhardt [Wed, 10 Mar 2021 13:00:26 +0000 (14:00 +0100)]
dnn/dnn_backend_native: Don't use asserts for checks

asserts should not be used instead of ordinary input checks.
Yet the native DNN backend did it: get_input_native() asserted that
the first dimension was one, despite this value coming directly from
the input file without having been sanitized.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native: Fix leak in case parsing options fails
Andreas Rheinhardt [Wed, 10 Mar 2021 01:59:47 +0000 (02:59 +0100)]
dnn/dnn_backend_native: Fix leak in case parsing options fails

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodnn/dnn_backend_native: Avoid allocation for checking file magic
Andreas Rheinhardt [Wed, 10 Mar 2021 01:34:14 +0000 (02:34 +0100)]
dnn/dnn_backend_native: Avoid allocation for checking file magic

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoDoc: Tech Resolution Process
Jean-Baptiste Kempf [Wed, 10 Mar 2021 20:40:22 +0000 (21:40 +0100)]
Doc: Tech Resolution Process

3 years agoavcodec/libilbc: Support newer libiLBC versions
Andreas Rheinhardt [Thu, 11 Mar 2021 00:43:44 +0000 (01:43 +0100)]
avcodec/libilbc: Support newer libiLBC versions

Beginning with version 3.0, libiLBC switched the types of some parts
of their public API to size_t and renamed some types; the old names
continue to work as typedefs, but are deprecated. It furthermore
added version macros.

This commit uses said version macro to use the new types when using
newer libiLBC versions.

Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavutil: use the buffer_size_t typedef where required
James Almer [Sat, 6 Mar 2021 16:58:26 +0000 (13:58 -0300)]
avutil: use the buffer_size_t typedef where required

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter: use the buffer_size_t typedef where required
James Almer [Sat, 6 Mar 2021 17:16:45 +0000 (14:16 -0300)]
avfilter: use the buffer_size_t typedef where required

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavdevice: use the buffer_size_t typedef where required
James Almer [Sat, 6 Mar 2021 16:30:00 +0000 (13:30 -0300)]
avdevice: use the buffer_size_t typedef where required

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat: use the buffer_size_t typedef where required
James Almer [Sat, 6 Mar 2021 16:29:54 +0000 (13:29 -0300)]
avformat: use the buffer_size_t typedef where required

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec: use the buffer_size_t typedef where required
James Almer [Sat, 6 Mar 2021 16:29:37 +0000 (13:29 -0300)]
avcodec: use the buffer_size_t typedef where required

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/utils: change AVStream side data related public function and struct size...
James Almer [Sat, 6 Mar 2021 18:40:58 +0000 (15:40 -0300)]
avformat/utils: change AVStream side data related public function and struct size types to size_t

av_stream_add_side_data() already defines size as a size_t, so this makes it
consistent across all side data functions.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/packet: change side data related public function and struct size types to...
James Almer [Sat, 6 Mar 2021 15:43:52 +0000 (12:43 -0300)]
avcodec/packet: change side data related public function and struct size types to size_t

av_packet_add_side_data() already defines size as a size_t, so this makes it
consistent across all side data functions

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavutil/frame: change av_frame_new_side_data() size parameter type to size_t
James Almer [Sat, 6 Mar 2021 15:35:48 +0000 (12:35 -0300)]
avutil/frame: change av_frame_new_side_data() size parameter type to size_t

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavutil/buffer: change public function and struct size parameter types to size_t
James Almer [Sat, 6 Mar 2021 15:26:16 +0000 (12:26 -0300)]
avutil/buffer: change public function and struct size parameter types to size_t

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/af_dynaudnorm: make better check for available samples
Paul B Mahol [Wed, 10 Mar 2021 22:48:44 +0000 (23:48 +0100)]
avfilter/af_dynaudnorm: make better check for available samples

Also report more correct EOF timestamp.

3 years agoavfilter/vf_nnedi: Fix use of uninitialized value
Andreas Rheinhardt [Tue, 9 Mar 2021 21:43:13 +0000 (22:43 +0100)]
avfilter/vf_nnedi: Fix use of uninitialized value

Fixes Coverity issue #1473546.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agofftools/ffplay: do not write out of rdft visualization texture
Marton Balint [Wed, 3 Mar 2021 22:23:10 +0000 (23:23 +0100)]
fftools/ffplay: do not write out of rdft visualization texture

If the window is resized it was possible that xpos pointed outside the
visualization texture. By rearranging the overflow check we make sure this (and
a crash) does not happen.

We also don't have to use xleft for start position, as that is 0 anyways, and
if we ever want to take into account xleft then the texture should be
positioned accordingly when rendering.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available
sfan5 [Wed, 17 Feb 2021 15:51:09 +0000 (16:51 +0100)]
avcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available

Added in Android 10 it provides a reliable way of filtering out
software decoders, unlike existing string-based checks.

3 years agoavcodec/mediacodec_wrapper: check if codec is software earlier
sfan5 [Wed, 17 Feb 2021 15:50:00 +0000 (16:50 +0100)]
avcodec/mediacodec_wrapper: check if codec is software earlier