mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
Fix renegotiation
When we are idle and are asked to negotiate, suspend first so that we can do full negotiation again instead of using the old format. Stability fixes.
This commit is contained in:
parent
fd54471249
commit
1370fafd5b
10 changed files with 52 additions and 24 deletions
|
|
@ -240,6 +240,21 @@ no_mem:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
unhandle_socket (PinosStream *stream)
|
||||
{
|
||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
|
||||
if (impl->rtsocket_source) {
|
||||
pinos_loop_destroy_source (stream->context->loop, impl->rtsocket_source);
|
||||
impl->rtsocket_source = NULL;
|
||||
}
|
||||
if (impl->timeout_source) {
|
||||
pinos_loop_destroy_source (stream->context->loop, impl->timeout_source);
|
||||
impl->timeout_source = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pinos_stream_destroy (PinosStream *stream)
|
||||
{
|
||||
|
|
@ -249,6 +264,8 @@ pinos_stream_destroy (PinosStream *stream)
|
|||
|
||||
pinos_signal_emit (&stream->destroy_signal, stream);
|
||||
|
||||
unhandle_socket (stream);
|
||||
|
||||
spa_list_remove (&stream->link);
|
||||
|
||||
if (impl->node_proxy)
|
||||
|
|
@ -518,21 +535,6 @@ handle_rtnode_event (PinosStream *stream,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unhandle_socket (PinosStream *stream)
|
||||
{
|
||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
|
||||
if (impl->rtsocket_source) {
|
||||
pinos_loop_destroy_source (stream->context->loop, impl->rtsocket_source);
|
||||
impl->rtsocket_source = NULL;
|
||||
}
|
||||
if (impl->timeout_source) {
|
||||
pinos_loop_destroy_source (stream->context->loop, impl->timeout_source);
|
||||
impl->timeout_source = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_rtsocket_condition (SpaSource *source,
|
||||
int fd,
|
||||
|
|
|
|||
|
|
@ -189,11 +189,16 @@ pinos_thread_main_loop_stop (PinosThreadMainLoop *loop)
|
|||
{
|
||||
PinosThreadMainLoopImpl *impl = SPA_CONTAINER_OF (loop, PinosThreadMainLoopImpl, this);
|
||||
|
||||
pinos_log_debug ("thread-mainloop: %p stopping", impl);
|
||||
if (impl->running) {
|
||||
pinos_log_debug ("thread-mainloop: %p signal", impl);
|
||||
pinos_loop_signal_event (loop->loop, impl->event);
|
||||
pinos_log_debug ("thread-mainloop: %p join", impl);
|
||||
pthread_join (impl->thread, NULL);
|
||||
pinos_log_debug ("thread-mainloop: %p joined", impl);
|
||||
impl->running = false;
|
||||
}
|
||||
pinos_log_debug ("thread-mainloop: %p stopped", impl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -86,18 +86,19 @@ add_item (PinosSpaMonitor *this, SpaMonitorItem *item)
|
|||
if (item->info) {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < item->info->n_items; i++)
|
||||
for (i = 0; i < item->info->n_items; i++) {
|
||||
pinos_properties_set (props,
|
||||
item->info->items[i].key,
|
||||
item->info->items[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
pinos_properties_set (props, "media.class", item->klass);
|
||||
|
||||
mitem = calloc (1, sizeof (PinosSpaMonitorItem));
|
||||
mitem->id = strdup (item->id);
|
||||
mitem->node = pinos_node_new (impl->core,
|
||||
item->factory->name,
|
||||
item->name,
|
||||
node_iface,
|
||||
clock_iface,
|
||||
props);
|
||||
|
|
|
|||
|
|
@ -1172,6 +1172,8 @@ on_node_free (PinosListener *listener,
|
|||
pinos_log_debug ("client-node %p: free", &impl->this);
|
||||
proxy_clear (&impl->proxy);
|
||||
|
||||
pinos_signal_remove (&impl->node_free);
|
||||
|
||||
if (impl->data_fd != -1)
|
||||
close (impl->data_fd);
|
||||
free (impl);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ pinos_client_new (PinosCore *core,
|
|||
pinos_signal_init (&this->resource_added);
|
||||
pinos_signal_init (&this->resource_removed);
|
||||
|
||||
pinos_map_init (&this->objects, 64);
|
||||
pinos_map_init (&this->objects, 0);
|
||||
pinos_signal_init (&this->destroy_signal);
|
||||
|
||||
spa_list_insert (core->client_list.prev, &this->link);
|
||||
|
|
|
|||
|
|
@ -192,10 +192,11 @@ pinos_data_loop_stop (PinosDataLoop *loop)
|
|||
{
|
||||
PinosDataLoopImpl *impl = SPA_CONTAINER_OF (loop, PinosDataLoopImpl, this);
|
||||
|
||||
if (impl->running) {
|
||||
pinos_loop_signal_event (impl->this.loop, impl->event);
|
||||
|
||||
pthread_join (impl->thread, NULL);
|
||||
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,11 @@ do_negotiate (PinosLink *this, SpaNodeState in_state, SpaNodeState out_state)
|
|||
|
||||
pinos_link_update_state (this, PINOS_LINK_STATE_NEGOTIATING, NULL);
|
||||
|
||||
if (out_state > SPA_NODE_STATE_READY && this->output->node->state == PINOS_NODE_STATE_IDLE) {
|
||||
pinos_node_set_state (this->output->node, PINOS_NODE_STATE_SUSPENDED);
|
||||
out_state = SPA_NODE_STATE_CONFIGURE;
|
||||
}
|
||||
|
||||
/* both ports need a format */
|
||||
if (in_state == SPA_NODE_STATE_CONFIGURE && out_state == SPA_NODE_STATE_CONFIGURE) {
|
||||
pinos_log_debug ("link %p: doing negotiate format", this);
|
||||
|
|
@ -715,7 +720,6 @@ on_output_port_destroy (PinosListener *listener,
|
|||
PinosLinkImpl *impl = SPA_CONTAINER_OF (listener, PinosLinkImpl, output_port_destroy);
|
||||
|
||||
on_port_destroy (&impl->this, port);
|
||||
pinos_signal_remove (listener);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -80,6 +80,12 @@ pinos_main_loop_destroy (PinosMainLoop *loop)
|
|||
free (impl);
|
||||
}
|
||||
|
||||
/**
|
||||
* pinos_main_loop_quit:
|
||||
* @loop: a #PinosMainLoop
|
||||
*
|
||||
* Stop the running @loop.
|
||||
*/
|
||||
void
|
||||
pinos_main_loop_quit (PinosMainLoop *loop)
|
||||
{
|
||||
|
|
@ -88,6 +94,13 @@ pinos_main_loop_quit (PinosMainLoop *loop)
|
|||
impl->running = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* pinos_main_loop_run:
|
||||
* @loop: a #PinosMainLoop
|
||||
*
|
||||
* Start running @loop. This function blocks until pinos_main_loop_quit()
|
||||
* has been called.
|
||||
*/
|
||||
void
|
||||
pinos_main_loop_run (PinosMainLoop *loop)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ pinos_resource_destroy (PinosResource *resource)
|
|||
pinos_log_debug ("resource %p: destroy %u", resource, resource->id);
|
||||
pinos_signal_emit (&resource->destroy_signal, resource);
|
||||
|
||||
pinos_map_remove (&client->objects, resource->id);
|
||||
pinos_map_insert_at (&client->objects, resource->id, NULL);
|
||||
pinos_signal_emit (&client->resource_removed, client, resource);
|
||||
|
||||
if (resource->destroy)
|
||||
|
|
|
|||
|
|
@ -333,7 +333,6 @@ spa_alsa_monitor_enum_items (SpaMonitor *monitor,
|
|||
if ((res = alsa_udev_open (this)) < 0)
|
||||
return res;
|
||||
|
||||
again:
|
||||
if (index == 0 || this->index > index) {
|
||||
if (this->enumerate)
|
||||
udev_enumerate_unref (this->enumerate);
|
||||
|
|
@ -349,6 +348,7 @@ again:
|
|||
this->devices = udev_list_entry_get_next (this->devices);
|
||||
this->index++;
|
||||
}
|
||||
again:
|
||||
if (this->devices == NULL) {
|
||||
fill_item (this, &this->uitem, NULL);
|
||||
return SPA_RESULT_ENUM_END;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue