[Ffmpeg-devel] buffer underflow messages from the output_example.c

Richard Shann richard.shann
Sat Apr 21 17:13:37 CEST 2007


I posted my problem with buffer underflow messages when running 
output_example.c
 to the ffmpeg-user list, but perhaps that was not
the right list? I've looked into it a bit, so here is an updated posting.
When I compile and run libavformat's
output_example.c with output.dvd as the command line argument
I get buffer underflow messages.
Looking at the code I see these come from libavformat/mpeg.c in the
function remove_decoded_packets().
The code looks suspicious at this point: the while loop can never
execute more than once; it looks as if a statement like
pkt_desc = stream->predecode_packet;
has been omitted after the
av_freep(&pkt_desc);
However, I can't see that there is any looping to be done, so that the
function could be simplified to

static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){
//    MpegMuxContext *s = ctx->priv_data;
    int i;
    for(i=0; i<ctx->nb_streams; i++){
        AVStream *st = ctx->streams[i];
        StreamInfo *stream = st->priv_data;
        PacketDesc *pkt_desc = stream->predecode_packet;

        if((pkt_desc && scr > pkt_desc->dts) //FIXME > vs >=
           &&  (!(stream->buffer_index < pkt_desc->size ||
               stream->predecode_packet == stream->premux_packet))) {
            stream->buffer_index -= pkt_desc->size;

            stream->predecode_packet = pkt_desc->next;
            av_freep(&pkt_desc);
            }
    }
    return 0;
}

The other problem I had (see below) I rather think may be nothing to do 
with tho
se buffer underflow messages. Is there a good stream analyzer that can 
say what
is going on?

When I give the resultant mpeg to GUIfordvdauthor and ask it to "create 
dvd" it
complains
WARN: unknown mpeg2 aspect ratio 1
WARN: Discontinuity of 23510 in audio channel 8; please remultiplex input.
WARN: Previous sector: 0.000 - 0.000
WARN: Current sector: 0.261 - 0.261
WARN: unknown mpeg2 aspect ratio 1
WARN: Discontinuity of 23510 in audio channel 8; please remultiplex input.
WARN: Previous sector: 0.261 - 0.261
WARN: Current sector: 0.522 - 0.522
and continues complaining about the audio. The resultant dvd seems ok, 
however.
I am using ffmpeg-export-2007-03-25 which I built under a recent 
mingw/msys envi
ronment (with some difficulties, however I've seen the same behaviour in 
other v
ersions of libavformat/libavcodec e.g. the one that comes with mplayer, 
so I thi
nk this is not special to my build).





More information about the ffmpeg-devel mailing list