1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00
Commit Graph

121282 Commits

Author SHA1 Message Date
Damiano Galassi
f7a9cd23e8 avformat/movenc: fix mov_create_dvd_sub_decoder_specific_info
It has been broken since 3064487.

(cherry picked from commit 1aefacfda4)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-10-22 02:01:46 +00:00
Marvin Scholz
d19d80efd2 avcodec/aac: fix null dereference in che_configure
During USAC decoding (ff_aac_usac_decode_frame), configuration elements
can be mapped and instantiated via che_configure(). For newly allocated
ChannelElement structs, che_configure calls sbr_ctx_alloc_init() which
dynamically allocates ac->che[type][id]. However, che_configure did not
subsequently map the output pointer of the nested SingleChannelElement
elements back to their statically-sized internal ret_buf arrays, causing
a null pointer dereference during IMDCT windowing.

The fix explicitly initializes these pointers following allocation.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
(cherry picked from commit 8319541103)
2026-10-21 19:42:49 +00:00
Marvin Scholz
3c682777fd avcodec/mvcdec: zero-initialize color array
Fixes MSAN use-of-uninitialized-value.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
(cherry picked from commit 3a5eb948e7)
2026-10-21 19:07:54 +00:00
Michael Niedermayer
ec5c5245d6 avcodec/aac/aacdec_usac: check the element list against the channel configuration
Fixes: NULL pointer dereference
Fixes: bMZdbdGgJICu
Fixes: aac_usac_null.mp4
Regression since: eee5fa0808
Found-by: Glops Elemiu

(cherry picked from commit 23316a12ac)

Assisted-by: Fairy
2026-10-21 07:56:49 +00:00
Vincent Herbst
4b65e17fb4 avfilter/vf_yadif_videotoolbox: fix over-release of autoreleased Metal objects
call_kernel() obtains the command buffer and compute encoder from
property getters (mtlQueue.commandBuffer, buffer.computeCommandEncoder),
which return autoreleased references under the non-ARC build, and then
releases them via ff_objc_release(). That is an over-release: when the
enclosing autorelease pool is drained, the objects are released a second
time and the process crashes with EXC_BAD_ACCESS in objc_release.

On current macOS this is reproducible with the ffmpeg CLI itself. The
filter thread's thread-local autorelease pool is popped during pthread
TSD cleanup at thread exit, so any run that used yadif_videotoolbox
crashes when the filter thread terminates:

  ffmpeg -init_hw_device videotoolbox=vt -filter_hw_device vt \
    -f lavfi -i testsrc2=size=640x480:rate=30 \
    -vf setfield=tff,format=nv12,hwupload,yadif_videotoolbox,\
  hwdownload,format=nv12 -frames:v 20 -f null -

  Thread 11 Crashed:: vf#0:0
  0 libobjc.A.dylib  objc_release + 16
  1 libobjc.A.dylib  AutoreleasePoolPage::releaseUntil(objc_object**) + 204
  2 libobjc.A.dylib  objc_autoreleasePoolPop + 244
  3 libobjc.A.dylib  objc_tls_direct_base<...>::dtor_(void*) + 156
  4 libsystem_pthread.dylib  _pthread_tsd_cleanup + 620
  5 libsystem_pthread.dylib  _pthread_exit + 84

Host applications hit the same crash earlier, for example when a
dispatch queue drains its last-resort pool after a work item that ran
the filter.

Wrap the kernel invocation in @autoreleasepool and drop the manual
releases, making the pool pop the single balanced release and draining
the Metal transients once per frame. The ff_objc_release() calls on the
s->mtl* members in do_uninit() stay: those hold owned references
obtained from new* methods.

(cherry picked from commit 7f2e5cdd7c)
2026-10-20 02:01:09 +00:00
Martin Storsjö
7c5a1e62f6 configure: Improve the check for schannel DTLS constants
This amends 307983b292 to fix
building with older versions of mingw-w64.

The previously checked constant, SP_PROT_DTLS1_X_CLIENT, was
added in mingw-w64 in df36f5deda23192d0ee99ffd661ea36df924e667
in 2020, and is included in released versions since v8.0.0.

The new checked constant SECPKG_ATTR_DTLS_MTU was added in
mingw-w64 in 0792283787cca8fc27dd38671107c791c87f4db3 in 2021,
and first appeared in mingw-w64 v9.0.0.

This fixes building with mingw-w64 v8, which is the version bundled
in Ubuntu 22.04.

(cherry picked from commit f6bcd661f0)
2026-10-14 23:49:49 +02:00
Michael Niedermayer
bad4558dd0 avformat/asfdec_f: index the seek position table by ASF stream number
Fixes: stack buffer overflow
Fixes: M3Ib1Zm6OX8V/testcase/crafted.asf / gen.py
Fixes: M3Ib1Zm6OX8V
Found-by: Zheng Yu @ Depthfirst
(cherry picked from commit 1088e8b43e)
2026-10-14 23:49:49 +02:00
Niklas Haas
4db49e7ec8 fftools/ffmpeg_sched: prevent demuxers from getting stuck
When the furthest-behind stream is being fed by a demuxer that is also
feeding packets to a choked filter graph, we need to unchoke that filter
graph to prevent the demuxer from getting stuck trying to write packets to
the choked filter graph.

This situation can also apply recursively - if the demuxer is also writing
to a filtergraph that is also reading from a choked demuxer, there is a
similar deadlock.

Solve all such deadlocks by just brute-force recursively unchoking all
nodes that can somehow prevent this demuxer from writing packets. This
should normally not result in any change in behavior, unless audio/video
streams are badly desynchronized, in which case it may result in extra
memory usage from the too-far-ahead stream buffering packets inside the
muxer. (But this is, of course, preferable to a deadlock)

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20611
(cherry picked from commit 133a0bcb13)
2026-10-14 23:49:49 +02:00
Michael Niedermayer
71cb25decd avcodec/ppc/vp8dsp: store the 16 pixel wide rows at any alignment
(cherry picked from commit 4be657ffd8)
2026-10-14 23:49:49 +02:00
Michael Niedermayer
88da77b90d avfilter/spectrumsynth: negotiate one pixel format for both inputs
Fixes: out of array access
Fixes: ndSS0e433gq
Found-by: Eunsoo Kim, Microsoft FORGE Labs
(cherry picked from commit 4d896a22dd)
2026-10-14 23:49:49 +02:00
Michael Niedermayer
17943768e4 avformat/hlsproto: derive the target duration when EXT-X-TARGETDURATION is missing
Fixes: infinite loop
2026-10-14 23:49:49 +02:00
Michael Niedermayer
f76bd694c3 avformat/hlsproto: reject NaN and out of range EXTINF
Fixes: #EXTINF:nan and #EXTINF:1e300
2026-10-14 23:49:49 +02:00
Michael Niedermayer
9bec746fe0 avformat/hlsproto: reject out of range EXT-X-TARGETDURATION
Fixes: signed integer overflow: 2148 * 1000000 cannot be represented in type 'int'
2026-10-14 23:49:49 +02:00
Michael Niedermayer
06b9b57bee avformat/hlsproto: clamp EXTINF and target duration to a 1ms minimum
Fixes: infinite loop
Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21492
Found-by: Kery
2026-10-14 23:49:49 +02:00
Christopher Decker
f2e4aea38d avformat/os_support: fix return value of win32_rename
The return value of MoveFileExW was not being correctly interpreted,
see https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw.

On Windows a failed rename over the file: protocol now surfaces as failed to rename file %s to %s:
Operation not permitted (ff_rename, libavformat/avio.c:867) plus an AVERROR(EPERM) return, where previously the muxer
reported success and the user was left with a missing or stale output file and no diagnostic. This affects the
write-to-temp-then-rename paths in hlsenc, dashenc, hdsenc, smoothstreamingenc, segment, and img2enc (e.g. HLS/DASH
playlist updates, -write_temp_file, segment list finalization).

Also, added unit tests to exercise the rename function.

Signed-off-by: Christopher Decker <chris.decker08@gmail.com>
(cherry picked from commit 94ff335d76)
Co-Authored-by: Fable 5
2026-10-14 23:49:49 +02:00
Lynne
2dfe5c58f8 vulkan_encode: fix leak and swallowed errors in init_base_units()
The encoded session parameters buffer was never freed, and both
GetEncodedVideoSessionParametersKHR error paths returned err, which
is always 0 at that point, reporting success on failure.

(cherry picked from commit b672ae3905)
Co-Authored-by: Fable 5
2026-10-14 23:49:49 +02:00
Raja-89
c062b0b380 avfilter/dnn: fix async teardown race condition in all backends
When the filter graph is torn down early (e.g. at EOF with -frames:v),
the main thread calls dnn_free_model and destroys the request queue
while async inference threads may still be running. When a detached
thread finishes and tries to push its result back to the destroyed
queue, it triggers a segmentation fault.

Add ff_dnn_wait_requests() to dnn_backend_common which blocks
until all allocated request items (ctx->nireq) have been safely
returned to the request_queue. Call it from dnn_free_model in the
torch, tensorflow, openvino, and onnx backends before destroying the queue.

(cherry picked from commit b52c71e438)
Co-Authored-by: Fable 5
2026-10-14 23:49:49 +02:00
Dan Dennedy
e78560fc3d scale_d3d11: Fix hw_frame_ctx reference leak
This fixes #20995. The reference is taken twice and assigned to the same pointer (see above in the same function). Only the latter is needed.

(cherry picked from commit 66a8c37582)
2026-10-14 23:49:23 +02:00
Omkhar Arasaratnam
69132da1f9 avformat/tls_openssl: bind peer identity for numeric-IP verify
tls_open() installed a peer-identity target only when the URL host was
non-numeric. For a numeric-IP target the whole block was skipped, so
with verify=1 OpenSSL validated the chain to a trusted CA but bound no
identity, and any publicly-trusted certificate for any name was accepted
(e.g. tls://203.0.113.10?verify=1).

Run the identity block for every non-listening connection. Classify
s->host with the same getaddrinfo(AI_NUMERICHOST) rule tls.c uses. A
numeric host is pinned to the certificate's iPAddress SAN by handing
OpenSSL the parsed binary address via X509_VERIFY_PARAM_set1_ip();
everything else, including a verifyhost=<name> override, binds by name
via SSL_set1_host(). Passing the binary address rather than re-probing
the ASCII form pins legacy numeric spellings such as 2130706433 as IPs
instead of letting them fall back to hostname matching. SNI is still
suppressed for numeric transport hosts (RFC 6066 sec. 3) via
s->numerichost.

The identity target is installed unconditionally for non-listening
connections; whether the certificate is actually verified stays
controlled separately by SSL_CTX_set_verify() under s->verify, so
disabling verification keeps the prior behaviour. Sets AVERROR_EXTERNAL
with an explicit log line on failure.

dtls_open() sets s->is_dtls and then calls tls_open(), so DTLS client
connections run through the same identity block and are covered here.

Found-by: Claude (Anthropic). Human-verified and reported by
Omkhar Arasaratnam <omkhar@linkedin.com>.
Signed-off-by: Omkhar Arasaratnam <omkhar@linkedin.com>
(cherry picked from commit 83c6922826)
2026-10-14 23:49:23 +02:00
Michael Niedermayer
2708223ade avcodec/bsf/dts2pts: evict unconsumable nodes from the poc tree
Each pending packet consumes up to poc_diff tree nodes when it is
output, so the packets in the FIFO can consume at most nb_pending nodes
in total. Frames whose tree lookup misses on output leave their nodes
behind, and damaged or crafted streams can make that happen
indefinitely, growing the tree without limit.

Track the node count and insertion order, keep the leftovers of up to
MAX_DAMAGED_FRAMES frames and beyond that evict the nodes unconsumed
the longest. Timestamps of valid frames are unaffected unless more
frames than that are damaged. No eviction is done at EOF, where nodes
are deliberately kept to regenerate timestamps from.

Of all h264/hevc conformance samples only MR3_TANDBERG_B.264 triggers
evictions, and no sample changes output.

Fixes: unbounded memory growth with damaged streams

Co-Authored-By: Fable-5
(cherry picked from commit dd941af8ac)
2026-10-14 23:49:23 +02:00
Michael Niedermayer
8828db3bf2 avcodec/bsf/dts2pts: fix removal of 2nd field nodes
alloc_and_insert_node() inserts the nodes for 2nd fields with
duration / poc_diff added to the timestamp, but the removal loop
compared all nodes of a frame against the unadjusted first timestamp,
so 2nd field nodes never matched and stayed in the tree until close.
Advance the compared timestamp the same way the insertion does.

Fixes: tree nodes leaking on every field coded frame

Co-Authored-By: Fable-5
(cherry picked from commit 4133db39b2)
2026-10-14 23:49:23 +02:00
James Almer
dfcc4feaaa avformat/mov: check ff_mov_read_chnl return value
Fixes use of uninitialized value.
Fixes issue #24960.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-11 11:10:01 -03:00
Timo Rothenpieler
49db6da851 avformat/imfdec: don't busy-loop if non-Asset in Asset-list
(cherry picked from commit ef305e32e8)
2026-10-09 23:25:11 +00:00
Diego de Souza
87fdf8f8fd avcodec/dxva2: fix frame->buf[] data race with frame threading
ff_dxva2_common_end_frame() adds a reference to the decoder to
frame->buf[], so that the decoder outlives the frames decoded with it.
It is called from the hwaccel end_frame() callback, which with frame
threading may run after ff_thread_finish_setup(). From that point on,
other threads may copy the frame: the H.264 decoder keeps a separate
AVFrame per picture in each thread and synchronizes them in
update_thread_context() with av_frame_replace(), which reads
frame->buf[] while the decoding thread may be writing to it. As noted
in fa77cb258b ("avcodec/h264dec: Fix data race when updating
decode_error_flags"), a decoding thread must not modify any field that
av_frame_ref() copies after ff_thread_finish_setup().

This has been observed as an intermittent access violation in
av_buffer_replace() when decoding H.264 with D3D11VA and frame
threading on Windows on Arm: the copying thread read a non-NULL
frame->buf[1] entry, but saw the fields of the AVBufferRef it points
to as zero, and dereferenced the NULL buffer pointer when incrementing
the reference count.

Store the decoder reference in FrameDecodeData.hwaccel_priv instead,
as nvdec does for its per-frame state. The decode data is attached to
frame->private_ref when the buffer is allocated, before
ff_thread_finish_setup(), and all references to the frame share it, so
update_thread_context() only takes a new reference to it. The decoder
reference is added to frame->buf[] by hwaccel_priv_post_process(),
which runs in the caller's thread when the frame is returned, so
returned frames keep the decoder alive. Since the decode data
is shared, the second field of a field pair no longer adds a second
decoder reference to the frame.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
(cherry picked from commit 538d10d187)
2026-10-08 21:33:25 +02:00
James Almer
938c25c067 avcodec/decode: add a hwaccel specific post_process callback to FrameDecodeData
Leave the existing one for non decoder-specific, post processing usage.
With this, scenarios like nvdec decoding can work algonside lcevc enhancement application.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-08 21:33:25 +02:00
Timo Rothenpieler
44c539c742 avfilter/vf_scale_cuda: consider chroma subsampling for scaling decisions
(cherry picked from commit a621ef4291)

Assisted-by: Fairy
2026-09-30 18:30:03 +00:00
Timo Rothenpieler
8f19abedf1 avfilter/vf_scale_cuda: always have valid passes setup
(cherry picked from commit 4566eee588)

Assisted-by: Fairy
2026-09-30 18:30:03 +00:00
Timo Rothenpieler
f5ee98d5cb avfilter/vf_scale_cuda: extract pass determination into its own function
(cherry picked from commit dda8b8253c)

Assisted-by: Fairy
2026-09-30 18:30:03 +00:00
Timo Rothenpieler
f54f34e2b8 avfilter/vf_scale_cuda: skip allocating intermediate texture if not needed
(cherry picked from commit 3d7ea1dac4)

Assisted-by: Fairy
2026-09-30 18:30:03 +00:00
Timo Rothenpieler
17ddfe3ef3 avfilter/vf_scale_cuda: don't try to execute disabled filter passes
(cherry picked from commit 50a9e34e1b)

Assisted-by: Fairy
2026-09-30 18:30:02 +00:00
Timo Rothenpieler
a11352c9a0 avcodec/aacsbr_template: don't leak on ff_aac_sbr_ctx_alloc_init failure
Fixes: #YWH-PGM40646-23
(cherry picked from commit e383b7d532)
2026-09-29 20:15:24 +00:00
Timo Rothenpieler
2e47de6390 avfilter/vf_convolution: don't assume frame is multiple of 16 pixels wide
Limit the 8-bit column filter to the pixels remaining in the current slice. Pass slice_end - y at all three call sites so both the 8-bit and high-bit-depth column filters receive the correct remaining width. This handles partial 16-pixel blocks at frame and thread-slice boundaries. The non-column callbacks do not use this argument.

Fixes: #YWH-PGM40646-36
(cherry picked from commit 8b9e02cc17)
2026-09-29 19:58:53 +00:00
Timo Rothenpieler
c0c5477b34 avformat/mux: don't let positive write_trailer ret shadow pb failure
(cherry picked from commit 1de217ad4b)
2026-09-29 19:25:59 +00:00
Sergei Iashin
5228c6e8c5 libavformat/dashenc.c: check if packets were muxed before calculating average bitrate
Prevents SIGFPE.
Fixes issue #24738.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d62aef2e50)
2026-09-27 11:51:30 -03:00
Timo Rothenpieler
307181df23 avformat/mov: don't leak on realloc failure
Fixes: #YWH-PGM40646-48
(cherry picked from commit d975849594)
2026-09-26 16:04:57 +00:00
Werner Robitza
86a237700e avcodec/liboapvenc: fix build with openapv >= 1.1
openapv 1.1 changed oapvm_create() to take a descriptor argument.
This was first raised here:
https://github.com/homebrew-ffmpeg/homebrew-ffmpeg/issues/235

(cherry picked from commit c54710db21)
2026-09-26 14:46:44 +00:00
James Almer
057187f162 avcodec/libfdk-aacdec: clear and reset some fields when flushing
The decoder can't know where a seek landed, so the "delay_samples" way to
discard the decoder delay in the first frame is not truly viable, so it needs
to be removed.
Add a call to aacDecoder_DecodeFrame() with the AACDEC_CLRHIST flag set, as the
call to aacDecoder_SetParam() with the AAC_TPDEC_CLEAR_BUFFER setting was
seemingly not enough to truly flush all the fdkaac internal buffers.

Should fix issue #24527.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit b894a6f7c1)
2026-09-20 00:10:55 +00:00
James Almer
e56c86abe8 avcodec/libfdk-aacdec: properly handle decoder delay
Shift timestamps when available, and take into account the caller requested
samples to be discarded alongside the decoder delay.

Should fix issue #24526.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit c8595be8e6)
2026-09-20 00:10:55 +00:00
James Almer
4630de429c avcodec/libfdk-aacdec: fix the check for downmix layout order
The code reads a mask afer this check, meaning it expects NATIVE order, not
others.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 7755d264bd)
2026-09-19 21:09:52 -03:00
Zhao Zhili
c28e268920 avfilter/vf_scale_cuda: fix non-scaling format conversion
A format-only conversion leaves the auto use_filters value unresolved.
Regression since 5d0748243f.

Fix issue #23737

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit c57660fb18)

