aboutsummaryrefslogtreecommitdiffhomepage
path: root/input
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-12-23 21:44:53 +0100
committerGravatar wm4 <wm4@nowhere>2015-12-23 21:52:16 +0100
commitf9ba1a3ddf5186cb31c2715e3293eef70575a9ee (patch)
treed74fc10c76c95d05220a5c379e25333031642d2d /input
parentb0381d27eb19d8f70f4f711d41dd342c616ae843 (diff)
demux: remove weird tripple-buffering for the sh_stream list
The demuxer infrastructure was originally single-threaded. To make it suitable for multithreading (specifically, demuxing and decoding on separate threads), some sort of tripple-buffering was introduced. There are separate "struct demuxer" allocations. The demuxer thread sets the state on d_thread. If anything changes, the state is copied to d_buffer (the copy is protected by a lock), and the decoder thread is notified. Then the decoder thread copies the state from d_buffer to d_user (again while holding a lock). This avoids the need for locking in the demuxer/decoder code itself (only demux.c needs an internal, "invisible" lock.) Remove the streams/num_streams fields from this tripple-buffering schema. Move them to the internal struct, and protect them with the internal lock. Use accessors for read access outside of demux.c. Other than replacing all field accesses with accessors, this separates allocating and adding sh_streams. This is needed to avoid race conditions. Before this change, this was awkwardly handled by first initializing the sh_stream, and then sending a stream change event. Now the stream is allocated, then initialized, and then declared as immutable and added (at which point it becomes visible to the decoder thread immediately). This change is useful for PR #2626. And eventually, we should probably get entirely of the tripple buffering, and this makes a nice first step.
Diffstat (limited to 'input')
-rw-r--r--input/input.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/input/input.c b/input/input.c
index 24281fe99e..2e7d6d30ef 100644
--- a/input/input.c
+++ b/input/input.c
@@ -463,10 +463,8 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section,
if (ret) {
ret->input_section = cmd->owner->section;
ret->key_name = talloc_steal(ret, mp_input_get_key_combo_name(&code, 1));
- if (mp_msg_test(ictx->log, MSGL_DEBUG)) {
- MP_DBG(ictx, "key '%s' -> '%s' in '%s'\n",
- ret->key_name, cmd->cmd, ret->input_section);
- }
+ MP_DBG(ictx, "key '%s' -> '%s' in '%s'\n",
+ ret->key_name, cmd->cmd, ret->input_section);
ret->is_mouse_button = code & MP_KEY_EMIT_ON_UP;
} else {
char *key_buf = mp_input_get_key_combo_name(&code, 1);