[FFmpeg-devel] [PATCH] latm: fix initialization on some streams when no extradata is available

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Jun 21 12:25:31 CEST 2012

On Thu, Jun 21, 2012 at 11:57:59AM +0200, Hendrik Leppkes wrote:
> On Thu, Jun 21, 2012 at 11:48 AM, Reimar Döffinger <Reimar.Doeffinger at gmx.de
> > wrote:
> >
> > Shouldn't rather all the stuff be set up in the init function?
> >
> The problem starts when there is not enough information for the init
> function to work completely, and instead the full configuration is only
> available when the first latm frame is decoded.
> Most of the time, i know sample rate and channels before opening the codec,
> so i set them on the AVCodecContext, and the aac init function sets them on
> its internal context, but the full latm initialization is not done because
> there is no extradata. Now when the first frame is decoded, the existing
> checks don't catch because sample rate and channel config did not change,
> but the full latm init is still missing.

A possible option going by that description might be to set sample rate
etc. to 0 on init?

> I'm open to other ideas to solve the problem, but i usually prefer rather
> simple changes, even if it means that one log message comes out wrong. ;)

You could just not print or print a different message when the codec
is not yet initialized at that point I'd say...
A confusing log message isn't a good idea just to save around one line
of code IMO.

More information about the ffmpeg-devel mailing list