[FFmpeg-devel] [PATCH] avformat/hevc: fix writing hvcC when no arrays are provided in hvcC-formatted input

James Almer jamrial at gmail.com
Tue Nov 19 18:29:13 EET 2024


Pass the input through in that case.
Fixes a regression since a696b28886.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/hevc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index e1f31ee1bb..8a3b8741bf 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -1212,6 +1212,14 @@ static int write_configuration_record(AVIOContext *pb, const uint8_t *data,
         flags |= FLAG_IS_NALFF;
 
         num_arrays = get_bits(&gbc, 8);
+
+        /* If there are no arrays, there's nothing to parse.
+         * Just copy the record. */
+        if (!num_arrays) {
+            avio_write(pb, data, size);
+            return 0;
+        }
+
         for (int i = 0; i < num_arrays; i++) {
             int type, num_nalus;
 
-- 
2.47.0



More information about the ffmpeg-devel mailing list