zerocodec: check if the previous frame is missing

ZeroCodec relies on the keyframe flag being set in the container, and
prev is the previously decoded frame. A keyframe flags incorrectly set
will lead to this condition.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Paul B Mahol 2012-05-04 12:32:43 -04:00 committed by Luca Barbato
parent e004bc16a1
commit 37f4a976b3
1 changed files with 4 additions and 0 deletions

View File

@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
pic->key_frame = 1;
pic->pict_type = AV_PICTURE_TYPE_I;
} else {
if (!prev) {
av_log(avctx, AV_LOG_ERROR, "Missing reference frame!\n");
return AVERROR_INVALIDDATA;
}
pic->key_frame = 0;
pic->pict_type = AV_PICTURE_TYPE_P;
}