Commit Graph

120838 Commits

Author SHA1 Message Date
Jun Zhao
449453a971 lavc/videotoolbox_vp9: fix vpcC flags offset
Write the 24-bit vpcC flags field at the current cursor position after
the version byte. The previous code wrote to p+1 instead of p, leaving
one byte uninitialized between version and flags and shifting all
subsequent fields (profile, level, bitdepth, etc.) by one byte.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
(cherry picked from commit 19c4bcae68a16ea893b0558d720dd4a2ecd58f0f)
2026-04-15 23:13:34 +08:00
Jun Zhao
61c93d0bfc lavc/videotoolboxenc: return SEI parse errors
Return the actual find_sei_end() error when SEI appending fails instead of
reusing the previous status code. This preserves the real parse failure for
callers instead of reporting malformed SEI handling as success.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
(cherry picked from commit f7c04283367269c7aef2505a1839fb3ea9362330)
2026-04-15 23:13:34 +08:00
Zhao Zhili
fa4ee7ab3c aarch64/hpeldsp_neon: fix out-of-bounds read
Fix #21141

The performance improved a little bit.
On A76:
                              Before            After
put_pixels_tab[0][1]_neon:    32.4 ( 3.91x)     31.6 ( 3.99x)
put_pixels_tab[0][3]_neon:    88.0 ( 4.50x)     74.6 ( 5.31x)
put_pixels_tab[1][1]_neon:    33.5 ( 2.52x)     31.2 ( 2.71x)
put_pixels_tab[1][3]_neon:    30.5 ( 3.61x)     21.7 ( 5.08x)

On A55:
                             Before            After
put_pixels_tab[0][1]_neon:   175.2 ( 2.41x)    138.7 ( 3.04x)
put_pixels_tab[0][3]_neon:   334.3 ( 2.71x)    296.1 ( 3.07x)
put_pixels_tab[1][1]_neon:   168.3 ( 1.78x)     94.1 ( 3.19x)
put_pixels_tab[1][3]_neon:   112.3 ( 2.20x)     90.0 ( 2.74x)

(cherry picked from commit 840183d823)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-03-06 23:56:49 +00:00
James Almer
26fdd2258b avformat/mov: check return value of mov_read_iref_thmb()
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 77298c29bc)
2026-03-05 23:29:52 -03:00
James Almer
343938f182 avformat/mov: Fix multiple issues related to mov_read_iref_dimg()
forward errors and cleanup in teh failure cases

Fixes: freeing uninitialized pointers
Fixes: 487160965/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6525162874011648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f10c0ae276)
2026-03-05 23:21:21 -03:00
James Almer
0ef3600643 avformat/mov: free item_name on infe entry parsing failure
Fixes regression since 28c330d0f3.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 40e0463113)
2026-03-05 23:16:17 -03:00
James Almer
f9b61216ae avformat/mov: check for EOF in more loops
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit c3aa28f23d)
2026-03-05 23:16:10 -03:00
James Almer
6a756fbb21 avformat/mov: abort if the queried item doesn't exist instead of overwriting it
The check for item presence was insufficient as it would result in the last
item in the array being overwritten if it existed even if the id didn't match.

Fixes: Assertion ref failed at src/libavformat/mov.c:10649
Fixes: clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5312542695292928
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 28c330d0f3)
2026-03-05 23:16:02 -03:00
James Almer
7399d533ac avformat/mov: add overflow checks to item offset values
Fixes issue #21478.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 52b1977353)
2026-03-05 23:11:12 -03:00
James Almer
85a32c764b avformat/mov: reindent after the previous change
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit fd4e86be9e)
2026-03-05 23:10:37 -03:00
James Almer
19df26bc82 avformat/mov: don't parse reserved ISOBMFF fields as if they were QT
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit c0044ec9c4)
2026-03-05 23:10:35 -03:00
James Almer
5acd4d17cc avformat/mov: make items referencing items generic
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 74e430202d)
2026-03-05 23:07:58 -03:00
James Almer
27b8d1a017 avformat/mov: fix cases where we discard iamf packets from enabled streams
Given the entire iamf struct is inside a single Track, if the first iamf stream
(which is the one sharing the index and id from the Track) was to be disabled,
then packets from every iamf stream would be discarded.
Fix this by actually going through the entire iamf Sample and discarding those
from the disabled streams only.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 16ee3d8d99)
2026-02-27 12:27:15 -03:00
James Almer
415c801ab5 avformat/mov: fix setting iamf stream id offsets
If we were to add the highest id of a non iamf stream as offset to iamf stream
ids, and one of the latter was 0, then an id overlap would ocurr.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 51aef95ba1)
2026-02-27 12:19:31 -03:00
Jack Lau
15504610b0 avformat/whip: remove the confused option buffer_size
See https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20965#issuecomment-22815

