mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
v4l2: fix crash when unplugging
Only remove the v4l2 fd once on disconnect Make sure we don't use the clock anymore when a link is destroyed.
This commit is contained in:
parent
16b6a51b78
commit
49afacd66f
2 changed files with 7 additions and 2 deletions
|
|
@ -1194,7 +1194,8 @@ static void v4l2_on_fd_events(struct spa_source *source)
|
||||||
if (source->rmask & SPA_IO_ERR) {
|
if (source->rmask & SPA_IO_ERR) {
|
||||||
struct port *port = &this->out_ports[0];
|
struct port *port = &this->out_ports[0];
|
||||||
spa_log_error(this->log, "v4l2 %p: error %d", this, source->rmask);
|
spa_log_error(this->log, "v4l2 %p: error %d", this, source->rmask);
|
||||||
spa_loop_remove_source(port->data_loop, &port->source);
|
if (port->source.loop)
|
||||||
|
spa_loop_remove_source(port->data_loop, &port->source);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1470,7 +1471,8 @@ static int do_remove_source(struct spa_loop *loop,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct port *port = user_data;
|
struct port *port = user_data;
|
||||||
spa_loop_remove_source(port->data_loop, &port->source);
|
if (port->source.loop)
|
||||||
|
spa_loop_remove_source(port->data_loop, &port->source);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1288,6 +1288,9 @@ void pw_link_destroy(struct pw_link *link)
|
||||||
if (link->registered)
|
if (link->registered)
|
||||||
spa_list_remove(&link->link);
|
spa_list_remove(&link->link);
|
||||||
|
|
||||||
|
if (link->output->node->clock == link->input->node->clock)
|
||||||
|
link->input->node->clock = NULL;
|
||||||
|
|
||||||
input_remove(link, link->input);
|
input_remove(link, link->input);
|
||||||
|
|
||||||
output_remove(link, link->output);
|
output_remove(link, link->output);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue