[FFmpeg-devel] [PATCH] Fix parser not to clobber has_b_frames when extradata is set.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Aug 20 12:29:56 CEST 2011


On Sat, Aug 20, 2011 at 12:31:03AM +0200, Michael Niedermayer wrote:
> On Fri, Aug 19, 2011 at 10:41:53PM +0200, Reimar Döffinger wrote:
> > Due to it in contrast to the decoder not setting up low_delay,
> > the code in parse_nal_units would always end up setting has_b_frames
> > to 1 (except when stream is explicitly marked as low delay).
> > Since the parser itself would create extradata, simply reopening
> > the parser would cause this.
> > estimate_timings_from_pts would cause the parser to be reopened
> > on the same stream.
> > 
> > This fixes trac issue #360.
> > 
> > Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> > ---
> >  libavcodec/h264_parser.c |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> i hope this has no sideeffects

It might have, though they should be constrained to the cases that
are potentially affected by the bug anyway.
I don't think we use a parser all that often for formats that
have extradata set on their own.

> but due to lack of a cleaner solution iam fine with it

Pushed as-is for now.
I don't think any are cleaner, but there are other solutions,
like stopping the extradata parsing code from setting has_b_frames -
at the very least when called from the parser.
But they are at the very least more complex changes.
I also thought about changing the parse NAL code so that it never
sets has_b_frames on an SPS, but only resets it if the header marks
"no B-frames". However that would be more invasive with higher
risk for side-effects.


More information about the ffmpeg-devel mailing list