aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-12-04 22:16:24 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-12-04 22:16:24 +0000
commitaa388dba30a468a085056c9bc8a1bd6aa6f821f4 (patch)
tree8ee45407ef716503c1b3556b8ef92a60b1d5e421
parent140cb66321f2d3271d4e1a9c80eee42e0500c4fa (diff)
downloadffmpeg-aa388dba30a468a085056c9bc8a1bd6aa6f821f4.tar.gz
fixing files where the first frame isn a keyframe
Originally committed as revision 1309 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/mpegvideo.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1c574f7768..079021a479 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -801,8 +801,8 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
}
}
}
-
- if(!s->encoding){
+alloc:
+ if(!s->encoding){
/* find unused Picture */
for(i=0; i<MAX_PICTURE_COUNT; i++){
if(s->picture[i].data[0]==NULL) break;
@@ -829,14 +829,20 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->current_picture= s->picture[i];
}
- s->hurry_up= s->avctx->hurry_up;
- s->error_resilience= avctx->error_resilience;
-
if (s->pict_type != B_TYPE) {
s->last_picture= s->next_picture;
s->next_picture= s->current_picture;
}
+
+ if(s->pict_type != I_TYPE && s->last_picture.data[0]==NULL){
+ fprintf(stderr, "warning: first frame is no keyframe\n");
+ assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference
+ goto alloc;
+ }
+ s->hurry_up= s->avctx->hurry_up;
+ s->error_resilience= avctx->error_resilience;
+
/* set dequantizer, we cant do it during init as it might change for mpeg4
and we cant do it in the header decode as init isnt called for mpeg4 there yet */
if(s->out_format == FMT_H263){