mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
small cleanups
This commit is contained in:
parent
65e00631da
commit
c61d579d99
9 changed files with 34 additions and 19 deletions
|
|
@ -601,7 +601,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
spa_list_append(&this->ready, &b->link);
|
||||
SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT);
|
||||
|
||||
this->threshold = b->buf->datas[0].chunk->size / this->frame_size;
|
||||
this->threshold = SPA_MIN(b->buf->datas[0].chunk->size / this->frame_size,
|
||||
this->props.max_latency);
|
||||
|
||||
spa_alsa_write(this, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ int spa_alsa_close(struct state *state)
|
|||
if (!state->opened)
|
||||
return 0;
|
||||
|
||||
spa_log_info(state->log, "Device closing");
|
||||
spa_log_info(state->log, "Device '%s' closing", state->props.device);
|
||||
CHECK(snd_pcm_close(state->hndl), "close failed");
|
||||
|
||||
close(state->timerfd);
|
||||
|
|
|
|||
|
|
@ -372,12 +372,14 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
|
|||
spa_pod_fixate(param);
|
||||
|
||||
if (link->in_info)
|
||||
in_alloc = SPA_FLAG_CHECK(link->in_info->flags, SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
|
||||
in_alloc = SPA_FLAG_CHECK(link->in_info->flags,
|
||||
SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
|
||||
else
|
||||
in_alloc = false;
|
||||
|
||||
if (link->out_info)
|
||||
out_alloc = SPA_FLAG_CHECK(link->out_info->flags, SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
|
||||
out_alloc = SPA_FLAG_CHECK(link->out_info->flags,
|
||||
SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
|
||||
else
|
||||
out_alloc = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -721,8 +721,11 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
if (id == t->io.Buffers)
|
||||
if (id == t->io.Buffers) {
|
||||
spa_log_trace(this->log, NAME " %p: port %d update buffer io %p",
|
||||
this, port_id, data);
|
||||
port->io = data;
|
||||
}
|
||||
else
|
||||
return -ENOENT;
|
||||
|
||||
|
|
@ -801,7 +804,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
spa_return_val_if_fail(outio != NULL, -EIO);
|
||||
spa_return_val_if_fail(inio != NULL, -EIO);
|
||||
|
||||
spa_log_trace(this->log, NAME " %p: status %d %d", this, inio->status, outio->status);
|
||||
spa_log_trace(this->log, NAME " %p: status %p %d %p %d", this,
|
||||
inio, inio->status, outio, outio->status);
|
||||
|
||||
if (outio->status != SPA_STATUS_NEED_BUFFER)
|
||||
return outio->status;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ struct props {
|
|||
#define MAX_BUFFERS 32
|
||||
|
||||
struct buffer {
|
||||
struct spa_buffer *outbuf;
|
||||
struct spa_buffer *buf;
|
||||
struct spa_meta_header *h;
|
||||
bool outstanding;
|
||||
struct spa_list link;
|
||||
|
|
@ -182,7 +182,7 @@ struct impl {
|
|||
|
||||
#define CHECK_PORT(this,d,p) ((d) == SPA_DIRECTION_INPUT && (p) == 0)
|
||||
|
||||
static const uint32_t default_min_latency = 1024;
|
||||
static const uint32_t default_min_latency = 128;
|
||||
static const uint32_t default_max_latency = 1024;
|
||||
|
||||
static void reset_props(struct props *props)
|
||||
|
|
@ -502,7 +502,7 @@ static int flush_data(struct impl *this, uint64_t now_time)
|
|||
uint32_t index, offs, avail, l0, l1;
|
||||
|
||||
b = spa_list_first(&this->ready, struct buffer, link);
|
||||
d = b->outbuf->datas;
|
||||
d = b->buf->datas;
|
||||
|
||||
src = d[0].data;
|
||||
|
||||
|
|
@ -530,8 +530,8 @@ static int flush_data(struct impl *this, uint64_t now_time)
|
|||
if (this->ready_offset >= d[0].chunk->size) {
|
||||
spa_list_remove(&b->link);
|
||||
b->outstanding = true;
|
||||
spa_log_trace(this->log, "a2dp-sink %p: reuse buffer %u", this, b->outbuf->id);
|
||||
this->callbacks->reuse_buffer(this->callbacks_data, 0, b->outbuf->id);
|
||||
spa_log_trace(this->log, "a2dp-sink %p: reuse buffer %u", this, b->buf->id);
|
||||
this->callbacks->reuse_buffer(this->callbacks_data, 0, b->buf->id);
|
||||
this->ready_offset = 0;
|
||||
}
|
||||
total_frames += n_frames;
|
||||
|
|
@ -1174,10 +1174,10 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
struct buffer *b = &this->buffers[i];
|
||||
uint32_t type;
|
||||
|
||||
b->outbuf = buffers[i];
|
||||
b->buf = buffers[i];
|
||||
b->outstanding = true;
|
||||
|
||||
b->h = spa_buffer_find_meta(b->outbuf, this->type.meta.Header);
|
||||
b->h = spa_buffer_find_meta(b->buf, this->type.meta.Header);
|
||||
|
||||
type = buffers[i]->datas[0].type;
|
||||
if ((type == this->type.data.MemFd ||
|
||||
|
|
@ -1186,6 +1186,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
spa_log_error(this->log, NAME " %p: need mapped memory", this);
|
||||
return -EINVAL;
|
||||
}
|
||||
this->threshold = buffers[i]->datas[0].maxsize / this->frame_size;
|
||||
}
|
||||
this->n_buffers = n_buffers;
|
||||
|
||||
|
|
@ -1281,6 +1282,9 @@ static int impl_node_process(struct spa_node *node)
|
|||
spa_list_append(&this->ready, &b->link);
|
||||
b->outstanding = false;
|
||||
|
||||
this->threshold = SPA_MIN(b->buf->datas[0].chunk->size / this->frame_size,
|
||||
this->props.max_latency);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &this->now);
|
||||
now_time = this->now.tv_sec * SPA_NSEC_PER_SEC + this->now.tv_nsec;
|
||||
|
||||
|
|
|
|||
|
|
@ -333,6 +333,8 @@ static int link_session_dsp(struct session *session)
|
|||
struct pw_port *op, *ip;
|
||||
char *error = NULL;
|
||||
|
||||
pw_log_debug("module %p: link session dsp '%d'", impl, session->id);
|
||||
|
||||
if (session->direction == PW_DIRECTION_OUTPUT) {
|
||||
op = session->dsp_port;
|
||||
ip = session->node_port;
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ process_messages(struct client_data *data)
|
|||
goto invalid_message;
|
||||
|
||||
if (debug_messages) {
|
||||
printf("<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
||||
fprintf(stderr, "<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
||||
spa_debug_pod((struct spa_pod *)message, 0);
|
||||
}
|
||||
if (demarshal[opcode].func(resource, message, size) < 0)
|
||||
|
|
@ -560,7 +560,7 @@ on_remote_data(void *data, int fd, enum spa_io mask)
|
|||
}
|
||||
}
|
||||
if (debug_messages) {
|
||||
printf("<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
||||
fprintf(stderr, "<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
||||
spa_debug_pod((struct spa_pod *)message, 0);
|
||||
}
|
||||
if (demarshal[opcode].func(proxy, message, size) < 0) {
|
||||
|
|
|
|||
|
|
@ -431,10 +431,11 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
|
|||
buf->buffer_size += 8 + size;
|
||||
|
||||
if (debug_messages) {
|
||||
printf(">>>>>>>>> out: %d %d %d\n", impl->dest_id, impl->opcode, size);
|
||||
fprintf(stderr, ">>>>>>>>> out: %d %d %d\n", impl->dest_id, impl->opcode, size);
|
||||
spa_debug_pod((struct spa_pod *)p, 0);
|
||||
}
|
||||
spa_hook_list_call(&conn->listener_list, struct pw_protocol_native_connection_events, need_flush);
|
||||
spa_hook_list_call(&conn->listener_list,
|
||||
struct pw_protocol_native_connection_events, need_flush);
|
||||
}
|
||||
|
||||
/** Flush the connection object
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@ static int configure_converter(struct stream *impl)
|
|||
return -ENOTSUP;
|
||||
|
||||
if (impl->io != &impl->conv_io) {
|
||||
pw_log_debug("stream %p: update io %p %p", impl, impl->io, &impl->conv_io);
|
||||
res = spa_node_port_set_io(impl->convert,
|
||||
impl->direction, 0,
|
||||
t->io.Buffers,
|
||||
|
|
@ -751,11 +752,11 @@ static int impl_node_process_output(struct spa_node *node)
|
|||
if ((b = pop_queue(impl, &impl->queued)) != NULL) {
|
||||
io->buffer_id = b->id;
|
||||
io->status = SPA_STATUS_HAVE_BUFFER;
|
||||
pw_log_trace("stream %p: pop %d", stream, b->id);
|
||||
pw_log_trace("stream %p: pop %d %p", stream, b->id, io);
|
||||
} else {
|
||||
io->buffer_id = SPA_ID_INVALID;
|
||||
io->status = SPA_STATUS_NEED_BUFFER;
|
||||
pw_log_trace("stream %p: no more buffers", stream);
|
||||
pw_log_trace("stream %p: no more buffers %p", stream, io);
|
||||
}
|
||||
}
|
||||
if (io->status == SPA_STATUS_HAVE_BUFFER && impl->use_converter) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue