Commit 7a1c3ae522 for ffmpeg
commit 7a1c3ae522e770552b501021d66df20fbaeacb84
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Oct 12 15:46:04 2026 +0200
avcodec/pthread_frame: fail the initialization when the first worker cannot be copied back
A failed channel layout copy left the user context with a custom order
and no channel map, the following workers were then set up from it.
This is hardening, the failure was not replicated.
Found during the review of the fix for l08oZE4M5Rmz
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 085aff5508..8e88dda2ce 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -890,8 +890,11 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
}
p->thread_init = NEEDS_CLOSE;
- if (first)
- update_context_from_thread(avctx, copy, 1);
+ if (first) {
+ err = update_context_from_thread(avctx, copy, 1);
+ if (err < 0)
+ return err;
+ }
const AVCodecContext *src = first ? copy : avctx;
AVCodecContext *dst = first ? avctx : copy;