Suggested-by: BBB
Fixed-by: BBB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -28,6 +28,7 @@ |
28 | 28 |
typedef struct VP9ParseContext { |
29 | 29 |
int n_frames; // 1-8 |
30 | 30 |
int size[8]; |
31 |
+ int marker_size; |
|
31 | 32 |
int64_t pts; |
32 | 33 |
} VP9ParseContext; |
33 | 34 |
|
... | ... |
@@ -89,6 +90,21 @@ static int parse(AVCodecParserContext *ctx, |
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
if (s->n_frames > 0) { |
92 |
+ int i; |
|
93 |
+ int size_sum = 0; |
|
94 |
+ |
|
95 |
+ for (i = 0; i < s->n_frames ;i++) |
|
96 |
+ size_sum += s->size[i]; |
|
97 |
+ size_sum += s->marker_size; |
|
98 |
+ |
|
99 |
+ if (size_sum != size) { |
|
100 |
+ av_log(avctx, AV_LOG_ERROR, "Inconsistent input frame sizes %d %d\n", |
|
101 |
+ size_sum, size); |
|
102 |
+ s->n_frames = 0; |
|
103 |
+ } |
|
104 |
+ } |
|
105 |
+ |
|
106 |
+ if (s->n_frames > 0) { |
|
92 | 107 |
*out_data = data; |
93 | 108 |
*out_size = s->size[--s->n_frames]; |
94 | 109 |
parse_frame(ctx, *out_data, *out_size); |
... | ... |
@@ -131,6 +147,7 @@ static int parse(AVCodecParserContext *ctx, |
131 | 131 |
data += sz; \ |
132 | 132 |
size -= sz; \ |
133 | 133 |
} \ |
134 |
+ s->marker_size = size; \ |
|
134 | 135 |
parse_frame(ctx, *out_data, *out_size); \ |
135 | 136 |
return s->n_frames > 0 ? *out_size : full_size |
136 | 137 |
|