124698 Commits

Author SHA1 Message Date
James Almer c65c8f1f49 avcodec/dcadec: output a custom channel layout when requesting coded channel ordering
Outputting an UNSPEC layout will make most callers guess the speaker layout, and
more likely than not get it wrong.
Now that we can freely export custom order layouts, lets use them.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-30 22:37:09 -03:00
James Almer de647bfbbc avformat/mpeg: lower PES stream score compared to mp3/ac3
The heuristics run to detect PES streams are much laxer than mp3/ac3 ones,
which check for valid headers, so it should not have a higher score than the
latter.

Fixes misdetection of some mp3 files with big id3v2 tags at the beginning.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-31 00:39:51 +00:00
James Almer 1a0ab27954 avfilter/af_aresample: propagate the matrix encoding used for downmixing
Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-30 21:37:33 -03:00
James Almer 971da26361 avfilter/af_aresample: fix layout comparison when applying downmix coeffs
out_layout at this point is a zeroed struct, and even after being filled below in the code
it's ensured it will be the same as outlink->side_data.
The actual check should be between inlink and outlink layouts. If they differ, then swr
will do remixing and as such the downmix info side data will no longer be valid for any
filter or encoder down the chain.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-30 21:37:33 -03:00
James Almer fd9e4fa081 avformat/dump: remove unused variable
Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-30 16:02:26 -03:00
Romain Beauxis 6ef1a9579f avformat/matroskaenc: write hvcE BlockAdditionMapping for Dolby Vision EL
When AV_PKT_DATA_HEVC_CONF is present on an HEVC track, write
an hvcE BlockAdditionMapping alongside the existing dvcC/dvvC one,
carrying the raw HEVCDecoderConfigurationRecord for the enhancement layer.
2026-05-30 17:37:28 +00:00
Romain Beauxis 523b9faa94 avformat/matroskadec: parse hvcE block addition mapping as AV_PKT_DATA_HEVC_CONF
Handle MATROSKA_BLOCK_ADD_ID_TYPE_HVCE in mkv_parse_block_addition_mappings
and store the raw HEVCDecoderConfigurationRecord as
AV_PKT_DATA_HEVC_CONF on the stream's coded side data, mirroring
the existing dvcC/dvvC handling.
2026-05-30 17:37:28 +00:00
Romain Beauxis e2cfc80f32 avformat/matroska: add hvcE block addition mapping type
Add MATROSKA_BLOCK_ADD_ID_TYPE_HVCE (0x68766345) for the Dolby Vision
enhancement-layer HEVC configuration, alongside the existing dvcC/dvvC
entries.
2026-05-30 17:37:28 +00:00
Romain Beauxis 199e49d9b6 avformat/movenc: write hvcE box for Dolby Vision enhancement layer
When AV_PKT_DATA_HEVC_CONF is present on a MODE_MP4 HEVC
track, write it as an hvcE box alongside hvcC and dvcC. Like dvcC,
writing requires -strict unofficial.
2026-05-30 17:37:28 +00:00
Romain Beauxis 2c74d197ee avformat/mov: parse hvcE box as AV_PKT_DATA_HEVC_CONF side data
The hvcE box carries the HEVCDecoderConfigurationRecord for the Dolby
Vision enhancement layer in ISOM-based containers. Store its raw
contents as AV_PKT_DATA_HEVC_CONF on the stream's coded side data,
mirroring the existing dvcC/dvvC handling.
2026-05-30 17:37:28 +00:00
Romain Beauxis 5f6dff5e7d avcodec/packet: add AV_PKT_DATA_HEVC_CONF side data type
Carries a raw HEVCDecoderConfigurationRecord for the Dolby Vision
enhancement layer, parsed from the hvcE box (ISOM) or the corresponding
BlockAdditionMapping (Matroska).
2026-05-30 17:37:28 +00:00
Romain Beauxis 8c86d82703 fate: add tests for Dolby Vision Profile 7 hvcE preservation
Tests covering demux and remux of DV P7 dual-layer content with both
dvcC and hvcE BlockAdditionMapping/box across MP4 and Matroska.
2026-05-30 17:37:28 +00:00
Lynne ac611d3120 swscale/tests/swscale: check if formats require the legacy path with -hw
The issue is the legacy path does not support hardware frames, so falling
back means erroring with ENOTSUP, which would fail the tests.

