h264_sei: Check actual presence of picture timing SEI message
[libav.git] / libavcodec / h264_parser.c
index 6de37c0..22153bd 100644 (file)
@@ -402,7 +402,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
                 }
             }
 
-            if (sps->pic_struct_present_flag) {
+            if (sps->pic_struct_present_flag && p->sei.picture_timing.present) {
                 switch (p->sei.picture_timing.pic_struct) {
                 case SEI_PIC_STRUCT_TOP_FIELD:
                 case SEI_PIC_STRUCT_BOTTOM_FIELD:
@@ -433,7 +433,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
 
             if (p->picture_structure == PICT_FRAME) {
                 s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
-                if (sps->pic_struct_present_flag) {
+                if (sps->pic_struct_present_flag && p->sei.picture_timing.present) {
                     switch (p->sei.picture_timing.pic_struct) {
                     case SEI_PIC_STRUCT_TOP_BOTTOM:
                     case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: