[FFmpeg-devel] [PATCH v3 17/17] avformat/flvdec: propagate av_packet_add_side_data failure

Timo Rothenpieler timo at rothenpieler.org
Mon Dec 23 23:22:04 EET 2024


---
 libavformat/flvdec.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 39e872f473..018249d1fe 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -1721,20 +1721,22 @@ retry_duration:
             ret = av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
                                           flv->new_extradata[stream_type],
                                           flv->new_extradata_size[stream_type]);
-            if (ret >= 0) {
-                flv->new_extradata[stream_type]      = NULL;
-                flv->new_extradata_size[stream_type] = 0;
-            }
+            if (ret < 0)
+                return ret;
+
+            flv->new_extradata[stream_type]      = NULL;
+            flv->new_extradata_size[stream_type] = 0;
         } else if (multitrack &&
                    flv->mt_extradata_cnt > track_idx &&
                    flv->mt_extradata[track_idx]) {
             ret = av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
                                           flv->mt_extradata[track_idx],
                                           flv->mt_extradata_sz[track_idx]);
-            if (ret >= 0) {
-                flv->mt_extradata[track_idx]      = NULL;
-                flv->mt_extradata_sz[track_idx] = 0;
-            }
+            if (ret < 0)
+                return ret;
+
+            flv->mt_extradata[track_idx]      = NULL;
+            flv->mt_extradata_sz[track_idx] = 0;
         }
         if (stream_type == FLV_STREAM_TYPE_AUDIO && !enhanced_flv &&
                         (sample_rate != flv->last_sample_rate ||
-- 
2.43.0



More information about the ffmpeg-devel mailing list