More hacking

Move array and map to pinos
Move more things to spa lib
ControlCmd -> Message
Make pinos log, use for plugins as well
work on ringbuffer in alsa and nodes
work on making registry with all objects
This commit is contained in:
Wim Taymans 2016-11-03 19:41:53 +01:00
parent a1c0bef2ed
commit 7e46f9e3ad
81 changed files with 1831 additions and 1030 deletions

View file

@ -31,7 +31,7 @@
#include <spa/id-map.h>
#include <spa/poll.h>
#include <spa/monitor.h>
#include <spa/debug.h>
#include <lib/debug.h>
extern const SpaHandleFactory spa_alsa_sink_factory;
extern const SpaHandleFactory spa_alsa_source_factory;
@ -100,7 +100,7 @@ path_get_card_id (const char *path)
return e + 5;
}
#define CHECK(s,msg) if ((err = (s)) < 0) { spa_log_error (state->log, msg ": %s\n", snd_strerror(err)); return err; }
#define CHECK(s,msg) if ((err = (s)) < 0) { spa_log_error (state->log, msg ": %s", snd_strerror(err)); return err; }
static int
fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
@ -136,7 +136,7 @@ fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
SND_PCM_NO_AUTO_RESAMPLE |
SND_PCM_NO_AUTO_CHANNELS |
SND_PCM_NO_AUTO_FORMAT)) < 0) {
spa_log_error (this->log, "PLAYBACK open failed: %s\n", snd_strerror(err));
spa_log_error (this->log, "PLAYBACK open failed: %s", snd_strerror(err));
if ((err = snd_pcm_open (&hndl,
device,
SND_PCM_STREAM_CAPTURE,
@ -144,7 +144,7 @@ fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
SND_PCM_NO_AUTO_RESAMPLE |
SND_PCM_NO_AUTO_CHANNELS |
SND_PCM_NO_AUTO_FORMAT)) < 0) {
spa_log_error (this->log, "CAPTURE open failed: %s\n", snd_strerror(err));
spa_log_error (this->log, "CAPTURE open failed: %s", snd_strerror(err));
return -1;
} else {
item->item.factory = &spa_alsa_source_factory;

View file

@ -23,6 +23,7 @@
#include <spa/node.h>
#include <spa/audio/format.h>
#include <lib/props.h>
#include "alsa-utils.h"
@ -47,7 +48,7 @@ reset_alsa_sink_props (SpaALSAProps *props)
static void
update_state (SpaALSASink *this, SpaNodeState state)
{
spa_log_info (this->log, "update state %d\n", state);
spa_log_info (this->log, "update state %d", state);
this->node.state = state;
}
@ -367,6 +368,7 @@ spa_alsa_clear_buffers (SpaALSASink *this)
if (this->n_buffers > 0) {
SPA_QUEUE_INIT (&this->ready);
this->n_buffers = 0;
this->ringbuffer = NULL;
}
return SPA_RESULT_OK;
}
@ -390,7 +392,7 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
return SPA_RESULT_INVALID_PORT;
if (format == NULL) {
spa_log_info (this->log, "clear format\n");
spa_log_info (this->log, "clear format");
spa_alsa_pause (this, false);
spa_alsa_clear_buffers (this);
spa_alsa_close (this);
@ -409,7 +411,7 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
SPA_PORT_INFO_FLAG_LIVE;
this->info.maxbuffering = this->buffer_frames * this->frame_size;
this->info.latency = (this->period_frames * SPA_NSEC_PER_SEC) / this->rate;
this->info.n_params = 2;
this->info.n_params = 3;
this->info.params = this->params;
this->params[0] = &this->param_buffers.param;
this->param_buffers.param.type = SPA_ALLOC_PARAM_TYPE_BUFFERS;
@ -423,6 +425,14 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
this->param_meta.param.type = SPA_ALLOC_PARAM_TYPE_META_ENABLE;
this->param_meta.param.size = sizeof (this->param_meta);
this->param_meta.type = SPA_META_TYPE_HEADER;
this->params[2] = &this->param_meta_rb.param;
this->param_meta_rb.param.type = SPA_ALLOC_PARAM_TYPE_META_ENABLE;
this->param_meta_rb.param.size = sizeof (this->param_meta_rb);
this->param_meta_rb.type = SPA_META_TYPE_RINGBUFFER;
this->param_meta_rb.minsize = this->period_frames * this->frame_size * 32;
this->param_meta_rb.stride = 0;
this->param_meta_rb.blocks = 1;
this->param_meta_rb.align = 16;
this->info.extra = NULL;
this->have_format = true;
@ -512,7 +522,7 @@ spa_alsa_sink_node_port_use_buffers (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaALSASink, node);
spa_log_info (this->log, "use buffers %d\n", n_buffers);
spa_log_info (this->log, "use buffers %d", n_buffers);
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
@ -530,13 +540,16 @@ spa_alsa_sink_node_port_use_buffers (SpaNode *node,
b->outstanding = true;
b->h = spa_buffer_find_meta (b->outbuf, SPA_META_TYPE_HEADER);
b->rb = spa_buffer_find_meta (b->outbuf, SPA_META_TYPE_RINGBUFFER);
if (b->rb)
this->ringbuffer = b;
switch (buffers[i]->datas[0].type) {
case SPA_DATA_TYPE_MEMFD:
case SPA_DATA_TYPE_DMABUF:
case SPA_DATA_TYPE_MEMPTR:
if (buffers[i]->datas[0].data == NULL) {
spa_log_error (this->log, "alsa-source: need mapped memory\n");
spa_log_error (this->log, "alsa-source: need mapped memory");
continue;
}
break;
@ -637,9 +650,14 @@ spa_alsa_sink_node_port_push_input (SpaNode *node,
have_error = true;
continue;
}
if (this->ringbuffer) {
this->ringbuffer->outstanding = true;
this->ringbuffer = b;
} else {
b->next = NULL;
SPA_QUEUE_PUSH_TAIL (&this->ready, SpaALSABuffer, next, b);
}
b->outstanding = false;
b->next = NULL;
SPA_QUEUE_PUSH_TAIL (&this->ready, SpaALSABuffer, next, b);
info[i].status = SPA_RESULT_OK;
}
if (have_error)

View file

@ -24,6 +24,7 @@
#include <spa/node.h>
#include <spa/queue.h>
#include <spa/audio/format.h>
#include <lib/props.h>
#include "alsa-utils.h"
@ -583,7 +584,7 @@ spa_alsa_source_node_port_use_buffers (SpaNode *node,
case SPA_DATA_TYPE_DMABUF:
case SPA_DATA_TYPE_MEMPTR:
if (buffers[i]->datas[0].data == NULL) {
spa_log_error (this->log, "alsa-source: need mapped memory\n");
spa_log_error (this->log, "alsa-source: need mapped memory");
continue;
}
break;
@ -697,7 +698,7 @@ spa_alsa_source_node_port_pull_output (SpaNode *node,
info[i].buffer_id = b->outbuf->id;
info[i].status = SPA_RESULT_OK;
spa_log_debug (this->log, "pull buffer %u\n", b->outbuf->id);
spa_log_debug (this->log, "pull buffer %u", b->outbuf->id);
}
if (have_error)
return SPA_RESULT_ERROR;
@ -727,7 +728,7 @@ spa_alsa_source_node_port_reuse_buffer (SpaNode *node,
if (buffer_id >= this->n_buffers)
return SPA_RESULT_INVALID_BUFFER_ID;
spa_log_debug (this->log, "recycle buffer %u\n", buffer_id);
spa_log_debug (this->log, "recycle buffer %u", buffer_id);
recycle_buffer (this, buffer_id);
return SPA_RESULT_OK;

View file

@ -7,9 +7,10 @@
#include <sys/time.h>
#include <math.h>
#include <lib/debug.h>
#include "alsa-utils.h"
#define CHECK(s,msg) if ((err = (s)) < 0) { spa_log_error (state->log, msg ": %s\n", snd_strerror(err)); return err; }
#define CHECK(s,msg) if ((err = (s)) < 0) { spa_log_error (state->log, msg ": %s", snd_strerror(err)); return err; }
static int alsa_on_fd_events (SpaPollNotifyData *data);
@ -24,7 +25,7 @@ spa_alsa_open (SpaALSAState *state)
CHECK (snd_output_stdio_attach (&state->output, stderr, 0), "attach failed");
spa_log_info (state->log, "ALSA device open '%s'\n", props->device);
spa_log_info (state->log, "ALSA device open '%s'", props->device);
CHECK (snd_pcm_open (&state->hndl,
props->device,
state->stream,
@ -59,7 +60,7 @@ spa_alsa_close (SpaALSAState *state)
spa_poll_remove_item (state->data_loop, &state->poll);
spa_log_info (state->log, "Device closing\n");
spa_log_info (state->log, "Device closing");
CHECK (snd_pcm_close (state->hndl), "close failed");
state->opened = false;
@ -147,14 +148,14 @@ spa_alsa_set_format (SpaALSAState *state, SpaFormatAudio *fmt, SpaPortFormatFlag
/* set the sample format */
format = spa_alsa_format_to_alsa (info->format);
spa_log_info (state->log, "Stream parameters are %iHz, %s, %i channels\n", info->rate, snd_pcm_format_name(format), info->channels);
spa_log_info (state->log, "Stream parameters are %iHz, %s, %i channels", info->rate, snd_pcm_format_name(format), info->channels);
CHECK (snd_pcm_hw_params_set_format (hndl, params, format), "set_format");
/* set the count of channels */
rchannels = info->channels;
CHECK (snd_pcm_hw_params_set_channels_near (hndl, params, &rchannels), "set_channels");
if (rchannels != info->channels) {
spa_log_info (state->log, "Channels doesn't match (requested %u, get %u\n", info->channels, rchannels);
spa_log_info (state->log, "Channels doesn't match (requested %u, get %u", info->channels, rchannels);
if (flags & SPA_PORT_FORMAT_FLAG_NEAREST)
info->channels = rchannels;
else
@ -165,7 +166,7 @@ spa_alsa_set_format (SpaALSAState *state, SpaFormatAudio *fmt, SpaPortFormatFlag
rrate = info->rate;
CHECK (snd_pcm_hw_params_set_rate_near (hndl, params, &rrate, 0), "set_rate_near");
if (rrate != info->rate) {
spa_log_info (state->log, "Rate doesn't match (requested %iHz, get %iHz)\n", info->rate, rrate);
spa_log_info (state->log, "Rate doesn't match (requested %iHz, get %iHz)", info->rate, rrate);
if (flags & SPA_PORT_FORMAT_FLAG_NEAREST)
info->rate = rrate;
else
@ -189,6 +190,8 @@ spa_alsa_set_format (SpaALSAState *state, SpaFormatAudio *fmt, SpaPortFormatFlag
CHECK (snd_pcm_hw_params_get_period_size (params, &size, &dir), "get_period_size");
state->period_frames = size;
spa_log_info (state->log, "buffer frames %zd, period frames %zd", state->buffer_frames, state->period_frames);
/* write the parameters to device */
CHECK (snd_pcm_hw_params (hndl, params), "set_hw_params");
@ -210,10 +213,13 @@ set_swparams (SpaALSAState *state)
CHECK (snd_pcm_sw_params_set_tstamp_mode (hndl, params, SND_PCM_TSTAMP_ENABLE), "sw_params_set_tstamp_mode");
/* start the transfer when the buffer is almost full: */
/* (buffer_frames / avail_min) * avail_min */
CHECK (snd_pcm_sw_params_set_start_threshold (hndl, params,
(state->buffer_frames / state->period_frames) * state->period_frames), "set_start_threshold");
/* start the transfer */
CHECK (snd_pcm_sw_params_set_start_threshold (hndl, params, 0U), "set_start_threshold");
CHECK (snd_pcm_sw_params_set_stop_threshold (hndl, params,
(state->buffer_frames / state->period_frames) * state->period_frames), "set_stop_threshold");
// CHECK (snd_pcm_sw_params_set_stop_threshold (hndl, params, -1), "set_stop_threshold");
CHECK (snd_pcm_sw_params_set_silence_threshold (hndl, params, 0U), "set_silence_threshold");
/* allow the transfer when at least period_size samples can be processed */
/* or disable this mechanism when period event is enabled (aka interrupt like style processing) */
@ -240,18 +246,18 @@ xrun_recovery (SpaALSAState *state, snd_pcm_t *hndl, int err)
snd_pcm_status_alloca (&status);
if ((err = snd_pcm_status (hndl, status)) < 0) {
spa_log_error (state->log, "snd_pcm_status error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_status error: %s", snd_strerror (err));
}
if (snd_pcm_status_get_state (status) == SND_PCM_STATE_SUSPENDED) {
spa_log_info (state->log, "SUSPENDED, trying to resume\n");
spa_log_warn (state->log, "SUSPENDED, trying to resume");
if ((err = snd_pcm_prepare (hndl)) < 0) {
spa_log_error (state->log, "snd_pcm_prepare error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_prepare error: %s", snd_strerror (err));
}
}
if (snd_pcm_status_get_state (status) == SND_PCM_STATE_XRUN) {
spa_log_info (state->log, "XRUN\n");
spa_log_warn (state->log, "XRUN");
}
if (spa_alsa_pause (state, true) != SPA_RESULT_OK)
@ -262,6 +268,98 @@ xrun_recovery (SpaALSAState *state, snd_pcm_t *hndl, int err)
return err;
}
static snd_pcm_uframes_t
pull_frames_queue (SpaALSAState *state,
const snd_pcm_channel_area_t *my_areas,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t frames)
{
SpaALSABuffer *b;
SPA_QUEUE_PEEK_HEAD (&state->ready, SpaALSABuffer, b);
if (b) {
uint8_t *src, *dst;
size_t n_bytes;
src = SPA_MEMBER (b->outbuf->datas[0].data, b->outbuf->datas[0].offset + state->ready_offset, uint8_t);
dst = SPA_MEMBER (my_areas[0].addr, offset * state->frame_size, uint8_t);
n_bytes = SPA_MIN (b->outbuf->datas[0].size - state->ready_offset, frames * state->frame_size);
frames = SPA_MIN (frames, n_bytes / state->frame_size);
memcpy (dst, src, n_bytes);
state->ready_offset += n_bytes;
if (state->ready_offset >= b->outbuf->datas[0].size) {
SpaNodeEventReuseBuffer rb;
SPA_QUEUE_POP_HEAD (&state->ready, SpaALSABuffer, next, b);
b->outstanding = true;
rb.event.type = SPA_NODE_EVENT_TYPE_REUSE_BUFFER;
rb.event.size = sizeof (rb);
rb.port_id = 0;
rb.buffer_id = b->outbuf->id;
state->event_cb (&state->node, &rb.event, state->user_data);
state->ready_offset = 0;
}
} else {
spa_log_warn (state->log, "underrun");
snd_pcm_areas_silence (my_areas, offset, state->channels, frames, state->format);
}
return frames;
}
static snd_pcm_uframes_t
pull_frames_ringbuffer (SpaALSAState *state,
const snd_pcm_channel_area_t *my_areas,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t frames)
{
SpaRingbufferArea areas[2];
size_t size, avail;
SpaALSABuffer *b;
uint8_t *src, *dst;
SpaNodeEventReuseBuffer rb;
b = state->ringbuffer;
src = SPA_MEMBER (b->outbuf->datas[0].data, b->outbuf->datas[0].offset, void);
dst = SPA_MEMBER (my_areas[0].addr, offset * state->frame_size, uint8_t);
spa_ringbuffer_get_read_areas (&b->rb->ringbuffer, areas);
avail = areas[0].len + areas[1].len;
size = SPA_MIN (avail, frames * state->frame_size);
spa_log_debug (state->log, "%zd %zd %zd %zd %zd %zd",
areas[0].offset, areas[0].len,
areas[1].offset, areas[1].len, offset, size);
if (size > 0) {
areas[0].len = SPA_MIN (areas[0].len, size);
areas[1].len = SPA_MIN (areas[1].len, size - areas[0].len);
memcpy (dst, src + areas[0].offset, areas[0].len);
if (areas[1].len)
memcpy (dst + areas[0].len, src + areas[1].offset, areas[1].len);
spa_ringbuffer_read_advance (&b->rb->ringbuffer, size);
frames = size / state->frame_size;
} else {
spa_log_warn (state->log, "underrun");
snd_pcm_areas_silence (my_areas, offset, state->channels, frames, state->format);
}
b->outstanding = true;
rb.event.type = SPA_NODE_EVENT_TYPE_REUSE_BUFFER;
rb.event.size = sizeof (rb);
rb.port_id = 0;
rb.buffer_id = b->outbuf->id;
state->event_cb (&state->node, &rb.event, state->user_data);
return frames;
}
static int
mmap_write (SpaALSAState *state)
{
@ -270,71 +368,42 @@ mmap_write (SpaALSAState *state)
snd_pcm_sframes_t avail;
snd_pcm_uframes_t offset, frames, size;
const snd_pcm_channel_area_t *my_areas;
SpaNodeEventNeedInput ni;
SpaALSABuffer *b;
snd_pcm_status_t *status;
SpaNodeEventNeedInput ni;
snd_pcm_status_alloca (&status);
if ((err = snd_pcm_status (hndl, status)) < 0) {
spa_log_error (state->log, "snd_pcm_status error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_status error: %s", snd_strerror (err));
return -1;
}
avail = snd_pcm_status_get_avail (status);
ni.event.type = SPA_NODE_EVENT_TYPE_NEED_INPUT;
ni.event.size = sizeof (ni);
ni.port_id = 0;
state->event_cb (&state->node, &ni.event, state->user_data);
size = avail;
while (size > 0) {
frames = size;
if ((err = snd_pcm_mmap_begin (hndl, &my_areas, &offset, &frames)) < 0) {
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s", snd_strerror(err));
return -1;
}
ni.event.type = SPA_NODE_EVENT_TYPE_NEED_INPUT;
ni.event.size = sizeof (ni);
ni.port_id = 0;
state->event_cb (&state->node, &ni.event, state->user_data);
SPA_QUEUE_PEEK_HEAD (&state->ready, SpaALSABuffer, b);
if (b) {
uint8_t *src;
size_t n_bytes;
src = SPA_MEMBER (b->outbuf->datas[0].data, b->outbuf->datas[0].offset + state->ready_offset, void);
n_bytes = SPA_MIN (b->outbuf->datas[0].size - state->ready_offset, frames * state->frame_size);
frames = SPA_MIN (frames, n_bytes / state->frame_size);
memcpy ((uint8_t *)my_areas[0].addr + (offset * state->frame_size),
src,
n_bytes);
state->ready_offset += n_bytes;
if (state->ready_offset >= b->outbuf->datas[0].size) {
SpaNodeEventReuseBuffer rb;
SPA_QUEUE_POP_HEAD (&state->ready, SpaALSABuffer, next, b);
b->outstanding = true;
rb.event.type = SPA_NODE_EVENT_TYPE_REUSE_BUFFER;
rb.event.size = sizeof (rb);
rb.port_id = 0;
rb.buffer_id = b->outbuf->id;
state->event_cb (&state->node, &rb.event, state->user_data);
state->ready_offset = 0;
}
} else {
spa_log_warn (state->log, "underrun\n");
snd_pcm_areas_silence (my_areas, offset, state->channels, frames, state->format);
}
if (state->ringbuffer)
frames = pull_frames_ringbuffer (state, my_areas, offset, frames);
else
frames = pull_frames_queue (state, my_areas, offset, frames);
if ((err = snd_pcm_mmap_commit (hndl, offset, frames)) < 0) {
spa_log_error (state->log, "snd_pcm_mmap_commit error: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_mmap_commit error: %s", snd_strerror(err));
if (err != -EPIPE && err != -ESTRPIPE)
return -1;
}
spa_log_debug (state->log, "write %zd/%zd/%zd %u", frames, size, avail, state->ready.length);
size -= frames;
}
return 0;
@ -358,7 +427,7 @@ mmap_read (SpaALSAState *state)
snd_pcm_status_alloca(&status);
if ((err = snd_pcm_status (hndl, status)) < 0) {
spa_log_error (state->log, "snd_pcm_status error: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_status error: %s", snd_strerror(err));
return err;
}
@ -371,7 +440,7 @@ mmap_read (SpaALSAState *state)
SPA_QUEUE_POP_HEAD (&state->free, SpaALSABuffer, next, b);
if (b == NULL) {
spa_log_warn (state->log, "no more buffers\n");
spa_log_warn (state->log, "no more buffers");
} else {
dest = SPA_MEMBER (b->outbuf->datas[0].data, b->outbuf->datas[0].offset, void);
destsize = b->outbuf->datas[0].size;
@ -390,7 +459,7 @@ mmap_read (SpaALSAState *state)
while (size > 0) {
frames = size;
if ((err = snd_pcm_mmap_begin (hndl, &my_areas, &offset, &frames)) < 0) {
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s", snd_strerror (err));
return -1;
}
@ -404,13 +473,12 @@ mmap_read (SpaALSAState *state)
}
if ((err = snd_pcm_mmap_commit (hndl, offset, frames)) < 0) {
spa_log_error (state->log, "snd_pcm_mmap_commit error: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_mmap_commit error: %s", snd_strerror(err));
return -1;
}
size -= frames;
}
if (b) {
SpaNodeEventHaveOutput ho;
SpaData *d;
@ -443,7 +511,7 @@ alsa_on_fd_events (SpaPollNotifyData *data)
&revents);
if (revents & POLLERR) {
if ((err = xrun_recovery (state, hndl, err)) < 0) {
spa_log_error (state->log, "error: %s\n", snd_strerror (err));
spa_log_error (state->log, "error: %s", snd_strerror (err));
return -1;
}
}
@ -476,16 +544,16 @@ spa_alsa_start (SpaALSAState *state, bool xrun_recover)
snd_pcm_dump (state->hndl, state->output);
if ((err = snd_pcm_prepare (state->hndl)) < 0) {
spa_log_error (state->log, "snd_pcm_prepare error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_prepare error: %s", snd_strerror (err));
return SPA_RESULT_ERROR;
}
if ((state->poll.n_fds = snd_pcm_poll_descriptors_count (state->hndl)) <= 0) {
spa_log_error (state->log, "Invalid poll descriptors count %d\n", state->poll.n_fds);
spa_log_error (state->log, "Invalid poll descriptors count %d", state->poll.n_fds);
return SPA_RESULT_ERROR;
}
if ((err = snd_pcm_poll_descriptors (state->hndl, (struct pollfd *)state->fds, state->poll.n_fds)) < 0) {
spa_log_error (state->log, "snd_pcm_poll_descriptors: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_poll_descriptors: %s", snd_strerror(err));
return SPA_RESULT_ERROR;
}
@ -499,7 +567,7 @@ spa_alsa_start (SpaALSAState *state, bool xrun_recover)
}
if ((err = snd_pcm_start (state->hndl)) < 0) {
spa_log_error (state->log, "snd_pcm_start: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_start: %s", snd_strerror (err));
return SPA_RESULT_ERROR;
}
@ -522,7 +590,7 @@ spa_alsa_pause (SpaALSAState *state, bool xrun_recover)
}
if ((err = snd_pcm_drop (state->hndl)) < 0)
spa_log_error (state->log, "snd_pcm_drop %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_drop %s", snd_strerror (err));
state->started = false;

View file

@ -32,6 +32,7 @@ extern "C" {
#include <spa/log.h>
#include <spa/queue.h>
#include <spa/node.h>
#include <spa/ringbuffer.h>
#include <spa/audio/format.h>
typedef struct _SpaALSAState SpaALSAState;
@ -52,6 +53,7 @@ typedef struct {
struct _SpaALSABuffer {
SpaBuffer *outbuf;
SpaMetaHeader *h;
SpaMetaRingbuffer *rb;
bool outstanding;
SpaALSABuffer *next;
};
@ -96,13 +98,16 @@ struct _SpaALSAState {
size_t frame_size;
SpaPortInfo info;
SpaAllocParam *params[2];
SpaAllocParam *params[3];
SpaAllocParamBuffers param_buffers;
SpaAllocParamMetaEnable param_meta;
SpaAllocParamMetaEnableRingbuffer param_meta_rb;
SpaPortStatus status;
SpaALSABuffer buffers[MAX_BUFFERS];
unsigned int n_buffers;
bool use_ringbuffer;
SpaALSABuffer *ringbuffer;
SpaQueue free;
SpaQueue ready;

View file

@ -6,7 +6,7 @@ spa_alsa_sources = ['alsa.c',
spa_alsa = shared_library('spa-alsa',
spa_alsa_sources,
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
dependencies : [ alsa_dep, libudev_dep ],
link_with : spalib,
install : true,