PR #23098 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23098
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23098.patch

The closing paren was misplaced so the expression parsed as
result = (av_new_packet(...) < 0), which stored 0 or 1 in result instead
of the AVERROR code. On allocation failure the function returned 1
rather than a negative error.

Signed-off-by: Zhao Zhili <[email protected]>


>From a7eb2b04cc842ac4538152248b5074938bae6028 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Thu, 14 May 2026 19:35:07 +0800
Subject: [PATCH] avformat/rtpdec_av1: fix operator precedence

The closing paren was misplaced so the expression parsed as
result = (av_new_packet(...) < 0), which stored 0 or 1 in result instead
of the AVERROR code. On allocation failure the function returned 1
rather than a negative error.

Signed-off-by: Zhao Zhili <[email protected]>
---
 libavformat/rtpdec_av1.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/rtpdec_av1.c b/libavformat/rtpdec_av1.c
index 91f75326f7..85c3208a65 100644
--- a/libavformat/rtpdec_av1.c
+++ b/libavformat/rtpdec_av1.c
@@ -278,13 +278,13 @@ 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;
-            }
+            if (pkt->data)
+                result = av_grow_packet(pkt, output_size);
+            else
+                result = av_new_packet(pkt, output_size);
+
+            if (result < 0)
+                return result;
 
             if (data->needs_td) {
                 // restore TD
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to