Sponsored-by: Sovereign Tech Fund
2026-05-31 01:14:08 +09:00
Lynne cd89df8f99 vulkan/swscale: don't hardcode source type as float when filtering
Sponsored-by: Sovereign Tech Fund
2026-05-31 01:14:04 +09:00
Tau Gärtli 3023060139 tests/fate/generic-tags: Fix testing with --disable-swresample 2026-05-30 14:11:03 +00:00
David Korczynski 1152139b48 avcodec/cook: bound subpacket channel sum against channel count
Fixes: out of array read
Fixes: evil.rm

Found-by: Anthropic agents; validated and reported by Ada Logics.

Signed-off-by: David Korczynski <david@adalogics.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-30 13:57:13 +00:00
Andreas Rheinhardt b8c5376eb4 avcodec/vorbis_parser: Improve returned error codes
av_vorbis_parse_init() doesn't return an error code which is a slight
problem in libvorbisenc.c. Fix this by making the internal
initialization function behind av_vorbis_parse_init() available. This
also avoids allocations and frees.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-05-30 13:10:07 +02:00
Lynne 80405d3ceb swscale/vulkan: support interlaced filtering
Sponsored-by: Sovereign Tech Fund
2026-05-30 12:10:06 +09:00
Lynne 6de9576fca swscale/vulkan: implement filtered reads for the SPIRV backend
Same as GLSL, but much more annoying due to descriptors.
2026-05-30 12:10:06 +09:00
Lynne d66552e676 vulkan/ffv1: add 32-bit float RGB encoding and a rice + remap path
This implements 32-bit float RGB encoding and makes the Vulkan implementation
on-par with the C implementation.

Sponsored-by: Sovereign Tech Fund
2026-05-30 12:10:01 +09:00
Michael Niedermayer 7a2424eb43 avcodec/apv_decode: avoid using apv_cbc
Fixes: out of array access
Fixes: evil.apv

Found-by: Claude (Anthropic). Human-verified and reported by Omkhar Arasaratnam <omkhar@linkedin.com>. on 05-20
Found-by: Anthropic agents; validated and reported by Ada Logics. on 05-26
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-29 20:10:14 +00:00
Michael Niedermayer aaac0989e6 avformat/mxfdec: Remove unneeded check
size is 16bit only

Found-by: Tomas Härdin
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-29 18:23:06 +00:00
Jerome Berclaz 468a743af1 avformat/dashenc: add options for live MPD timing 2026-05-29 03:25:53 +00:00
Michael Niedermayer 4d24cb1c39 avformat/ftp: Check string used for RNTO
Found-by: Forgejo Fairy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-29 01:49:20 +00:00
Michael Niedermayer 090838497c avformat/ftp: Check for Telnet IAC characters and other non printable ASCII chars
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-29 01:49:20 +00:00
Franciszek Kalinowski 640f32b1b6 avformat/ftp: reject CR/LF in the URL path to prevent FTP command injection
ftp_connect() interpolates the URL path into SIZE/RETR/STOR/CWD/DELE/RMD/RNFR
commands without checking for CR/LF, although it already rejects CR/LF in the
user and password fields. Reject CR/LF in s->path the same way.

Reported and reviewed by Franciszek Kalinowski (isec.pl / striga.ai) and Bartosz Śmigielski.
2026-05-29 01:49:20 +00:00
Michael Niedermayer 6631bbc5d4 avcodec/jpeg2000dec: Clear header derived variables
Fixes: NULL pointer dereference

Found-by: Oguzhan Akkaya with AFL++ fuzzing (May 2026)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-28 22:31:36 +00:00
Michael Niedermayer 0834dbed1c avcodec/bsf/smpte436m_to_eia608: properly frees stuff on errors in ff_smpte436m_to_eia608_filter()
Fixes: memleaks
Fixes: 501913473/clusterfuzz-testcase-minimized-ffmpeg_BSF_SMPTE436M_TO_EIA608_fuzzer-5607133705207808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-28 22:24:58 +00:00
James Almer de261b9bb2 tests/checkasm/crc: use libavutil memory allocation helpers
Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-28 22:04:27 +00:00
James Almer 224659360a tests/checkasm/crc: retain offset values between calls
Should fix buffer overflows as reported by clang-asan and use of uninitialized
values as reported by valgrind.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-28 22:04:27 +00:00
James Almer 93512bc2fd avformat/avc: Adjust get_ue_golomb() to handle 32 bit
Fixes: assertion failure
Fixes: PR-009/bad_extra_idr_only.avi

