diff mbox series

[FFmpeg-devel,v3] avfilter/src_movie: make the number of decode thread configurable

Message ID 1636206515-1791-1-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v3] avfilter/src_movie: make the number of decode thread configurable
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Limin Wang Nov. 6, 2021, 1:48 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Please use threads option if you want the number of thread configurable.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/src_movie.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Nov. 6, 2021, 1:59 p.m. UTC | #1
On Sat, Nov 6, 2021 at 2:48 PM <lance.lmwang@gmail.com> wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Please use threads option if you want the number of thread configurable.
>
>
Generally bad idea to use number of filtering threads for decoding threads.


> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/src_movie.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> index 573f363..5811675 100644
> --- a/libavfilter/src_movie.c
> +++ b/libavfilter/src_movie.c
> @@ -169,7 +169,9 @@ static int open_stream(AVFilterContext *ctx,
> MovieStream *st)
>      if (ret < 0)
>          return ret;
>
> -    st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx);
> +    if (!ctx->nb_threads)
> +        ctx->nb_threads = ff_filter_get_nb_threads(ctx);
> +    st->codec_ctx->thread_count = ctx->nb_threads;
>
>      if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
>          av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
> --
> 1.8.3.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Limin Wang Nov. 6, 2021, 2:33 p.m. UTC | #2
On Sat, Nov 06, 2021 at 02:59:06PM +0100, Paul B Mahol wrote:
> On Sat, Nov 6, 2021 at 2:48 PM <lance.lmwang@gmail.com> wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Please use threads option if you want the number of thread configurable.
> >
> >
> Generally bad idea to use number of filtering threads for decoding threads.

I agree. I'll update the patch to add a new option "dec_threads" for the
decoding threads.

> 
> 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  libavfilter/src_movie.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > index 573f363..5811675 100644
> > --- a/libavfilter/src_movie.c
> > +++ b/libavfilter/src_movie.c
> > @@ -169,7 +169,9 @@ static int open_stream(AVFilterContext *ctx,
> > MovieStream *st)
> >      if (ret < 0)
> >          return ret;
> >
> > -    st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx);
> > +    if (!ctx->nb_threads)
> > +        ctx->nb_threads = ff_filter_get_nb_threads(ctx);
> > +    st->codec_ctx->thread_count = ctx->nb_threads;
> >
> >      if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
> >          av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
> > --
> > 1.8.3.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> >
diff mbox series

Patch

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 573f363..5811675 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -169,7 +169,9 @@  static int open_stream(AVFilterContext *ctx, MovieStream *st)
     if (ret < 0)
         return ret;
 
-    st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx);
+    if (!ctx->nb_threads)
+        ctx->nb_threads = ff_filter_get_nb_threads(ctx);
+    st->codec_ctx->thread_count = ctx->nb_threads;
 
     if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
         av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");