[FFmpeg-devel] [PATCH] avcodec_decode_audio3 and?multiple?frames in a packet

Sascha Sommer saschasommer
Wed Sep 16 17:51:03 CEST 2009


Hi,

On Mittwoch, 16. September 2009, Michael Niedermayer wrote:
> On Wed, Sep 16, 2009 at 02:52:29PM +0200, Sascha Sommer wrote:
> > Hi,
> >
> > On Samstag, 12. September 2009, Justin Ruggles wrote:
> > > Michael Niedermayer wrote:
> > > > On Fri, Sep 11, 2009 at 12:13:02PM +0200, Sascha Sommer wrote:
> > > > [...]
> > > >
> > > >> Previously a value of 0 meant that no frame was decoded.
> > > >
> > > > no
> > > > you read the docs backward, it says if no frame was decoded return 0
> > > > it does not say that 0 means no frames have been decoded, it could
> > > > equally well mean 0 bytes used
> > >
> > > Ah, good.  So, although the current text is technically correct if
> > > interpreted that way, it is ambiguous.  Why do we need to have a 0
> > > return value also possibly mean no frames have been decoded?   If
> > > frame_size_ptr is set to 0, that always means no frames have been
> > > decoded, without regard to the return value.  And a return value of 0
> > > should mean zero bytes were used, without regard to what frame_size_ptr
> > > is set to.  They seem mutually exclusive to me...
> >
> > I agree. The return value controls the number of input bytes,
> > frame_size_ptr the number of output bytes. I don't see why 0 needs to be
> > returned when no frame was outputted.
>
> what exactly did the decoder then do with the data?
> and what was that data it did not decode?

It maybe skipped it? For example when the packet contained only DSE syntax 
elements in AAC. I did not check the spec if this can happen or for what 
these Data Stream Elements are actually used but as we already found out 
ffmpeg does
? ? ? ? ? ? ? ? avpkt.data += ret;
? ? ? ? ? ? ? ? avpkt.size -= ret;
So this will decode always the same data.
(It currently does not as the AAC decoder does not check if a packet really 
contained audio...)

Regards

Sascha






More information about the ffmpeg-devel mailing list