Found-by: mosskappa
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-28 21:46:48 +00:00
Michael Niedermayer af86ff142a fate/voice: add comfortnoise encoder-decoder FATE test
Add a CNG (comfortnoise) round-trip FATE test using the existing enc_dec_pcm + framemd5 pattern and include its generated reference output.
and a 2nd test that compares MD5 of the encoded stream

Tested on x86-32 & 64, arm, mips qemu

Co-Authored-with: AI
2026-05-28 21:01:13 +00:00
James Almer af4caa17a7 avcodec/libfdk_aac: simplify setting the layout mask
We can combine some cases in these switches as they set the same flags.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-28 13:23:42 +00:00
Omkhar Arasaratnam 7b46c6a2a3 avformat/whip: require remote DTLS fingerprint in SDP answer
WHIP relies on the SDP a=fingerprint to bind the peer identity to
the SRTP keying material (RFC 8842 §§ 5.1, 5.3). parse_answer()
walks the SDP body looking for `a=ice-lite`, `a=ice-ufrag:`,
`a=ice-pwd:`, and `a=candidate:` lines and ignores everything else,
including `a=fingerprint`. WHIP intentionally runs the OpenSSL DTLS
backend with s->verify=0 (DTLS-SRTP uses self-signed certs by
design, so a CA chain check would be meaningless); the peer cert is
accepted regardless of identity. The spec's compensating identity
control — verifying the DTLS peer cert against the SDP a=fingerprint
hash — is missing, so the SRTP keys are derived from a session
whose peer identity was never authenticated. Any on-path attacker,
or a malicious WHIP server URL, can substitute their own DTLS
material and the publisher's RTP stream will be encrypted to them.

The full fix is a two-step process:
  (a) Require a=fingerprint to be present in the SDP answer
      (RFC 8842 § 5.3 MUST).
  (b) After DTLS handshake, compute the peer-cert hash and compare
      against the stored fingerprint (RFC 8842 § 5.1 MUST); tear
      down the session on mismatch.
This patch implements step (a) only; step (b) requires plumbing
the cert hash out of dtls_start() through the openssl TLS context
and is left as a follow-up.

Add a remote_fingerprint field to WHIPContext, extract the
a=fingerprint value from the SDP answer in parse_answer(), and
return AVERROR(EINVAL) when it is absent. This raises the bar from
"no fingerprint required" to "any fingerprint required"; the
follow-up patch will raise it again to "fingerprint MUST hash-match
the DTLS peer cert."

Found-by: Claude (Anthropic). Human-verified and reported by
Omkhar Arasaratnam <omkhar@linkedin.com>.
Signed-off-by: Omkhar Arasaratnam <omkhar@linkedin.com>
2026-05-28 04:41:06 +00:00
Tim Walker c591ddd453 avformat/movenc: don't write a 'chan' atom with an incorrect channel bitmap or description. 2026-05-28 03:22:29 +00:00
Tim Walker 29bb6a771a avformat/movenc: re-order mov_codec_ch_layouts 2026-05-28 03:22:29 +00:00
Tim Walker 55ba902d71 avformat/movenc: re-indent mov_codec_ch_layouts 2026-05-28 03:22:29 +00:00
Tim Walker d4125bbce7 avformat/movenc: add channel layout mappings for a few codecs
These codecs cannot self-report layout in the bitstream, and
are known or expected to use a libavutil-compatible channel
order, and as such can use mov_ch_layouts_wav for tag lookup.
2026-05-28 03:22:29 +00:00
James Almer 3e402514e5 avcodec/aacencdsp: move init methods outside of the header
Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-28 00:04:06 -03:00
Tim Walker 5f14108864 avcodec/libfdk-aacdec: support streams with 5 front channels 2026-05-27 21:06:41 +02:00
Vann Harl fb5dd6ec60 avformat/tls_{openssl,gnutls,mbedtls}: gate DTLS udp helpers on CONFIG_UDP_PROTOCOL
ff_udp_get_last_recv_addr and ff_udp_set_remote_addr are defined in
udp.c which only compiles under CONFIG_UDP_PROTOCOL. Building with
--disable-everything plus a protocol whitelist that excludes UDP
left these references unresolved at link time, even though TLS
itself uses TCP. Wrap the DTLS UDP-remote-addr blocks accordingly
2026-05-27 11:41:32 +00:00
Aditya Banavi 28b92b9b2e avformat/tls_gnutls:fix crash when connecting to peer
When ffmpeg whip client takes up dtls_active role when using gnutls,
it tries to connect to the server over udp and intermittently crashes.
This is because s->host is NULL, and ffmpeg is in ice controlling mode.
The gnutls api - gnutls_server_name_set() crashes if the hostname is NULL.