Assisted-by: Fairy
2026-09-16 10:29:09 +00:00
James Almer
2e803883b7 avformat/iamf: backport assorted fixes
Too many merge conflics to attempt individual cherry-picks.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-09-15 00:20:51 -03:00
Gyan Doshi
befe04e0dc ffmpeg: fix matching of non-apic stream specifiers
The capital V specifier as in '-c:V' is supposed to match only non-attached-pic video streams.

However, a user reported that apic streams were matched as well.
Confirmed by testing. Apparently a regression since before 3.4 (earliest ver I could test).

This happens because encoder selection occurs before stream dispositions are set.

Fixed by an initial assignment of disposition and retaining only the apic flag if present.

PR #24247

(cherry picked from commit 266fff15a0)
2026-09-11 04:38:47 +00:00
James Almer
322ca5a5dd avcodec/bsf/dca_core: clear profile value on init()
The output stream no longer has extension sub-streams, so the
declared input profile, if it was set, is no longer valid.

Fixes issue #24388.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 7dc71230a9)
2026-09-06 23:19:40 +00:00
Kacper Michajłow
281c902aa1 avcodec/h264_direct: do not read the other field's rows of colocated mb_type
To determine whether the colocated picture is field coded, the temporal
and spatial direct setup peek at
sl->ref_list[1][0].parent->mb_type[mb_xy] before mb_xy has been remapped
to the colocated field's parity. That row belongs to the current field's
parity, while await_reference_mb_row() above waited on the parity of the
referenced field, so whenever the two differ the load is unsynchronised
and with frame threading can observe macroblocks of a field that is
still being decoded.