The buffer_size isn't inlcuded in release/8.0,
directly use new option ts_buffer_size to replace
buffer_size shoule be okay.

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
(cherry picked from commit 2a0a32c42b)
2026-02-10 09:32:56 +00:00
Jack Lau
0f43795c24 avformat/whip: add new option ts_buffer_size to deprecate buffer_size
See https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20965#issuecomment-15854

The old option name `buffer_size` maybe confusing because there're some
protocols and muxer using this.

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
(cherry picked from commit cc8f392136)
2026-02-10 09:32:56 +00:00
Jack Lau
c853beb7c3 avformat/whip: remind user increase -buffer_size
The udp buffer size might be too small to easily
be full temporarily and return WSAEWOULDBLOCK.
The udp code will handle the windows error code
and convert it to AVERROR(EAGAIN).

This issue just can be reproduced on windows.

If sleep a interval and retry to send pkt when hit
EAGAIN, it will increase latency, and appropriate
interval is hard to define.

So this patch just remind user increase the buffer
size via -buffer_size to avoid this issue.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
(cherry picked from commit ec0a04de0d)
2026-02-10 09:32:56 +00:00
Jack Lau
185d07ede1 avformat/whip: pass through buffer_size option to udp
Signed-off-by: Jack Lau <jacklau1222@qq.com>
(cherry picked from commit b3793d9941)
2026-02-10 09:32:56 +00:00
Jack Lau
2096bb7466 avformat/whip: fix potential 8bit overflow for profile_idc
The profile contains profile_idc and constraint_set*_flag,
throws away high 8 bit flags and then we get profile_idc.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
(cherry picked from commit 785a4e0d6c)
2026-02-10 09:32:56 +00:00
Jack Lau
342747ac7d avformat/whip: fix 8 bits overflow and map constraint_set bits for H264
profile_iop is an 8 bits field. Previous code copied
AVCodecParameters::profile (which can contain bits
beyond 8 bits) into profile_iop, producing overflow
and wrong values.

This patch maps the constrained flags into the proper
profile_iop bits (constraint_set1 / 3)

Signed-off-by: Jack Lau <jacklau1222@qq.com>
(cherry picked from commit 6c2768bf8c)
2026-02-10 09:32:56 +00:00
Jack Lau
6350cd623b avformat/whip: fix SDP ICE candidates parsing
fix issue #20407

Refer to RFC 5245 15.1,
the foundation may be any string up to 32 chars.
The old code could misread foundations as transport("udp").
This patch fully parse all these attr to avoid parsing error.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
(cherry picked from commit b41f8207c4)
2026-02-10 09:32:56 +00:00
Jack Lau
65a58c5bd7 avformat/whip: fix ssrc might be same
use audio_ssrc + 1 for video_ssrc to avoid ssrc collision

See RFC 3550 Section 8,
The SSRC identifier carried in the RTP header and in various fields
of RTCP packets is a random 32 bit number that is required to be
globally unique within an RTP session.

simply + 1 also can get an unique ssrc, and faster than generating
new unique ssrc.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
(cherry picked from commit b3ea558492)
2026-02-10 09:32:56 +00:00
Andreas Rheinhardt
3201cd40a4 avcodec/tableprint_vlc: Unbreak hardcoded tables
Forgotten in d8ffec5bf9.
Fixes issue #21102 (and part of #21694).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 1d47ae65bf)
2026-02-09 12:52:01 +01:00
Martin Storsjö
59384ce6b6 tests: Fix fate-run.sh to handle busybox-w32 absolute paths
Busybox-w32 uses regular Windows style paths with drive letters,
but with forward slashes; thus an absolute path starts with "c:/".

Make the target_path() function in fate-run.sh (which converts a
potentially relative path to an absolute one, under the target_path
prefix) handle this case.

With this in place, running fate tests almost works in
busybox-w32 - only one issue remains. A patch [1] has been sent to
upstream busybox for fixing that issue (which also is present if
running fate tests on busybox on Linux), but it hasn't been
responded to yet.

[1] https://lists.busybox.net/pipermail/busybox/2025-December/091851.html

(cherry picked from commit 06a17fdafc)
2026-02-03 20:56:26 +00:00
Martin Storsjö
d597aa985c configure: Recognize uname "Windows_NT" as using an .exe suffix
Busybox-w32 [1] works for building ffmpeg on Windows (as an
alternative to msys2, cygwin or WSL).

