summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-12 00:29:53 +0200
committerwm4 <wm4@nowhere>2014-06-12 00:55:10 +0200
commit231c6672140f019257edd26db20fbcfc2554258f (patch)
treeac9c6138248850e16de0178abf424a3ab6c90a8d
parent0b7facf05db684ec15c3d011a7394d2990ffd8b7 (diff)
downloadmpv-231c6672140f019257edd26db20fbcfc2554258f.tar.bz2
mpv-231c6672140f019257edd26db20fbcfc2554258f.tar.xz
encode: make the central lock recursive
Unfortunately, there's a recursive function call in ao_lavc.c (play function), leading to a deadlock. The locking is getting a bit messy, so just make the lock recursive. This fixes #844.
-rw-r--r--common/encode_lavc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/encode_lavc.c b/common/encode_lavc.c
index df5710e07a..58df2bd7d3 100644
--- a/common/encode_lavc.c
+++ b/common/encode_lavc.c
@@ -30,6 +30,7 @@
#include "options/m_option.h"
#include "options/options.h"
#include "osdep/timer.h"
+#include "osdep/threads.h"
#include "video/out/vo.h"
#include "talloc.h"
#include "stream/stream.h"
@@ -174,7 +175,7 @@ struct encode_lavc_context *encode_lavc_init(struct encode_opts *options,
mp_msg_force_stderr(global, true);
ctx = talloc_zero(NULL, struct encode_lavc_context);
- pthread_mutex_init(&ctx->lock, NULL);
+ mpthread_mutex_init_recursive(&ctx->lock);
ctx->log = mp_log_new(ctx, global->log, "encode-lavc");
ctx->global = global;
encode_lavc_discontinuity(ctx);