This commit assigns valid value to s->host in such scenarios.

Signed-off-by: Aditya Banavi <adityabanavi@gmail.com>
2026-05-27 11:39:32 +00:00
Aditya Banavi df3511db5b avformat/tls: Moved the parsing of host uri into a separate function - ff_tls_parse_host()
This makes the function reusable and modular

Signed-off-by: Aditya Banavi <adityabanavi@gmail.com>
2026-05-27 11:39:32 +00:00
DROOdotFOO 30595cbc5d swscale/aarch64/yuv2rgb_neon: aggregate 16bpp predicates
The six .ifc cascades that gate 16bpp behavior in yuv2rgb_neon.S
(linesize padding in three load_args macros, d8/d9 save/restore,
main-loop pack dispatch) all branch on the same four output formats.
Aggregate the predicate into four GAS .set symbols emitted once per
declare_func via a new set_rgb16_predicates macro:

  rgb16   - 1 for *565le and *555le outputs; 0 otherwise
  r_first - 1 for rgb*le (R high); 0 for bgr*le (B high)
  gshift  - 2 for 565, 3 for 555 (passed as pack_rgb16's g_shr)
  hshift  - 11 for 565, 10 for 555 (passed as pack_rgb16's high_shl)

Call sites become a flat ".if rgb16" gate (five places) plus a 2-way
".if r_first" inside ".if rgb16" for the pack dispatch (one place).
.if/.endif count drops from 46 to 33; -88/+49 lines net.

Pure source-level refactor: the full object disassembly is byte-for-byte
identical to the pre-refactor build (MD5 2a6ac497cabc81849e0c80ec0fde0550
on Apple M1, clang). checkasm --test=sw_yuv2rgb 110/110, full checkasm
7657/7657.

Signed-off-by: DROOdotFOO <drew@axol.io>
2026-05-26 19:26:28 +02:00
Ramiro Polla 0ac3b00a18 avcodec/mjpegdec: simplify bayer width handling
Double s->avctx->width directly, simplifying width-related code in
ljpeg_decode_rgb_scan().
2026-05-26 11:19:14 +02:00
Ramiro Polla 2065ead16e avcodec/mjpegdec: remove redundant vpred variable for bayer
The vpred variable in ljpeg_decode_rgb_scan() is redundant with
buffer[0][i], which is used by the generic codepath.
2026-05-26 11:19:14 +02:00
Lynne 9a6b5ca197 vulkan/ffv1_enc_rct_search: fix slice dimension iterations
This was a mess, we were using incorrect pixels outside of the image boundaries as
valid, the iteration had undefined behaviour since it was non-uniform across the workgroup.

Calculate the per-invoc iterations from the slice dimensions instead, making all of
them identical. And add a valid flag to decide whether to use them or not. And fix the
synchronization.

Sponsored-by: Sovereign Tech Fund
2026-05-26 17:47:04 +09:00
Lynne 9cabb12f74 vulkan/ffv1_enc_rct_search: write slice_rct_coef directly by main invoc
The issue is that SliceContext was passed as an inout, which caused all
invocs to locally copy and modify it.
When the main invoc wrote it, only the very last written value was used,
choosing the wrong coeffs.

Sponsored-by: Sovereign Tech Fund
2026-05-26 17:47:04 +09:00
Lynne 5fc56fbf96 vulkan/ffv1_enc_rct_search: barrier before reading score_mode
There was a race condition where the main invocation would race ahead and use
values not yet written by other invocs.

Sponsored-by: Sovereign Tech Fund
2026-05-26 17:47:04 +09:00
Lynne 2806afd28f vulkan/ffv1: read raw 16-bit float images via R16_UINT view to preserve denormals
GPUs filter out denormals when reading floats via imageLoad. Denormals shouldn't
be present in general, but if they are, this is a lossless codec, and we have to
preserve them. This allows reading the exact values.

Sponsored-by: Sovereign Tech Fund
2026-05-26 17:47:04 +09:00