On busybox-w32, "uname" returns "Windows_NT"; recognize this
in exesuf() as having an .exe suffix.

If building in this environment with a mingw toolchain, one has
to explicitly set --target-os=mingw32. (We probably don't
want to imply that this uname, set as target_os_default, would
default to mingw?) But despite what is set with --target-os,
one can't override the configure variable "host_os", which
exesuf() has to recognize.

[1] https://github.com/rmyorston/busybox-w32

(cherry picked from commit 6149ceadeb)
2026-02-03 20:56:26 +00:00
Andreas Rheinhardt
8a0fd0f9f3 avformat/tests/movenc: Make objects static
(This also fixes a symbol name collision with libssh,
which has a nonstatic function called md5.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-03 15:12:44 -03:00
Jun Zhao
eef9672b02 checkasm/hevc_pel: rename loop variable 'size' to 'idx' to avoid confusion
The variable 'size' is used as a loop index for the 'sizes' array.
This naming similarity is error-prone and recently led to a typo where
'size[sizes]' was written instead of 'sizes[size]'.

Rename the loop index variable from 'size' to 'idx' across all 10 test
functions to make the code more readable and prevent similar typos.

Additionally, replace the hardcoded loop upper bound '10' with
'FF_ARRAY_ELEMS(sizes)' for better maintainability.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-02-03 22:57:20 +08:00
Jun Zhao
450bbb7960 checkasm/hevc_pel: fix typo size[sizes] -> sizes[size]
Commit 4d4b301e4a introduced a typo where `size[sizes]` was used
instead of `sizes[size]` in 10 places within checkasm_check_pixel_padded
calls.

Since `sizes` is an array and `size` is the loop index, `size[sizes]`
interprets the array pointer as an index, resulting in undefined behavior
and causing AddressSanitizer to detect buffer overflows during testing.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-02-03 22:57:10 +08:00
Christopher Degawa
43d3951d64 avcodec/libsvtav1: rename aq_mode for v4.0.0
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-02 17:18:30 +01:00
Hyunjun Ko
2f547c4022 vulkan_vp9: fix subsampling source and show_frame flag
(cherry picked from commit 6726359326)
2026-02-02 10:53:46 +01:00
James Almer
0592be14ff avfilter/vf_lcevc: attach a reference to the source frame to each passed in base picture
And free them once they are guaranteed to be no longer needed, instead of freeing them
when returned with an enhanced output.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit af136db1c3)
2026-01-11 20:37:19 -03:00
James Almer
8a825fe415 avcodec/lcevc: attach a reference to the source frame to each passed in base picture
This way we can ensure a frame reference will always exists for as long as the
external library needs the base picture.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 188521c7ad)
2026-01-11 20:35:26 -03:00
James Almer
c9f97fcabf avcodec/lcevcdec: free pictures on error
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit fe1dae1e18)
2026-01-11 20:33:56 -03:00
James Almer
3db8e93a20 avcodec/lcevcdec: fix input dimensions for the base picture
Fixes crashes with some samples.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 4f86ebfe94)
2026-01-11 20:32:57 -03:00
James Almer
c92c2bc863 avcodec/lcevcdec: avoid copying the input frame
Based on the lcevc filter implementation.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit b392d75cf7)
2026-01-11 20:32:57 -03:00
Andreas Rheinhardt
050da957c3 avcodec/decode: Optimize lcevc away if disabled
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 8e90f150eb)
2026-01-11 20:31:58 -03:00
Andreas Rheinhardt
a635df770f avcodec/decode: Put lcevc fields into structure of their own
Makes it easier to see that width and height in DecodeContext is
actually a lcevc field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 2786e5a9ad)
2026-01-11 20:31:58 -03:00
Andreas Rheinhardt
02e30de043 avcodec/decode: Don't allocate LCEVC context for non-video
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 182b9c7a4a)
2026-01-11 20:31:58 -03:00
Russell Greene
abb609bb58 hwcontext_vulkan: add support for implict DRM sync for export
When a frame is exported to DRM, it may be written to to read to in an asyncronous fashion. Make sure, on unmap of a Vulkan frame that was mapped to DRM, to import any fences that were put on the dmabuf

