1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

120139 Commits

Author SHA1 Message Date
82fa6b450d avcodec/dfpwmenc: Remove write-only context member
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:18:55 +02:00
11d3af0d7f avcodec/dfpwmenc: Correctly pad input
Before this patch, the DFPWM1a encoder was marked as supporting
variable frame sizes. The DFPWM1a format converts eight bytes
of input into one output byte and so it simply padded the number
of data output by
frame->nb_samples * frame->ch_layout.nb_channels / 8 +
(frame->nb_samples % 8 > 0 ? 1 : 0)
This has several bugs:
a) The additional byte leads to eight additional input byte being
read; this can read into the frame's padding, i.e. the data can
be uninitialized.
b) The criterion for whether one should pad is wrong:
nb_samples * nb_channels should be tested for divisibility by eight.
c) The created frames can be undecodable (at least with our decoder):
Our decoder requires the number of bits per frame to divisible by
the number of channels, yet the above approach does not guarantee this.
d) The padding will be added in the middle of the stream (potentially
for every packet).

This commit fixes all of this by removing the variable frame size cap
and using AVCodecInternal.pad_samples to pad the last frame so that
nb_samples * nb_channels is always a multiple of eight.
The lavf-dfpwm FATE-test was affected by a). The frames originated from
lavfi and were part of an audio frame pool, so that the padding
contained data from an earlier (bigger) frame. Now the last frame is
properly filled with silence.

Reported-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:18:55 +02:00
e813e1e940 avcodec/fic: Postpone duplicating AVFrame buffer
This avoids duplicating the AVFrames in case of skip frames
or in case of errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 19:42:29 +02:00
45920251d9 avcodec/fic: Ensure skip frames have up-to-date props
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 19:42:29 +02:00
8bed944dda avcodec/fic: Don't prematurely claim to have decoded a frame
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 19:42:29 +02:00
4c69f302a9 avcodec/fic: Remove redundant logmessage
ff_reget_buffer() emits its own logmessage on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 19:42:28 +02:00
12ae987a6a avcodec/fic: Don't copy frame unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 19:42:28 +02:00
d6986e1fcd avcodec/fic: Avoid implicit av_frame_free()+av_frame_alloc()
Use av_frame_replace() instead. Also remove the error message:
It was highly misleading (as if av_frame_clone() duplicated
the AVFrame data buffers instead of just creating a new reference).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 19:42:28 +02:00
5d5e922088 avcodec/fic: Avoid copying cursor unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 19:42:28 +02:00
2845013154 tests/fate/screen: Add test for skipping cursor with FIC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 19:42:28 +02:00
2db60f90df swresample/rematrix: Constify
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 18:17:56 +02:00
589f1e5cc7 swresample/rematrix: Use correct function pointer types for calls
Calling a function via a different function pointer type is
undefined behavior (C11, 6.3.2.3 8); two pointer parameters
of different type are not equivalent in this regard, although
it happens to work in practice; the current code relies on this.

This patch brings the code in line with the spec. This fixes the
following FATE-tests when run with Clang-UBSan:
ac3-fixed-encode-2 audiomatch-afconvert-{16000,44100}-mono-he-{adts,m4a}
audiomatch-dolby-44100-mono-he-mp4 filter-metadata-avf-aphase-meter-mono
filter-pan-{downmix1,downmix2,mono2,stereo2,stereo3,stereo4,upmix1,upmix2}
lavf-dv_{pal,ntsc} matroska-encoding-delay
The error was something like
src/libswresample/rematrix.c:621:17: runtime error: call to function sum2_float through pointer to incorrect function type 'void (*)(void *, const void *, const void *, void *, int, int, int)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 18:17:56 +02:00
bdb4cd44e2 avcodec/ffv1enc: Use dummies to avoid UB pointer arithmetic
Fixes the following FATE-tests when run under Clang-UBSan:
ffmpeg-loopback-decoding, lavf-mxf_ffv1,
vsynth{1,2,3,_lena}-ffv1-v{0,2}, vsynth1-ffv{1,2,3,_lena},
vsynth{1,2,3,_lena}-ffv1-v3-yuv{420p,422p10,444p16}

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 18:17:56 +02:00
134c1d81a4 avcodec/indeo3: Constify ref_block in decode_cell_data()
Also use smaller scope while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 18:17:56 +02:00
41d86b5be5 avcodec/indeo3: Consistently use ptrdiff_t for strides
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 18:17:56 +02:00
7574c55761 avcodec/indeo3: Fix UB pointer arithmetic
Fixes the following error when running with Clang-UBSan:
src/libavcodec/indeo3.c:556:26: runtime error: applying non-zero offset 2560 to null pointer
This fixes the indeo3-2 FATE test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 18:17:56 +02:00
11d1b71c31 doc/APIchanges: add missing entries for the recent changes
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-01 23:28:24 -03:00
5083f4ad8e avcodec/nvenc: add MV-HEVC encoding support
Added support for MV-HEVC encoding for stereoscopic videos (2 views
only). Compatible with the framepack filter when using the
AV_STEREO3D_FRAMESEQUENCE format.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
2025-07-01 22:47:47 +02:00
9c2028b806 avcodec/hevc/hevcdec: export 3D Reference Displays side data
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-01 22:47:34 +02:00
dbe347f074 avfilter/vf_showinfo: add support for 3D Reference Displays Information side data
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-01 22:46:22 +02:00
2122f04496 avformat/dump: add support for 3D Reference Displays Information side data
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-01 22:46:22 +02:00
39d5a998bd avcodec/packet: add a 3D Reference Displays Information side data type
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-01 22:46:19 +02:00
b2e4b0e282 avutil/frame: add a 3D Reference Displays Information side data type
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-01 22:42:53 +02:00
80a05bea4f avutil: add an API to handle 3D Reference Displays Information
As defined in section G.14.3.2.3 of ITU-T H.265, it's required for proper
signaling of MV-HEVC.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-01 22:41:56 +02:00
3b9dbda49b tools/pktdumper: dump extradata buffers 2025-07-01 16:45:08 +10:00
5bcff199d9 doc: Remove libav-merge.txt
It not longer exists.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2025-06-30 15:00:49 +01:00
b58cca5a27 tools: Remove libav-merge-next-commit
Libav is no longer extant.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2025-06-30 15:00:34 +01:00
cfd1f81e7d avcodec/speexdec: consider differing frame sizes in remaining space check
Fixes: talk109-q5.spx
Regression since: f6986e75be

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-28 23:54:40 +02:00
89ec66d61b libavcodec/tests: fix gitignore hashtable
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-28 23:54:40 +02:00
a17596f55b avfilter/vf_lut3d: fix leak if allocate_3dlut failed
In parse_cinespace(), memory allocated in in_prelut[] and out_prelut[]
would leak if allocate_3dlut() failed. Replace return ret with goto end
to free memory before return error code.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-28 23:54:40 +02:00
40a3d35da6 avcodec/vorbisenc: fix leak if av_mallocz failed
In put_main_header(), av_mallocz() allocates memory to local variable
buffer, buffer leaks if av_mallocz() to *out failed. Add av_free(buffer)
before return error code.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-28 23:54:39 +02:00
7d38486975 avcodec/vvc/refs: remove early return
The ret value is checked later on again, so this check
is redundant and would cause the frame to not be unrefd on
failure as well.