Every macroblock of a field picture has MB_TYPE_INTERLACED set, so
checking field_picture first gives the same result in all correctly
synchronized cases without touching the mb_type array.

This also fixes few TSAN reported warnings.

Fixes: https://trac.ffmpeg.org/ticket/10891
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit c3a8a223b29260dc170d41c62f9b3b33f6b97b2d)
2026-08-26 00:43:05 +00:00
Kacper Michajłow
52c7119332 avcodec/h264_slice: clear the ER picture when starting a second field
h264_frame_start() clears h->er.cur_pic, and decode_nal_units() only sets
it again for pictures that are not field coded, right before running error
concealment. A second field goes through neither, so h->er.cur_pic keeps
pointing at whatever frame coded picture the context decoded earlier.

With frame threading the two fields of a pair are decoded by different
contexts, so whether this triggers depends on what the context that picks
up the second field decoded before, which is why the number of bogus
warnings varies between runs.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit f1d318e5eb2eb487d2be4b4b721b93ae76fd5ba7)
2026-08-26 00:43:04 +00:00
Brad Smith
39fdd1d717 avcodec/mips/cabac: Fix building on OpenBSD/mips64
src/libavcodec/mips/cabac.h:160:77: error: instruction requires a CPU feature not currently enabled
  160 |         PTR_SUBU   "%[tmp1],         %[c_low],        %[tmp1]             \n\t"
      |                                                                             ^
