[FFmpeg-devel] [PATCH 4/4] Reset the internal state when aborting key frames header parsing in vp6 decoder.
fenrir at elivagar.org
fenrir at elivagar.org
Sat Sep 24 16:16:41 CEST 2011
From: Laurent Aimar <fenrir at videolan.org>
It prevents leaving the state only half initialized.
---
libavcodec/vp6.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 6928a91..3cac5dc 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -57,7 +57,6 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
s->framep[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80);
ff_vp56_init_dequant(s, (buf[0] >> 1) & 0x3F);
-
if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
sub_version = buf[1] >> 3;
if (sub_version > 8)
@@ -139,8 +138,11 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
if (coeff_offset) {
buf += coeff_offset;
buf_size -= coeff_offset;
- if (buf_size < 0)
+ if (buf_size < 0) {
+ if (s->framep[VP56_FRAME_CURRENT]->key_frame)
+ avcodec_set_dimensions(s->avctx, 0, 0);
return 0;
+ }
if (s->use_huffman) {
s->parse_coeff = vp6_parse_coeff_huffman;
init_get_bits(&s->gb, buf, buf_size<<3);
--
1.7.2.5
More information about the ffmpeg-devel
mailing list