libavcodec/h264_parser: Increase parse_history, fix huge resolutions
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 31 Jul 2014 14:25:21 +0000 (16:25 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 31 Jul 2014 14:50:32 +0000 (16:50 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0782fb6bcb32fe3ab956a99af4cc472ff81da0c2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/h264.h
libavcodec/h264_parser.c

index 228558b..7a6a652 100644 (file)
@@ -749,7 +749,7 @@ typedef struct H264Context {
 
     int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
 
-    uint8_t parse_history[4];
+    uint8_t parse_history[6];
     int parse_history_count;
     int parse_last_mb;
     uint8_t *edge_emu_buffer;
index ea0ab98..a075bfa 100644 (file)
@@ -92,7 +92,7 @@ static int h264_find_frame_end(H264Context *h, const uint8_t *buf,
             state = 7;
         } else {
             h->parse_history[h->parse_history_count++]= buf[i];
-            if (h->parse_history_count>3) {
+            if (h->parse_history_count>5) {
                 unsigned int mb, last_mb= h->parse_last_mb;
                 GetBitContext gb;
 
@@ -120,7 +120,7 @@ found:
     pc->frame_start_found = 0;
     if (h->is_avc)
         return next_avc;
-    return i - (state & 5) - 3 * (state > 7);
+    return i - (state & 5) - 5 * (state > 7);
 }
 
 static int scan_mmco_reset(AVCodecParserContext *s)