diff options
author | Jeff Downs <heydowns@borg.com> | 2007-12-14 05:37:23 +0000 |
---|---|---|
committer | Jeff Downs <heydowns@borg.com> | 2007-12-14 05:37:23 +0000 |
commit | 33e00731294e304ef7935fdb6dd7214bc4df391f (patch) | |
tree | 475887920989e84f3484716eaa57932d95668a7c /libavcodec/h264.c | |
parent | 603972fc53934c46e5de0c93f439fee2716f1198 (diff) | |
download | ffmpeg-streaming-33e00731294e304ef7935fdb6dd7214bc4df391f.zip ffmpeg-streaming-33e00731294e304ef7935fdb6dd7214bc4df391f.tar.gz |
Make h264 decoder conform to requirements of mpegvideo's MPV_frame_start.
Namely, that it should not be called if you are starting to decode a B
frame without any reference pictures.
Prevents an endless allocation cycle in MPV_frame_start that will end in
picture buffer overflow and abort.
Fixes roundup issue 216.
Originally committed as revision 11214 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index a093b08..822a20f 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3911,6 +3911,11 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ h->slice_type= slice_type; s->pict_type= h->slice_type; // to make a few old func happy, it's wrong though + if (s->pict_type == B_TYPE && s->last_picture_ptr == NULL) { + av_log(h->s.avctx, AV_LOG_ERROR, + "B picture before any references, skipping\n"); + return -1; + } pps_id= get_ue_golomb(&s->gb); if(pps_id>=MAX_PPS_COUNT){ |