[FFmpeg-devel] [PATCH]Fix bug in VDPAU h264

Carl Eugen Hoyos cehoyos
Fri Jan 9 03:50:24 CET 2009


Hi!

While testing a factorisation patch for vdpauvideo.c, I found a 
(reproducible) bug when actually using vdpau h264 decoding: Crash on a 
test video, always on the same position.
Attached patch fixes the crash.

Please comment, Carl Eugen
-------------- next part --------------
Index: libavcodec/h264.c
===================================================================
--- libavcodec/h264.c	(revision 16498)
+++ libavcodec/h264.c	(working copy)
@@ -7424,9 +7424,12 @@
                && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
                && avctx->skip_frame < AVDISCARD_ALL){
                 if(ENABLE_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU){
+                    if(h->is_avc) {
                     static const uint8_t start_code[] = {0x00, 0x00, 0x01};
                     ff_vdpau_h264_add_data_chunk(h, start_code, sizeof(start_code));
                     ff_vdpau_h264_add_data_chunk(h, &buf[buf_index - consumed], consumed );
+                    }else
+                        ff_vdpau_h264_add_data_chunk(h, &buf[buf_index - consumed - 3], consumed + 3);
                 }else
                     context_count++;
             }



More information about the ffmpeg-devel mailing list