Hi, On Fri, Oct 28, 2011 at 9:19 AM, Janne Grunau <[email protected]> wrote: > From: "Ronald S. Bultje" <[email protected]> > > Hej, > > On Fri, Oct 28, 2011 at 08:36:04AM -0700, Ronald S. Bultje wrote: >> >> Let me know if the rest is OK and I'll commit. > > I still prefer a local variable. Trying to pack every function argument > in creates monsters like MpegEncContext. Adding the number of decoded > frames as function argument for has_decode_delay_been_guessed makes it > imho easier to follow. > > It's visible from the call site that the function uses that specific > value. I would have to look at the function if takes only a struct as > argument. It is easier as long as it is a small number (at most 2 or > maybe 3). Especially in this case were it is just used to simplify a > complex if condition. > > Otoh, I don't care more than preparing this patch, push which you like > more. > > Janne > ---8<--- > This fixes false positives of has_codec_delay_been_guessed() for > streams where not every input picture generates an output picture, > such as interlaced H264. > > Signed-off-by: Janne Grunau <[email protected]> > --- > libavformat/utils.c | 11 +++++++---- > 1 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/libavformat/utils.c b/libavformat/utils.c > index 637d615..354b268 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -2108,17 +2108,17 @@ static int has_codec_parameters(AVCodecContext *avctx) > return avctx->codec_id != CODEC_ID_NONE && val != 0; > } > > -static int has_decode_delay_been_guessed(AVStream *st) > +static int has_decode_delay_been_guessed(AVStream *st, int nb_decoded_frames) > { > return st->codec->codec_id != CODEC_ID_H264 || > - st->codec_info_nb_frames >= 6 + st->codec->has_b_frames; > + nb_decoded_frames >= 6; > } > > static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary > **options) > { > int16_t *samples; > AVCodec *codec; > - int got_picture, data_size, ret=0; > + int got_picture, data_size, ret=0, nb_decoded_frames=0;
This won't keep the value of nb_decoded_frames in multiple calls to try_decode_frame() and will thus not solve the bug. Ronald _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
