Add example to play sine wave

Various build fixes and cleanups
Move port_add to private and make node ports based on implementation.
Improve pull based scheduling on remote nodes
This commit is contained in:
Wim Taymans 2017-09-07 10:22:32 +02:00
parent 36ac8a6545
commit 21cd5a2918
26 changed files with 640 additions and 185 deletions

View file

@ -32,7 +32,7 @@
#define CHECK_PORT(this,d,p) ((d) == SPA_DIRECTION_INPUT && (p) == 0)
static const char default_device[] = "hw:0";
static const uint32_t default_min_latency = 128;
static const uint32_t default_min_latency = 64;
static void reset_props(struct props *props)
{
@ -368,13 +368,13 @@ impl_node_port_enum_params(struct spa_node *node,
switch (index) {
case 0:
spa_pod_builder_object(&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
PROP(&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT,
this->props.min_latency * this->frame_size),
PROP_U_MM(&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT,
this->props.min_latency * this->frame_size,
this->props.min_latency * this->frame_size, INT32_MAX),
PROP(&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT,
0),
PROP_MM(&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT,
32,
1, 32),
2, 2, 32),
PROP(&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT,
16));
break;

View file

@ -265,7 +265,7 @@ static void read_timer(struct impl *this)
uint64_t expirations;
if ((this->callbacks && this->callbacks->have_output) || this->props.live) {
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) < sizeof(uint64_t))
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) != sizeof(uint64_t))
perror("read timerfd");
}
}
@ -754,7 +754,7 @@ impl_node_port_use_buffers(struct spa_node *node,
spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this,
buffers[i]);
}
spa_list_insert(this->empty.prev, &b->link);
spa_list_append(&this->empty, &b->link);
}
this->n_buffers = n_buffers;
@ -811,7 +811,7 @@ static inline void reuse_buffer(struct impl *this, uint32_t id)
spa_log_trace(this->log, NAME " %p: reuse buffer %d", this, id);
b->outstanding = false;
spa_list_insert(this->empty.prev, &b->link);
spa_list_append(&this->empty, &b->link);
if (!this->props.live)
set_timer(this, true);

View file

@ -206,7 +206,7 @@ static inline void read_timer(struct impl *this)
uint64_t expirations;
if ((this->callbacks && this->callbacks->need_input) || this->props.live) {
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) < sizeof(uint64_t))
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) != sizeof(uint64_t))
perror("read timerfd");
}
}

View file

@ -222,7 +222,7 @@ static inline void read_timer(struct impl *this)
uint64_t expirations;
if ((this->callbacks && this->callbacks->have_output) || this->props.live) {
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) < sizeof(uint64_t))
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) != sizeof(uint64_t))
perror("read timerfd");
}
}

View file

@ -985,7 +985,7 @@ static int spa_v4l2_use_buffers(struct impl *this, struct spa_buffer **buffers,
return SPA_RESULT_ERROR;
}
spa_log_info(state->log, "v4l2: got %d buffers", reqbuf.count);
if (reqbuf.count < 2) {
if (reqbuf.count < n_buffers) {
spa_log_error(state->log, "v4l2: can't allocate enough buffers");
return SPA_RESULT_ERROR;
}

View file

@ -247,7 +247,7 @@ static void read_timer(struct impl *this)
uint64_t expirations;
if ((this->callbacks && this->callbacks->have_output) || this->props.live) {
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) < sizeof(uint64_t))
if (read(this->timer_source.fd, &expirations, sizeof(uint64_t)) != sizeof(uint64_t))
perror("read timerfd");
}
}