From b4d11dffbf254d0f6f0fef553e1065a94fefd224 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Thu, 14 May 2026 21:46:21 +0800 Subject: [PATCH] avformat/rtpdec_av1: fix operator precedence in packet allocation The closing parenthesis in the av_new_packet() branch was misplaced, making result store the boolean comparison instead of the AVERROR code, so allocation failures were silently lost. av_grow_packet() handles both an empty and a non-empty packet, so use it for both cases and drop the broken branch. Signed-off-by: Zhao Zhili --- libavformat/rtpdec_av1.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavformat/rtpdec_av1.c b/libavformat/rtpdec_av1.c index 91f75326f7..f6b1048328 100644 --- a/libavformat/rtpdec_av1.c +++ b/libavformat/rtpdec_av1.c @@ -278,13 +278,9 @@ static int av1_handle_packet(AVFormatContext *ctx, PayloadContext *data, if (data->needs_td) { output_size += 2; // for Temporal Delimiter (TD) } - if (pkt->data) { - if ((result = av_grow_packet(pkt, output_size)) < 0) - return result; - } else { - if ((result = av_new_packet(pkt, output_size) < 0)) - return result; - } + result = av_grow_packet(pkt, output_size); + if (result < 0) + return result; if (data->needs_td) { // restore TD