[FFmpeg-devel] [PATCH] pthreads: export the delay that was previously exported by mangling has_b_frames through AVCodecContext.delay

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Nov 9 20:19:37 CET 2011


On Wed, Nov 09, 2011 at 08:09:14PM +0100, Michael Niedermayer wrote:
> On Wed, Nov 09, 2011 at 08:05:26PM +0100, Reimar Döffinger wrote:
> > On Wed, Nov 09, 2011 at 07:06:08PM +0100, Michael Niedermayer wrote:
> > > Hi
> > > 
> > > patch below maybe usefull to applications which want to know the
> > > thread count used in frame multitherading.
> > > mplayer & mplayer2 fall in this category possibly.
> > 
> > I don't think mplayer2 is (generally) affected actually.
> > 
> > > From bd352d408af3928d9c53f4cea6a44a0797542cf1 Mon Sep 17 00:00:00 2001
> > > From: Michael Niedermayer <michaelni at gmx.at>
> > > Date: Wed, 9 Nov 2011 18:32:38 +0100
> > > Subject: [PATCH] pthreads: export the delay that was previously exported by mangling has_b_frames through
> > >  AVCodecContext.delay which was previously unused for decoders and fits better.
> > > 
> > > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > > ---
> > >  libavcodec/pthread.c |    1 +
> > >  libavcodec/version.h |    2 +-
> > >  2 files changed, 2 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
> > > index 4a44cea..04181e2 100644
> > > --- a/libavcodec/pthread.c
> > > +++ b/libavcodec/pthread.c
> > > @@ -363,6 +363,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
> > >      }
> > >  
> > >      if (for_user) {
> > > +        dst->delay         = src->thread_count - 1;
> > 
> > Well, if set like this it should probably include a change to the
> > description that for decode it is the delay added due to decoding
> > _beyond_ the reorder delay.
> 
> I can set it to anything that people prefer but this way
> delay + has_b_frames would give the old value for both ffmpeg and
> libav.

No, I think this way is better for this reason and it's logical enough.
I just realized that IMO the description even for encode is impossible
to understand.
Not sure if it is completely correct, but this would be my suggestion
for the updated text:
     * Encoding: Number of frames decode delay inherent in the chosen encoding
     * method (e.g. reorder delay).
     * Decoding: Number of frames delay above the inherent delay, e.g. due to
     * frame multi-threaded decoding. Combined with has_b_frames this should
     * give the total decode delay.
     * - encoding: Set by libavcodec.
     * - decoding: Set by libavcodec.


More information about the ffmpeg-devel mailing list