So remove this check and add one before av_frame_remove_side_data
to ensure it is not called with an invalid frame.

Fix CID 1648350

Reviewed-by: Frank Plowman <post@frankplowman.com>
2025-06-28 15:16:45 +02:00
6e8bd5dd25 avformat/apvdec: add framerate option
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-27 22:32:51 -03:00
59a6660625 avformat/demux: Fix segfault due to avcodec_open2 failure
Fixes 'ffprobe 1_poc.mp4' segfault introduced with
commit 0021484d05

codec_close should not assume that the codec_id did not change.
2025-06-27 19:31:26 -06:00
18c62245d7 fftools/textformat: renamings in print_unit_int for consistency (cosmetic)
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-27 00:24:35 +02:00
2b25a66238 fftools/textformat: fix print 64 bit integers
Regression in ffprobe since textformat introduction
in d7a3f68fea.

Fixes #11638

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-27 00:23:57 +02:00
5c1e10d995 fftools/textformat: do not return early
This would make the goto dead code and also would not properly
call avtext_context_close.

Fix CID 1646939

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
564a0784bb fftools/textformat: remove noop free
The tctx->hash was freed already right before.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
8430b8f9a9 fftools/textformat: narrow variable scopes
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
7771a4eecb fftools/textformat: remove leftover comments in mermaid_print_value
Remove some leftover commented code and an extraneous semicolon.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:23:35 +02:00
0578d4ad2f fftools/textformat: exit early in mermaid_print_value
Doesn't change the logic, instead of exiting in each of the two
branches below, just exit before.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:23:35 +02:00
540a2497d2 lavc/vvc: Fix condition for using default scaling factor
Add handling here for
sps_scaling_matrix_for_alternative_colour_space_disabled_flag.

Also add parentheses to make behaviour a little more explicit,
where &&'s precedence over || was relied on previously.

Reported-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-06-27 06:06:14 +09:00
f8a9d9473b avformat/whip: check the exchange sdp url is start with http
Make sure the WHIP protocol performs the SDP offer/answer
exchange with the WebRTC peer over HTTP.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Reviewed-by: Jack Lau <jacklau1222@qq.com>
2025-06-26 22:20:07 +02:00
87808e38a8 avformat/whip: Remove unnecessary pkt checks
h264_annexb_insert_sps_pps (called after write_packet)
reorganizes PPS, SPS, and IDR packets in H.264 streams.
Since write_packet already validates pkt,
redundant null checks in h264_annexb_insert_sps_pps can be removed.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
2025-06-26 21:46:18 +02:00
1abc25cd23 avformat/iamf_parser: remove unreachable code
expanded_loudspeaker_layout is only present and read on the first layer.

Fixes Coverity issue #1655173.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-26 16:33:04 -03:00
bd75fad85f hwcontext_vulkan: fix issues with importing a device
The previous fix just used a local variable for the memory properties,
which did not fix this issue.
2025-06-27 03:09:27 +09:00
f744584f71 avformat/tee: fix multiple bsfs in tee
Since 155508c6e9 specifying multiple
bsfs for different streams was broken:

"[bsfs/a=h264_metadata:bsfs/v=h264_metadata]out.mp4|..."

This incorrectly only parsed the first bsfs specification. The reason
for this is that the dictionary is modified in the iterator, hence
invalidating the iterator. The simplest fix for this is to simply
iterate from the beginning in each loop given that the previous entry
is removed.
2025-06-26 17:35:46 +02:00
64fce7202c acvodec/amfenc: Enable use of AMF Surface in multiple encoders
Fixes the behavior of AMF encoders when the same AMF surface is passed
to multiple encoder objects.
for example when using -filter_complex
2025-06-26 13:48:26 +02:00
b2c0d37be5 avcodec/amfdec: Add VP9 AMF decoder 2025-06-26 13:48:15 +02:00
09cd38e9d5 avcodec/rv60dec: drop unused sum variable in read_slice_sizes
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Peter Ross <pross@xvid.org>
2025-06-26 18:01:03 +10:00