<inline asm>:13:2: note: instantiated into assembly here
   13 |         movz       $15,          $13,          $24
      |         ^

OpenBSD targets MIPS III ISA.

Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit 9432f85830)
2026-08-14 19:57:12 -04:00
Kacper Michajłow
4a8de2f21c avcodec/pthread_frame: sync decoded side data to all worker threads
Previously only the first thread's context and the user-facing one had
it, so frames decoded by the remaining worker threads were missing
global side data whenever the per-frame state could not provide it, e.g.
extradata-derived HDR metadata after avcodec_flush_buffers().

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit c48230eb86)
2026-08-14 18:31:38 +00:00
Kacper Michajłow
7971ddf245 avcodec/h264_direct: await both fields of a colocated field pair
When a frame coded picture uses a complementary field pair as its
colocated picture, ff_h264_direct_ref_list_init() selects the field whose
POC is closest to the current one and stores it in col_parity. The direct
mode setup then remaps mb_xy to that parity and reads the colocated
mb_type, motion_val and ref_index from it.

await_reference_mb_row() waits on the field given by "ref_field_picture &&
ref_field", which is 1 for any such reference, since the pair is
referenced as a frame and ref->reference is 3. Only the bottom field is
therefore awaited, while the data is just as likely to be read from the
top one. With frame threading the two fields are decoded by different
threads, so the colocated data can be read while the field it belongs to
is still being decoded, yielding stale motion vectors and a corrupt
frame. await_references() already handles the same case correctly for
motion compensation.

Fixes sporadic failures of fate-h264-conformance-cabac_mot_picaff0_full,
where display frame 14.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit 274cb6731bd204e9537a7e588d4a3436fdf51b93)
2026-08-14 12:41:31 +00:00
Kacper Michajłow
9dc27d0b7c avcodec/h264_direct: move check before loading things
(cherry picked from commit 029c80900e2b92a8495e36aa19d7fac9c55b8482)
2026-08-14 12:41:30 +00:00
James Almer
5854de7c42 avcodec/bsf/truehd_core: clear profile value on init()
The output stream no longer has Atmos metadata, so the
AV_PROFILE_TRUEHD_ATMOS profile, if it was set, is no longer valid.

Fixes issue #23195.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 86940d45af)
2026-07-30 21:48:24 -03:00