[FFmpeg-devel] [PATCH] Make ffplay define in the encoder the number of threads *before* to open it
Stefano Sabatini
stefano.sabatini-lala
Mon Dec 28 22:50:20 CET 2009
On date Monday 2009-12-28 00:05:14 +0100, Michael Niedermayer encoded:
> On Sun, Mar 09, 2008 at 02:59:30PM +0100, Stefano Sabatini wrote:
> > On date Saturday 2008-03-08 21:03:17 +0100, Michael Niedermayer encoded:
> > > On Sat, Mar 08, 2008 at 06:33:27PM +0100, Stefano Sabatini wrote:
> > > [...
> > > > Index: ffplay.c
> > > > ===================================================================
> > > > --- ffplay.c (revision 12367)
> > > > +++ ffplay.c (working copy)
> > > > @@ -1713,6 +1713,7 @@
> > > > enc->skip_loop_filter= skip_loop_filter;
> > > > enc->error_resilience= error_resilience;
> > > > enc->error_concealment= error_concealment;
> > > > + enc->thread_count= thread_count;
> > > > if (!codec ||
> > > > avcodec_open(enc, codec) < 0)
> > > > return -1;
> > > > @@ -1735,7 +1736,6 @@
> > > >
> > > > if(thread_count>1)
> > > > avcodec_thread_init(enc, thread_count);
> > > > - enc->thread_count= thread_count;
> > >
> > > wherver this line is moved the avcodec_thread_init should move as well
> > > Though maybe the "enc->thread_count= thread_count;" line can be removed
> > [...]
> >
> > Fixed, it works with both threads enabled and disabled.
> >
> > Without threads enabled enc->thread_count isn't set, so it defaults to the sane
> > value of 1.
> >
> > Best regards.
> > --
> > Stefano Sabatini
> > Linux user number 337176 (see http://counter.li.org)
>
> > ffplay.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> > 8b6cacb69ff60cebbcbb444525d8e8ac46a164b3 make-ffplay-init-threads-num-before-opening-codec-01.patch
>
> ok
Applied.
Note that the crash for which I originally posted the patch doesn't
occurr anymore, since the initialization of the threads array happen
*after* the decoder initialization (in
libavcodec/h263dec.c:290:
if (!s->context_initialized) {
if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
return -1;
}
Anyway I consider the behavior implemented by the patch still safer
than the previous one.
Regards.
--
FFmpeg = Fantastic & Foolish MultiPurpose Eccentric Gospel
More information about the ffmpeg-devel
mailing list