link: select io right after mix init

This commit is contained in:
Wim Taymans 2019-03-07 23:19:40 +01:00
parent 1d3ce5a9d9
commit 47fc2020c0
2 changed files with 7 additions and 13 deletions

View file

@ -52,7 +52,6 @@ struct impl {
struct pw_link this; struct pw_link this;
bool prepare; bool prepare;
bool have_io;
bool activated; bool activated;
bool passive; bool passive;
@ -528,9 +527,6 @@ static int select_io(struct pw_link *this)
struct spa_io_buffers *io; struct spa_io_buffers *io;
int res; int res;
if (impl->have_io)
return 0;
io = this->rt.in_mix.io; io = this->rt.in_mix.io;
if (io == NULL) if (io == NULL)
io = this->rt.out_mix.io; io = this->rt.out_mix.io;
@ -548,9 +544,6 @@ static int select_io(struct pw_link *this)
return res; return res;
this->io = io; this->io = io;
impl->have_io = true;
return 0; return 0;
} }
@ -741,11 +734,6 @@ static int do_allocation(struct pw_link *this)
goto error; goto error;
} }
if ((res = select_io(this)) < 0) {
asprintf(&error, "link %p: error can set io: %s", this, spa_strerror(res));
goto error;
}
return res; return res;
error: error:
@ -1212,6 +1200,7 @@ struct pw_link *pw_link_new(struct pw_core *core,
struct impl *impl; struct impl *impl;
struct pw_link *this; struct pw_link *this;
struct pw_node *input_node, *output_node; struct pw_node *input_node, *output_node;
int res;
if (output == input) if (output == input)
goto same_ports; goto same_ports;
@ -1277,6 +1266,9 @@ struct pw_link *pw_link_new(struct pw_core *core,
pw_port_init_mix(output, &this->rt.out_mix); pw_port_init_mix(output, &this->rt.out_mix);
pw_port_init_mix(input, &this->rt.in_mix); pw_port_init_mix(input, &this->rt.in_mix);
if ((res = select_io(this)) < 0)
goto no_io;
if (this->feedback) { if (this->feedback) {
impl->inode = output_node; impl->inode = output_node;
impl->onode = input_node; impl->onode = input_node;
@ -1304,6 +1296,9 @@ struct pw_link *pw_link_new(struct pw_core *core,
return this; return this;
no_io:
asprintf(error, "can't set io %d (%s)", res, spa_strerror(res));
return NULL;
same_ports: same_ports:
asprintf(error, "can't link the same ports"); asprintf(error, "can't link the same ports");
return NULL; return NULL;

View file

@ -1339,7 +1339,6 @@ do_process(struct spa_loop *loop,
struct stream *impl = user_data; struct stream *impl = user_data;
struct buffer *b; struct buffer *b;
struct spa_io_buffers *io = impl->io; struct spa_io_buffers *io = impl->io;
int res;
if ((b = pop_queue(impl, &impl->queued)) != NULL) { if ((b = pop_queue(impl, &impl->queued)) != NULL) {
io->buffer_id = b->id; io->buffer_id = b->id;