1
mirror of https://github.com/mpv-player/mpv synced 2024-07-11 23:47:56 +02:00

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.
This commit is contained in:
wm4 2014-06-12 00:29:53 +02:00
parent 0b7facf05d
commit 231c667214

View File

@ -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);