(cherry picked from commit 38e89fe502)
2026-01-02 22:47:50 +01:00
Frank Plowman
4771d217bd lavc/vvc: Prevent OOB write to slice_top_left_ctu_x in PPS CBS
Prior to the fix, in the case of a tile containing multiple slices
(pps_num_exp_slices_in_tile != 0) the number of slices was temporarily
allowed to exceed pps_num_slices_in_pic_minus1+1 and therefore
VVC_MAX_SLICES.  The number of slices was later verified, but while the
current slice index was higher than expected it was used to write to a
array of size VVC_MAX_SLICES, leading to an OOB write.

To rectify this, the patch adds some checks at an earlier stage, to
ensure that the slice index i + j at no point exceeds
pps_num_slices_in_pic_minus1.

Fixes #YWH-PGM40646-30

(cherry picked from commit 72a38c12e5)
2026-01-02 19:23:37 +00:00
Frank Plowman
61ac8e7d29 lavc/vvc: Error on inter slice with no reference pics
The semantics of sh_num_ref_idx_active_minus1[ i ] state that

When the current slice is a P slice, the value of NumRefIdxActive[ 0 ] shall be greater than 0.
When the current slice is a B slice, both NumRefIdxActive[ 0 ] and NumRefIdxActive[ 1 ] shall be greater than 0.

Fixes: use of uninitialized memory
Fixes: 449549597/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-5600497089445888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reported-by: Michael Niedermayer michael@niedermayer.cc
(cherry picked from commit 90f1f797aa)
2026-01-02 19:23:37 +00:00
Timo Rothenpieler
d204dacf2c forgejo: backport CI job names 2026-01-02 20:00:45 +01:00
Timo Rothenpieler
ec78e95627 avformat/img2dec: reject input images too big to fit into a single packet
Not entirely sure if it should instead use some entirely different
approach here, given that images exceeding 2GB don't seem that crazy
to me, but so far processing such images results in a heap overflow,
since the size addition overflows and a much too small packet is
allocated and its size never checked again when writing into it.

Fixes #YWH-PGM40646-32

(cherry picked from commit f6a95c7eb7)
2026-01-01 19:52:19 +00:00
David Rosca
a6a220ed33 cbs_vp9: Always update loop filter and segmentation from current frame
Fixes decoding vp90-2-09-aq2, vp90-2-15-segkey_adpq, vp90-2-15-segkey
and vp90-2-22-svc_1280x720_1 with Vulkan hwaccel.

Fixes: 26a2a76346 ("cbs_vp9: Fix VP9 passthrough")

(cherry picked from commit a0a16f2ea4)
2026-01-01 13:49:08 +01:00
James Almer
bfa334de42 avformat/iamf_writer: check that stream count is consistent for ambisonic Audio Elements
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit a0fc454871)
2025-12-30 20:23:51 -03:00
James Almer
06fcee2e26 avformat/iamf_writer: fix writting some ambisonics fields in Audio Elements
The fields are defined as 8 bit long unsigned ints. Fortunately, writing most sane values
as leb is equivalent, which is why no tests are affected.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 21ff60d2cf)
2025-12-30 20:23:50 -03:00
James Almer
af60dd8419 avformat/iamf_parse: fix setting denominator in AVIAMFLayer.demixing_matrix
The format of demixing_matrix is Q15 fixed point values.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 03a981445e)
2025-12-30 20:23:50 -03:00
Jack Lau
e36046790a tests/fate/filter-video: add two feedback tests
- Add fate-filter-feedback-yadif

- add fate-filter-feedback-hflip

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
(cherry picked from commit c4b050fd67)
2025-12-18 22:26:04 +00:00
Jack Lau
0a73316166 avfilter/vf_feedback: fix feedback block
Fix #20940

The feedback and its sub-filter both request frame
from each other, casuing block since 4440e499ba

The feedback should only request inputs[1] once
rather than continuously request frame cause blocking.

This patch add check whether feedback already request
inputs[1] via ff_outlink_frame_wanted(ctx->outputs[1]),
if true, then exit and waiting inputs[0] because it means
we need more frames input to proceed.

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
(cherry picked from commit 3f0842294f)
2025-12-18 22:26:04 +00:00
Jan Ekström
ca7896c48f fate/ffmpeg: remove comparison against ref from fix_sub_duration_heartbeat
After the full ffmpeg CLI multithreading changes went in, this
test started depending on how far the input side read and decoded
the input compared to how quickly the output encoded things, causing
spurious failures on the CI.

To my knowledge all of the failures have so far been valid correct
results, but unfortunately FATE's built in checks mostly consist of
whether there is a difference against an exact result.

This way we still get the CI and valgrind running of the code,
but stop its comparison. Reference file is left around so that
the previous reference is still available.

(cherry picked from commit e54bd7065d)
2025-12-16 21:14:38 +02:00