jack: make option to make input writable

This commit is contained in:
Wim Taymans 2023-10-16 11:40:03 +02:00
parent d2b6a76798
commit 7d5b809b19
2 changed files with 11 additions and 8 deletions

View file

@ -431,6 +431,7 @@ struct client {
char filter_char; char filter_char;
uint32_t max_ports; uint32_t max_ports;
unsigned int fill_aliases:1; unsigned int fill_aliases:1;
unsigned int writable_input:1;
uint32_t max_frames; uint32_t max_frames;
@ -2575,14 +2576,14 @@ static int client_node_port_use_buffers(void *data,
return -ENOSPC; return -ENOSPC;
} }
if (p->object->port.type_id == TYPE_ID_VIDEO && direction == SPA_DIRECTION_INPUT) { fl = PW_MEMMAP_FLAG_READ;
fl = PW_MEMMAP_FLAG_READ; /* Make the buffer writable when output. Some apps write to the input buffer
} else { * so we want to make them writable as well if the option is selected.
/* some apps write to the input buffer so we want everything readwrite. We * We can't use a PRIVATE mapping here because then we might not see changes
* can't use PRIVATE because then we might not see changes in the buffer * in the buffer by other apps (see mmap man page). */
* by other apps. */ if (direction == SPA_DIRECTION_OUTPUT ||
fl = PW_MEMMAP_FLAG_READWRITE; (p->object->port.type_id != TYPE_ID_VIDEO && c->writable_input))
} fl |= PW_MEMMAP_FLAG_WRITE;
/* clear previous buffers */ /* clear previous buffers */
clear_buffers(c, mix); clear_buffers(c, mix);
@ -3906,6 +3907,7 @@ jack_client_t * jack_client_open (const char *client_name,
client->global_buffer_size = pw_properties_get_bool(client->props, "jack.global-buffer-size", false); client->global_buffer_size = pw_properties_get_bool(client->props, "jack.global-buffer-size", false);
client->max_ports = pw_properties_get_uint32(client->props, "jack.max-client-ports", MAX_CLIENT_PORTS); client->max_ports = pw_properties_get_uint32(client->props, "jack.max-client-ports", MAX_CLIENT_PORTS);
client->fill_aliases = pw_properties_get_bool(client->props, "jack.fill-aliases", false); client->fill_aliases = pw_properties_get_bool(client->props, "jack.fill-aliases", false);
client->writable_input = pw_properties_get_bool(client->props, "jack.writable-input", true);
client->self_connect_mode = SELF_CONNECT_ALLOW; client->self_connect_mode = SELF_CONNECT_ALLOW;
if ((str = pw_properties_get(client->props, "jack.self-connect-mode")) != NULL) { if ((str = pw_properties_get(client->props, "jack.self-connect-mode")) != NULL) {

View file

@ -89,6 +89,7 @@ jack.properties = {
#jack.global-buffer-size = false #jack.global-buffer-size = false
#jack.max-client-ports = 768 #jack.max-client-ports = 768
#jack.fill-aliases = false #jack.fill-aliases = false
#jack.writable-input = true
} }
# client specific properties # client specific properties