[FFmpeg-cvslog] avcodec/extract_extradata_bsf: make sure a Sequence Header was found for av1

James Almer git at videolan.org
Sat Jul 21 02:47:39 EEST 2018


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Jul 20 20:43:40 2018 -0300| [3870ed7ab3e60d6f5da8cc4dc395be5374fedc96] | committer: James Almer

avcodec/extract_extradata_bsf: make sure a Sequence Header was found for av1

A packet may have Metadata OBUs but no Sequence Header OBU, which is
useless as extradata.

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/extract_extradata_bsf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c
index 1184ef2a04..6deb6634f3 100644
--- a/libavcodec/extract_extradata_bsf.c
+++ b/libavcodec/extract_extradata_bsf.c
@@ -67,7 +67,7 @@ static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt,
 
     int extradata_size = 0, filtered_size = 0;
     int nb_extradata_obu_types = FF_ARRAY_ELEMS(extradata_obu_types);
-    int i, ret = 0;
+    int i, has_seq = 0, ret = 0;
 
     ret = ff_av1_packet_split(&s->av1_pkt, pkt->data, pkt->size, ctx);
     if (ret < 0)
@@ -77,12 +77,14 @@ static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt,
         AV1OBU *obu = &s->av1_pkt.obus[i];
         if (val_in_array(extradata_obu_types, nb_extradata_obu_types, obu->type)) {
             extradata_size += obu->raw_size;
+            if (obu->type == AV1_OBU_SEQUENCE_HEADER)
+                has_seq = 1;
         } else if (s->remove) {
             filtered_size += obu->raw_size;
         }
     }
 
-    if (extradata_size) {
+    if (extradata_size && has_seq) {
         AVBufferRef *filtered_buf;
         uint8_t *extradata, *filtered_data;
 



More information about the ffmpeg-cvslog mailing list