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

@ -123,8 +123,10 @@ typedef struct {
unsigned int n_fds;
} AppData;
#define BUFFER_SIZE1 4092
#define BUFFER_SIZE2 4096
#define MIN_LATENCY 64
#define BUFFER_SIZE1 MIN_LATENCY
#define BUFFER_SIZE2 MIN_LATENCY - 4
static void
init_buffer (AppData *data, SpaBuffer **bufs, Buffer *ba, int n_buffers, size_t size)
@ -297,7 +299,7 @@ do_invoke (SpaLoop *loop,
}
static SpaResult
make_nodes (AppData *data)
make_nodes (AppData *data, const char *device)
{
SpaResult res;
SpaProps *props;
@ -315,8 +317,8 @@ make_nodes (AppData *data)
spa_pod_builder_init (&b, buffer, sizeof (buffer));
spa_pod_builder_props (&b, &f[0], data->type.props,
SPA_POD_PROP (&f[1], data->type.props_device, 0, SPA_POD_TYPE_STRING, 1, "hw:1"),
SPA_POD_PROP (&f[1], data->type.props_min_latency, 0, SPA_POD_TYPE_INT, 1, 128));
SPA_POD_PROP (&f[1], data->type.props_device, 0, SPA_POD_TYPE_STRING, 1, device ? device : "hw:0"),
SPA_POD_PROP (&f[1], data->type.props_min_latency, 0, SPA_POD_TYPE_INT, 1, MIN_LATENCY));
props = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaProps);
if ((res = spa_node_set_props (data->sink, props)) < 0)
@ -583,7 +585,7 @@ main (int argc, char *argv[])
init_type (&data.type, data.map);
if ((res = make_nodes (&data)) < 0) {
if ((res = make_nodes (&data, argc > 1 ? argv[1] : NULL)) < 0) {
printf ("can't make nodes: %d\n", res);
return -1;
}