diff mbox

[FFmpeg-devel] lavfi/movie: Use filter threads as decoding threads

Message ID CAB0OVGrcpusCY6=GRf4m-U47xmCBzJsbD5QeVRwgXgCrHxnm6w@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Aug. 25, 2019, 4:43 p.m. UTC
Am So., 25. Aug. 2019 um 18:38 Uhr schrieb James Almer <jamrial@gmail.com>:
>
> On 8/25/2019 1:27 PM, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch should fix ticket #7542.
> >
> > Please comment, Carl Eugen
> >
> >
> > 0001-lavfi-movie-Use-filter-thread-count-for-decoding-thr.patch
> >
> > From 21f3c281dbd9d97ac47ed611958a85881c4b7fba Mon Sep 17 00:00:00 2001
> > From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> > Date: Sun, 25 Aug 2019 18:12:30 +0200
> > Subject: [PATCH] lavfi/movie: Use filter thread count for decoding threads.
> >
> > Fixes ticket #7542.
> > ---
> >  libavfilter/src_movie.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > index bcabfcc4c2..78c73e78a4 100644
> > --- a/libavfilter/src_movie.c
> > +++ b/libavfilter/src_movie.c
> > @@ -153,7 +153,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
> >      return found;
> >  }
> >
> > -static int open_stream(void *log, MovieStream *st)
> > +static int open_stream(AVFilterContext *ctx, MovieStream *st)
>
> log is now undeclared. Or rather, it still is for some reason (i guess
> the function parameter overloaded some global declaration), just not
> pointing to what you wanted it to.

New patch attached.

Thank you, Carl Eugen

Comments

Carl Eugen Hoyos Sept. 19, 2019, 11:24 p.m. UTC | #1
Am So., 25. Aug. 2019 um 18:43 Uhr schrieb Carl Eugen Hoyos
<ceffmpeg@gmail.com>:
>
> Am So., 25. Aug. 2019 um 18:38 Uhr schrieb James Almer <jamrial@gmail.com>:
> >
> > On 8/25/2019 1:27 PM, Carl Eugen Hoyos wrote:
> > > Hi!
> > >
> > > Attached patch should fix ticket #7542.
> > >
> > > Please comment, Carl Eugen
> > >
> > >
> > > 0001-lavfi-movie-Use-filter-thread-count-for-decoding-thr.patch
> > >
> > > From 21f3c281dbd9d97ac47ed611958a85881c4b7fba Mon Sep 17 00:00:00 2001
> > > From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> > > Date: Sun, 25 Aug 2019 18:12:30 +0200
> > > Subject: [PATCH] lavfi/movie: Use filter thread count for decoding threads.
> > >
> > > Fixes ticket #7542.
> > > ---
> > >  libavfilter/src_movie.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > > index bcabfcc4c2..78c73e78a4 100644
> > > --- a/libavfilter/src_movie.c
> > > +++ b/libavfilter/src_movie.c
> > > @@ -153,7 +153,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
> > >      return found;
> > >  }
> > >
> > > -static int open_stream(void *log, MovieStream *st)
> > > +static int open_stream(AVFilterContext *ctx, MovieStream *st)
> >
> > log is now undeclared. Or rather, it still is for some reason (i guess
> > the function parameter overloaded some global declaration), just not
> > pointing to what you wanted it to.
>
> New patch attached.

Ping.

Carl Eugen
Carl Eugen Hoyos Oct. 1, 2019, 7:57 p.m. UTC | #2
Am So., 25. Aug. 2019 um 18:43 Uhr schrieb Carl Eugen Hoyos
<ceffmpeg@gmail.com>:
>
> Am So., 25. Aug. 2019 um 18:38 Uhr schrieb James Almer <jamrial@gmail.com>:
> >
> > On 8/25/2019 1:27 PM, Carl Eugen Hoyos wrote:
> > > Hi!
> > >
> > > Attached patch should fix ticket #7542.
> > >
> > > Please comment, Carl Eugen
> > >
> > >
> > > 0001-lavfi-movie-Use-filter-thread-count-for-decoding-thr.patch
> > >
> > > From 21f3c281dbd9d97ac47ed611958a85881c4b7fba Mon Sep 17 00:00:00 2001
> > > From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> > > Date: Sun, 25 Aug 2019 18:12:30 +0200
> > > Subject: [PATCH] lavfi/movie: Use filter thread count for decoding threads.
> > >
> > > Fixes ticket #7542.
> > > ---
> > >  libavfilter/src_movie.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > > index bcabfcc4c2..78c73e78a4 100644
> > > --- a/libavfilter/src_movie.c
> > > +++ b/libavfilter/src_movie.c
> > > @@ -153,7 +153,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
> > >      return found;
> > >  }
> > >
> > > -static int open_stream(void *log, MovieStream *st)
> > > +static int open_stream(AVFilterContext *ctx, MovieStream *st)
> >
> > log is now undeclared. Or rather, it still is for some reason (i guess
> > the function parameter overloaded some global declaration), just not
> > pointing to what you wanted it to.
>
> New patch attached.

Patch applied.

Carl Eugen
diff mbox

Patch

From 9bc8ca9f3f0a7b3f688637a573c6af366b79eff1 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 25 Aug 2019 18:42:02 +0200
Subject: [PATCH] lavfi/movie: Use filter thread count for decoding threads.

Fixes ticket #7542.
---
 libavfilter/src_movie.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index bcabfcc4c2..79423a894d 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -153,14 +153,14 @@  static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
     return found;
 }
 
-static int open_stream(void *log, MovieStream *st)
+static int open_stream(AVFilterContext *ctx, MovieStream *st)
 {
     AVCodec *codec;
     int ret;
 
     codec = avcodec_find_decoder(st->st->codecpar->codec_id);
     if (!codec) {
-        av_log(log, AV_LOG_ERROR, "Failed to find any codec\n");
+        av_log(ctx, AV_LOG_ERROR, "Failed to find any codec\n");
         return AVERROR(EINVAL);
     }
 
@@ -173,9 +173,10 @@  static int open_stream(void *log, MovieStream *st)
         return ret;
 
     st->codec_ctx->refcounted_frames = 1;
+    st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx);
 
     if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
-        av_log(log, AV_LOG_ERROR, "Failed to open codec\n");
+        av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
         return ret;
     }
 
-- 
2.22.1