[FFmpeg-devel] Buffer underflow error + possible patch

Diep Ho DHo
Wed Aug 13 16:58:37 CEST 2008

I have encouter some message 


buffer underflow i=1 bufi=0 size=24075

buffer underflow i=1 bufi=2032 size=24075

buffer underflow i=1 bufi=4073 size=24075



Which resulted from the function remove_decoded_packets in 

libavformat/mpegenc.c. It attempts to remove a packet that is only
partial provided.


Can I delay the removal of this very first packet using the following
patch in order to avoid the above annoying message? 


I've successfully done the full-test.


Best rgds,





Index: libavformat/mpegenc.c


--- libavformat/mpegenc.c         (revision 14725)

+++ libavformat/mpegenc.c      (working copy)

@@ -998,8 +998,10 @@


         while((pkt_desc= stream->predecode_packet)

               && scr > pkt_desc->dts){ //FIXME > vs >=

-            if(stream->buffer_index < pkt_desc->size ||

-               stream->predecode_packet == stream->premux_packet){

+                 if (stream->predecode_packet == stream->premux_packet)

+                             break;


+            if(stream->buffer_index < pkt_desc->size){

                 av_log(ctx, AV_LOG_ERROR,

                        "buffer underflow i=%d bufi=%d size=%d\n",

                        i, stream->buffer_index, pkt_desc->size);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: underflow.patch
Type: application/octet-stream
Size: 745 bytes
Desc: underflow.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080813/632d2646/attachment.obj>

More information about the ffmpeg-devel mailing list