mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
jack: remove some more limits
Remove limit on max results from _get_ports() and _get_all_connections() by using a dynamic array. Keep the limit on the max number of midi inputs we can mix.
This commit is contained in:
parent
4353fa83d6
commit
78a7370bc6
1 changed files with 24 additions and 21 deletions
|
|
@ -64,11 +64,10 @@
|
||||||
|
|
||||||
#define JACK_CLIENT_NAME_SIZE 128
|
#define JACK_CLIENT_NAME_SIZE 128
|
||||||
#define JACK_PORT_NAME_SIZE 256
|
#define JACK_PORT_NAME_SIZE 256
|
||||||
#define JACK_PORT_MAX 4096
|
|
||||||
#define JACK_PORT_TYPE_SIZE 32
|
#define JACK_PORT_TYPE_SIZE 32
|
||||||
#define CONNECTION_NUM_FOR_PORT 1024
|
|
||||||
#define MONITOR_EXT " Monitor"
|
#define MONITOR_EXT " Monitor"
|
||||||
|
|
||||||
|
#define MAX_MIDI_MIX 1024
|
||||||
#define MAX_BUFFER_FRAMES 8192
|
#define MAX_BUFFER_FRAMES 8192
|
||||||
|
|
||||||
#define MAX_ALIGN 16
|
#define MAX_ALIGN 16
|
||||||
|
|
@ -4324,7 +4323,7 @@ static void *get_buffer_input_midi(struct port *p, jack_nframes_t frames)
|
||||||
{
|
{
|
||||||
struct mix *mix;
|
struct mix *mix;
|
||||||
void *ptr = p->emptyptr;
|
void *ptr = p->emptyptr;
|
||||||
struct spa_pod_sequence *seq[CONNECTION_NUM_FOR_PORT];
|
struct spa_pod_sequence *seq[MAX_MIDI_MIX];
|
||||||
uint32_t n_seq = 0;
|
uint32_t n_seq = 0;
|
||||||
|
|
||||||
jack_midi_clear_buffer(ptr);
|
jack_midi_clear_buffer(ptr);
|
||||||
|
|
@ -4348,6 +4347,8 @@ static void *get_buffer_input_midi(struct port *p, jack_nframes_t frames)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
seq[n_seq++] = pod;
|
seq[n_seq++] = pod;
|
||||||
|
if (n_seq == MAX_MIDI_MIX)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
convert_to_midi(seq, n_seq, ptr);
|
convert_to_midi(seq, n_seq, ptr);
|
||||||
|
|
||||||
|
|
@ -4584,11 +4585,12 @@ const char ** jack_port_get_all_connections (const jack_client_t *client,
|
||||||
struct object *p, *l;
|
struct object *p, *l;
|
||||||
const char **res;
|
const char **res;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
struct pw_array tmp;
|
||||||
|
|
||||||
spa_return_val_if_fail(c != NULL, NULL);
|
spa_return_val_if_fail(c != NULL, NULL);
|
||||||
spa_return_val_if_fail(o != NULL, NULL);
|
spa_return_val_if_fail(o != NULL, NULL);
|
||||||
|
|
||||||
res = malloc(sizeof(char*) * (CONNECTION_NUM_FOR_PORT + 1));
|
pw_array_init(&tmp, sizeof(void*) * 32);
|
||||||
|
|
||||||
pthread_mutex_lock(&c->context.lock);
|
pthread_mutex_lock(&c->context.lock);
|
||||||
spa_list_for_each(l, &c->context.objects, link) {
|
spa_list_for_each(l, &c->context.objects, link) {
|
||||||
|
|
@ -4604,18 +4606,18 @@ const char ** jack_port_get_all_connections (const jack_client_t *client,
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
res[count++] = port_name(p);
|
pw_array_add_ptr(&tmp, (void*)port_name(p));
|
||||||
if (count == CONNECTION_NUM_FOR_PORT)
|
count++;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&c->context.lock);
|
pthread_mutex_unlock(&c->context.lock);
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
free(res);
|
pw_array_clear(&tmp);
|
||||||
res = NULL;
|
res = NULL;
|
||||||
} else
|
} else {
|
||||||
res[count] = NULL;
|
pw_array_add_ptr(&tmp, NULL);
|
||||||
|
res = tmp.data;
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5341,7 +5343,7 @@ const char ** jack_get_ports (jack_client_t *client,
|
||||||
struct client *c = (struct client *) client;
|
struct client *c = (struct client *) client;
|
||||||
const char **res;
|
const char **res;
|
||||||
struct object *o;
|
struct object *o;
|
||||||
struct object *tmp[JACK_PORT_MAX];
|
struct pw_array tmp;
|
||||||
const char *str;
|
const char *str;
|
||||||
uint32_t i, count, id;
|
uint32_t i, count, id;
|
||||||
int r;
|
int r;
|
||||||
|
|
@ -5371,14 +5373,14 @@ const char ** jack_get_ports (jack_client_t *client,
|
||||||
port_name_pattern, type_name_pattern, flags);
|
port_name_pattern, type_name_pattern, flags);
|
||||||
|
|
||||||
pthread_mutex_lock(&c->context.lock);
|
pthread_mutex_lock(&c->context.lock);
|
||||||
|
pw_array_init(&tmp, sizeof(void*) * 32);
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
spa_list_for_each(o, &c->context.objects, link) {
|
spa_list_for_each(o, &c->context.objects, link) {
|
||||||
if (o->type != INTERFACE_Port || o->removed)
|
if (o->type != INTERFACE_Port || o->removed)
|
||||||
continue;
|
continue;
|
||||||
pw_log_debug("%p: check port type:%d flags:%08lx name:\"%s\"", c,
|
pw_log_debug("%p: check port type:%d flags:%08lx name:\"%s\"", c,
|
||||||
o->port.type_id, o->port.flags, o->port.name);
|
o->port.type_id, o->port.flags, o->port.name);
|
||||||
if (count == JACK_PORT_MAX)
|
|
||||||
break;
|
|
||||||
if (o->port.type_id > TYPE_ID_VIDEO)
|
if (o->port.type_id > TYPE_ID_VIDEO)
|
||||||
continue;
|
continue;
|
||||||
if (!SPA_FLAG_IS_SET(o->port.flags, flags))
|
if (!SPA_FLAG_IS_SET(o->port.flags, flags))
|
||||||
|
|
@ -5399,21 +5401,22 @@ const char ** jack_get_ports (jack_client_t *client,
|
||||||
0, NULL, 0) == REG_NOMATCH)
|
0, NULL, 0) == REG_NOMATCH)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_log_debug("%p: port \"%s\" prio:%d matches (%d)",
|
pw_log_debug("%p: port \"%s\" prio:%d matches (%d)",
|
||||||
c, o->port.name, o->port.priority, count);
|
c, o->port.name, o->port.priority, count);
|
||||||
tmp[count++] = o;
|
|
||||||
|
pw_array_add_ptr(&tmp, o);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&c->context.lock);
|
pthread_mutex_unlock(&c->context.lock);
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
qsort(tmp, count, sizeof(struct object *), port_compare_func);
|
qsort(tmp.data, count, sizeof(struct object *), port_compare_func);
|
||||||
|
pw_array_add_ptr(&tmp, NULL);
|
||||||
res = malloc(sizeof(char*) * (count + 1));
|
res = tmp.data;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
res[i] = port_name(tmp[i]);
|
res[i] = port_name((struct object*)res[i]);
|
||||||
res[count] = NULL;
|
|
||||||
} else {
|
} else {
|
||||||
|
pw_array_clear(&tmp);
|
||||||
res = NULL;
|
res = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue