Add support for trace logging in lockfree ringbuffer

Fix some crashes when the connection is dead.
Small cleanups in the audio mixer
Only propose alloc_buffer when we are using export_buf in v4l2
This commit is contained in:
Wim Taymans 2017-04-27 17:17:47 +02:00
parent b51d3e4862
commit 214a0e27d8
10 changed files with 248 additions and 83 deletions

View file

@ -37,7 +37,7 @@ typedef struct {
int fd;
PinosConnection *connection;
SpaSource source;
SpaSource *source;
bool disconnecting;
PinosListener need_flush;
@ -388,7 +388,8 @@ do_flush_event (SpaLoopUtils *utils,
{
PinosContextImpl *impl = data;
if (impl->connection)
pinos_connection_flush (impl->connection);
if (!pinos_connection_flush (impl->connection))
pinos_context_disconnect (&impl->this);
}
static void
@ -633,12 +634,12 @@ pinos_context_connect_fd (PinosContext *context,
impl->fd = fd;
pinos_loop_add_io (context->loop,
fd,
SPA_IO_IN | SPA_IO_HUP | SPA_IO_ERR,
false,
on_context_data,
impl);
impl->source = pinos_loop_add_io (context->loop,
fd,
SPA_IO_IN | SPA_IO_HUP | SPA_IO_ERR,
false,
on_context_data,
impl);
context->core_proxy = pinos_proxy_new (context,
0,
@ -673,6 +674,7 @@ pinos_context_connect_fd (PinosContext *context,
no_registry:
pinos_proxy_destroy (context->core_proxy);
no_proxy:
pinos_loop_destroy_source (context->loop, impl->source);
pinos_connection_destroy (impl->connection);
error_close:
close (fd);
@ -694,6 +696,10 @@ pinos_context_disconnect (PinosContext *context)
impl->disconnecting = true;
if (impl->source)
pinos_loop_destroy_source (context->loop, impl->source);
impl->source = NULL;
if (context->registry_proxy)
pinos_proxy_destroy (context->registry_proxy);
context->registry_proxy = NULL;