summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorChainik <chainik.dn@gmail.com>2018-10-30 15:48:34 +0300
committersfan5 <sfan5@live.de>2019-07-08 01:53:22 +0200
commit5907bc023cb02eee462a0c9197f90a1c7cff7b07 (patch)
treeb15c04bb5f29b176afe8f59f93c05655e47df899 /video
parent1638fa7b4663e4ad46ccd9750debba730222ea2a (diff)
downloadmpv-5907bc023cb02eee462a0c9197f90a1c7cff7b07.tar.bz2
mpv-5907bc023cb02eee462a0c9197f90a1c7cff7b07.tar.xz
vf_vapoursynth: allow multithreaded reading of returned frames
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_vapoursynth.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
index 95bc2b51e9..449086b01f 100644
--- a/video/filter/vf_vapoursynth.c
+++ b/video/filter/vf_vapoursynth.c
@@ -272,14 +272,6 @@ static void VS_CC vs_frame_done(void *userData, const VSFrameRef *f, int n,
{
struct priv *p = userData;
- pthread_mutex_lock(&p->lock);
-
- // If these assertions fail, n is an unrequested frame (or filtered twice).
- assert(n >= p->out_frameno && n < p->out_frameno + p->max_requests);
- int index = n - p->out_frameno;
- MP_TRACE(p, "filtered frame %d (%d)\n", n, index);
- assert(p->requested[index] == &dummy_img);
-
struct mp_image *res = NULL;
if (f) {
struct mp_image img = map_vs_frame(p, f, false);
@@ -299,6 +291,15 @@ static void VS_CC vs_frame_done(void *userData, const VSFrameRef *f, int n,
res = mp_image_new_copy(&img);
p->vsapi->freeFrame(f);
}
+
+ pthread_mutex_lock(&p->lock);
+
+ // If these assertions fail, n is an unrequested frame (or filtered twice).
+ assert(n >= p->out_frameno && n < p->out_frameno + p->max_requests);
+ int index = n - p->out_frameno;
+ MP_TRACE(p, "filtered frame %d (%d)\n", n, index);
+ assert(p->requested[index] == &dummy_img);
+
if (!res && !p->shutdown) {
if (p->eof) {
res = (struct mp_image *)&dummy_img_eof;