mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
small fixes
This commit is contained in:
parent
d3682067fa
commit
9bd92b781c
3 changed files with 30 additions and 9 deletions
|
|
@ -175,6 +175,7 @@ pause_node (PinosNode *this)
|
||||||
if ((res = spa_node_send_command (this->node, &cmd)) < 0)
|
if ((res = spa_node_send_command (this->node, &cmd)) < 0)
|
||||||
pinos_log_debug ("got error %d", res);
|
pinos_log_debug ("got error %d", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,6 +209,7 @@ suspend_node (PinosNode *this)
|
||||||
if (p->allocated)
|
if (p->allocated)
|
||||||
pinos_memblock_free (&p->buffer_mem);
|
pinos_memblock_free (&p->buffer_mem);
|
||||||
p->allocated = false;
|
p->allocated = false;
|
||||||
|
p->state = SPA_PORT_STATE_CONFIGURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_list_for_each (p, &this->output_ports, link) {
|
spa_list_for_each (p, &this->output_ports, link) {
|
||||||
|
|
@ -218,6 +220,7 @@ suspend_node (PinosNode *this)
|
||||||
if (p->allocated)
|
if (p->allocated)
|
||||||
pinos_memblock_free (&p->buffer_mem);
|
pinos_memblock_free (&p->buffer_mem);
|
||||||
p->allocated = false;
|
p->allocated = false;
|
||||||
|
p->state = SPA_PORT_STATE_CONFIGURE;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -735,6 +738,7 @@ pinos_node_get_free_port (PinosNode *node,
|
||||||
SpaList *ports;
|
SpaList *ports;
|
||||||
PinosPort *port = NULL, *p, **portmap;
|
PinosPort *port = NULL, *p, **portmap;
|
||||||
SpaPortIO *io;
|
SpaPortIO *io;
|
||||||
|
SpaResult res;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (direction == PINOS_DIRECTION_INPUT) {
|
if (direction == PINOS_DIRECTION_INPUT) {
|
||||||
|
|
@ -769,8 +773,12 @@ pinos_node_get_free_port (PinosNode *node,
|
||||||
port = portmap[i] = pinos_port_new (node, direction, i);
|
port = portmap[i] = pinos_port_new (node, direction, i);
|
||||||
port->io = &io[i];
|
port->io = &io[i];
|
||||||
(*n_ports)++;
|
(*n_ports)++;
|
||||||
spa_node_add_port (node->node, direction, i);
|
if ((res = spa_node_add_port (node->node, direction, i)) < 0) {
|
||||||
spa_node_port_set_io (node->node, direction, i, port->io);
|
pinos_log_error ("node %p: could not add port %d", node, i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
spa_node_port_set_io (node->node, direction, i, port->io);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -576,6 +576,17 @@ spa_audiomixer_node_port_send_command (SpaNode *node,
|
||||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clear_buffer (SpaAudioMixer *this, MixerBuffer *out)
|
||||||
|
{
|
||||||
|
int16_t *op;
|
||||||
|
size_t os;
|
||||||
|
|
||||||
|
op = SPA_MEMBER (out->outbuf->datas[0].data, out->outbuf->datas[0].chunk->offset, void);
|
||||||
|
os = out->outbuf->datas[0].chunk->size;
|
||||||
|
memset (op, 0, os);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_port_data (SpaAudioMixer *this, MixerBuffer *out, SpaAudioMixerPort *port, int layer)
|
add_port_data (SpaAudioMixer *this, MixerBuffer *out, SpaAudioMixerPort *port, int layer)
|
||||||
{
|
{
|
||||||
|
|
@ -634,7 +645,7 @@ spa_audiomixer_node_process_input (SpaNode *node)
|
||||||
SpaAudioMixerPort *port = &this->in_ports[i];
|
SpaAudioMixerPort *port = &this->in_ports[i];
|
||||||
SpaPortIO *input;
|
SpaPortIO *input;
|
||||||
|
|
||||||
if ((input = port->io) == NULL)
|
if ((input = port->io) == NULL || port->n_buffers == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (input->buffer_id != SPA_ID_INVALID) {
|
if (input->buffer_id != SPA_ID_INVALID) {
|
||||||
|
|
@ -691,6 +702,9 @@ spa_audiomixer_node_process_input (SpaNode *node)
|
||||||
|
|
||||||
add_port_data (this, outbuf, port, layer++);
|
add_port_data (this, outbuf, port, layer++);
|
||||||
}
|
}
|
||||||
|
if (layer == 0)
|
||||||
|
clear_buffer (this, outbuf);
|
||||||
|
|
||||||
output = outport->io;
|
output = outport->io;
|
||||||
output->buffer_id = outbuf->outbuf->id;
|
output->buffer_id = outbuf->outbuf->id;
|
||||||
output->status = SPA_RESULT_OK;
|
output->status = SPA_RESULT_OK;
|
||||||
|
|
|
||||||
|
|
@ -403,13 +403,12 @@ negotiate_formats (AppData *data)
|
||||||
if ((res = spa_node_add_port (data->mix, SPA_DIRECTION_INPUT, 0)) < 0)
|
if ((res = spa_node_add_port (data->mix, SPA_DIRECTION_INPUT, 0)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
spa_node_port_set_io (data->source1, SPA_DIRECTION_OUTPUT, 0, &data->source1_mix_io[0]);
|
||||||
|
spa_node_port_set_io (data->mix, SPA_DIRECTION_INPUT, 0, &data->source1_mix_io[0]);
|
||||||
|
|
||||||
if ((res = spa_node_port_set_format (data->mix, SPA_DIRECTION_INPUT, data->mix_ports[0], 0, format)) < 0)
|
if ((res = spa_node_port_set_format (data->mix, SPA_DIRECTION_INPUT, data->mix_ports[0], 0, format)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
spa_node_port_set_io (data->source1, SPA_DIRECTION_OUTPUT, 0, &data->source1_mix_io[0]);
|
|
||||||
spa_node_port_set_io (data->mix, SPA_DIRECTION_INPUT, 0, &data->source1_mix_io[0]);
|
|
||||||
|
|
||||||
if ((res = spa_node_port_set_format (data->source1, SPA_DIRECTION_OUTPUT, 0, 0, format)) < 0)
|
if ((res = spa_node_port_set_format (data->source1, SPA_DIRECTION_OUTPUT, 0, 0, format)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
@ -424,12 +423,12 @@ negotiate_formats (AppData *data)
|
||||||
if ((res = spa_node_add_port (data->mix, SPA_DIRECTION_INPUT, 1)) < 0)
|
if ((res = spa_node_add_port (data->mix, SPA_DIRECTION_INPUT, 1)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
if ((res = spa_node_port_set_format (data->mix, SPA_DIRECTION_INPUT, data->mix_ports[1], 0, format)) < 0)
|
|
||||||
return res;
|
|
||||||
|
|
||||||
spa_node_port_set_io (data->source2, SPA_DIRECTION_OUTPUT, 0, &data->source2_mix_io[0]);
|
spa_node_port_set_io (data->source2, SPA_DIRECTION_OUTPUT, 0, &data->source2_mix_io[0]);
|
||||||
spa_node_port_set_io (data->mix, SPA_DIRECTION_INPUT, 1, &data->source2_mix_io[0]);
|
spa_node_port_set_io (data->mix, SPA_DIRECTION_INPUT, 1, &data->source2_mix_io[0]);
|
||||||
|
|
||||||
|
if ((res = spa_node_port_set_format (data->mix, SPA_DIRECTION_INPUT, data->mix_ports[1], 0, format)) < 0)
|
||||||
|
return res;
|
||||||
|
|
||||||
if ((res = spa_node_port_set_format (data->source2, SPA_DIRECTION_OUTPUT, 0, 0, format)) < 0)
|
if ((res = spa_node_port_set_format (data->source2, SPA_DIRECTION_OUTPUT, 0, 0, format)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue