Add sync and async support in *testsrc

Make minumum alsa latency configurable.
This commit is contained in:
Wim Taymans 2017-04-03 16:54:44 +02:00
parent 01c13adab5
commit 5c32690cc8
13 changed files with 186 additions and 153 deletions

View file

@ -32,17 +32,13 @@
typedef struct _SpaALSAState SpaALSASink;
static const char default_device[] = "default";
static const uint32_t default_period_size = 128;
static const uint32_t default_periods = 2;
static const bool default_period_event = 0;
static const uint32_t default_min_latency = 1024;
static void
reset_alsa_sink_props (SpaALSAProps *props)
{
strncpy (props->device, default_device, 64);
props->period_size = default_period_size;
props->periods = default_periods;
props->period_event = default_period_event;
props->min_latency = default_min_latency;
}
static void
@ -83,9 +79,7 @@ spa_alsa_sink_node_get_props (SpaNode *node,
PROP (&f[1], this->type.prop_device, -SPA_POD_TYPE_STRING, this->props.device, sizeof (this->props.device)),
PROP (&f[1], this->type.prop_device_name, -SPA_POD_TYPE_STRING, this->props.device_name, sizeof (this->props.device_name)),
PROP (&f[1], this->type.prop_card_name, -SPA_POD_TYPE_STRING, this->props.card_name, sizeof (this->props.card_name)),
PROP_MM (&f[1], this->type.prop_period_size, SPA_POD_TYPE_INT, this->props.period_size, 1, INT32_MAX),
PROP_MM (&f[1], this->type.prop_periods, SPA_POD_TYPE_INT, this->props.periods, 1, INT32_MAX),
PROP (&f[1], this->type.prop_period_event, SPA_POD_TYPE_BOOL, this->props.period_event));
PROP_MM (&f[1], this->type.prop_min_latency, SPA_POD_TYPE_INT, this->props.min_latency, 1, INT32_MAX));
*props = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaProps);
@ -109,9 +103,7 @@ spa_alsa_sink_node_set_props (SpaNode *node,
} else {
spa_props_query (props,
this->type.prop_device, -SPA_POD_TYPE_STRING, this->props.device, sizeof (this->props.device),
this->type.prop_period_size, SPA_POD_TYPE_INT, &this->props.period_size,
this->type.prop_periods, SPA_POD_TYPE_INT, &this->props.periods,
this->type.prop_period_event, SPA_POD_TYPE_BOOL, &this->props.period_event,
this->type.prop_min_latency, SPA_POD_TYPE_INT, &this->props.min_latency,
0);
}
return SPA_RESULT_OK;