ffmpeg | branch: master | James Almer <jamr...@gmail.com> | Tue Nov 19 13:24:49 
2024 -0300| [5813e5aa344b8c03c83bf62e729be0f447944ed1] | committer: James Almer

avformat/hevc: fix writing hvcC when no arrays are provided in hvcC-formatted 
input

Don't reject extradata with missing PS NALUs if array_completeness is not
requested.

Fixes a regression since a696b28886.

Signed-off-by: James Almer <jamr...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5813e5aa344b8c03c83bf62e729be0f447944ed1
---

 libavformat/hevc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index e1f31ee1bb..7cf0b0ffb2 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -958,10 +958,12 @@ static int hvcc_write(AVIOContext *pb, 
HEVCDecoderConfigurationRecord *hvcc,
     /*
      * We need at least one of each: VPS, SPS and PPS.
      */
-    if ((!numNalus[VPS_INDEX] || numNalus[VPS_INDEX] > HEVC_MAX_VPS_COUNT) && 
!is_lhvc)
+    if ((flags & FLAG_ARRAY_COMPLETENESS) &&
+        (!numNalus[VPS_INDEX] || numNalus[VPS_INDEX] > HEVC_MAX_VPS_COUNT) && 
!is_lhvc)
         return AVERROR_INVALIDDATA;
-    if (!numNalus[SPS_INDEX] || numNalus[SPS_INDEX] > HEVC_MAX_SPS_COUNT ||
-        !numNalus[PPS_INDEX] || numNalus[PPS_INDEX] > HEVC_MAX_PPS_COUNT)
+    if ((flags & FLAG_ARRAY_COMPLETENESS) &&
+        (!numNalus[SPS_INDEX] || numNalus[SPS_INDEX] > HEVC_MAX_SPS_COUNT ||
+         !numNalus[PPS_INDEX] || numNalus[PPS_INDEX] > HEVC_MAX_PPS_COUNT))
         return AVERROR_INVALIDDATA;
 
     /* unsigned int(8) configurationVersion = 1; */

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to