summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Nenashev <anatoly.nenashev@ovsoft.ru>2011-03-27 21:41:48 +0200
committerReinhard Tartler <siretart@tauware.de>2011-05-11 16:35:02 +0200
commitb44c8ad280c221691560ae9625421416e20c483f (patch)
tree434f4b561822b96f5c1c345829112f346de6be25
parentd2bf42895ac30d228491a8a95a5908351dc32783 (diff)
Fix crash of interlaced MPEG2 decoding
Problem description, preliminary review discussion at http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/127731
-rw-r--r--libavcodec/mpegvideo.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index f4de8dded4..2c0525e2ad 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -998,8 +998,13 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->pict_type, s->dropable);*/
if(s->codec_id != CODEC_ID_H264){
- if((s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && s->pict_type!=AV_PICTURE_TYPE_I){
- av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
+ if((s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) &&
+ (s->pict_type!=AV_PICTURE_TYPE_I || s->picture_structure != PICT_FRAME)){
+ if (s->pict_type != AV_PICTURE_TYPE_I)
+ av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
+ else if (s->picture_structure != PICT_FRAME)
+ av_log(avctx, AV_LOG_INFO, "allocate dummy last picture for field based first keyframe\n");
+
/* Allocate a dummy frame */
i= ff_find_unused_picture(s, 0);
s->last_picture_ptr= &s->picture[i];