[FFmpeg-devel] Audio decoding in api-example.c broken?
Tue May 25 21:13:56 CEST 2010
On Tue, 25 May 2010, Michael Niedermayer wrote:
> On Tue, May 25, 2010 at 11:46:35AM +0300, Martin Storsj? wrote:
> > On Mon, 24 May 2010, Michael Niedermayer wrote:
> > > On Mon, May 24, 2010 at 05:19:40PM +0300, Martin Storsj? wrote:
> > > > On Mon, 24 May 2010, Michael Niedermayer wrote:
> > > >
> > > > > On Mon, May 24, 2010 at 03:46:08PM +0300, Martin Storsj? wrote:
> > > > > > That's why I always refilled the buffer in the previous suggestion.
> > > > >
> > > > > its quite inefficient if you have a 4096 buffer and 40 byte packets
> > > > > and as this is example code such hacks are obviously something we cant
> > > > > do
> > > > >
> > > > > you could allocate a 100k buffer and keep filling it so there is at least
> > > > > 4k there, and once you hit the end memmove the <=4k left to the begin
> > > > > this still is a hack without us knowing for sure 4k is enough in the
> > > > > first place but its better than what we have now
> > > >
> > > > In this particular case, the data it decodes is just 41 KB so that part of
> > > > the code would never be used. But if you'd accept such a version of the
> > > > example anyway, I can try to rewrite it in that way.
> > >
> > > uhm, then make it 20k istead of 100k otherise its dead code which tends to
> > > rot
> > Updated suggestion attached.
> > // Martin
> > api-example.c | 23 ++++++++++++++++-------
> > 1 file changed, 16 insertions(+), 7 deletions(-)
> > 6e73c5a7647ee0096251ecfa65ecc73df9e7ebb8 0001-Use-a-larger-input-audio-buffer-refill-it-when-it-ha.patch
> > From 27fa177cc53b1a60d051f56d8aaee645adccbaf4 Mon Sep 17 00:00:00 2001
> > From: Martin Storsjo <martin at martin.st>
> > Date: Mon, 24 May 2010 10:23:25 +0300
> > Subject: [PATCH] Use a larger input audio buffer, refill it when it has less than 4 KB data left
> > This avoids trying to decode incomplete frames.
> > ---
> > libavcodec/api-example.c | 23 ++++++++++++++++-------
> > 1 files changed, 16 insertions(+), 7 deletions(-)
> looks ok
More information about the ffmpeg-devel