mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
small cleanups
This commit is contained in:
parent
cc542935ea
commit
e5807cd467
4 changed files with 16 additions and 21 deletions
|
|
@ -65,10 +65,9 @@ static inline int spa_graph_link_trigger(struct spa_graph_link *link)
|
||||||
spa_debug("link %p: state %p: pending %d required %d", link, state,
|
spa_debug("link %p: state %p: pending %d required %d", link, state,
|
||||||
state->pending, state->required);
|
state->pending, state->required);
|
||||||
|
|
||||||
if (state->pending != 0) {
|
if (__atomic_sub_fetch(&state->pending, 1, __ATOMIC_SEQ_CST) == 0)
|
||||||
if (__atomic_sub_fetch(&state->pending, 1, __ATOMIC_SEQ_CST) == 0)
|
spa_graph_link_signal(link);
|
||||||
spa_graph_link_signal(link);
|
|
||||||
}
|
|
||||||
return state->status;
|
return state->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@
|
||||||
#include "pipewire/main-loop.h"
|
#include "pipewire/main-loop.h"
|
||||||
#include "pipewire/work-queue.h"
|
#include "pipewire/work-queue.h"
|
||||||
|
|
||||||
#define spa_debug pw_log_trace
|
|
||||||
|
|
||||||
#include <spa/graph/graph-scheduler2.h>
|
#include <spa/graph/graph-scheduler2.h>
|
||||||
|
|
||||||
/** \cond */
|
/** \cond */
|
||||||
|
|
@ -616,11 +614,13 @@ static void node_event(void *data, struct spa_event *event)
|
||||||
spa_hook_list_call(&node->listener_list, struct pw_node_events, event, event);
|
spa_hook_list_call(&node->listener_list, struct pw_node_events, event, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pw_node_process(struct pw_node *node, int status)
|
static void node_process(void *data, int status)
|
||||||
{
|
{
|
||||||
|
struct pw_node *node = data;
|
||||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||||
|
|
||||||
pw_log_trace("node %p: process driver:%d exported:%d", node, node->driver, node->exported);
|
pw_log_trace("node %p: process driver:%d exported:%d", node,
|
||||||
|
node->driver, node->exported);
|
||||||
|
|
||||||
spa_hook_list_call(&node->listener_list, struct pw_node_events, process);
|
spa_hook_list_call(&node->listener_list, struct pw_node_events, process);
|
||||||
|
|
||||||
|
|
@ -645,12 +645,6 @@ void pw_node_process(struct pw_node *node, int status)
|
||||||
spa_graph_node_trigger(&node->rt.node);
|
spa_graph_node_trigger(&node->rt.node);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void node_process(void *data, int status)
|
|
||||||
{
|
|
||||||
struct pw_node *node = data;
|
|
||||||
pw_node_process(node, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void node_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
|
static void node_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
|
||||||
{
|
{
|
||||||
struct pw_node *node = data;
|
struct pw_node *node = data;
|
||||||
|
|
|
||||||
|
|
@ -624,8 +624,6 @@ int pw_node_initialized(struct pw_node *node);
|
||||||
|
|
||||||
int pw_node_set_driver(struct pw_node *node, struct pw_node *driver);
|
int pw_node_set_driver(struct pw_node *node, struct pw_node *driver);
|
||||||
|
|
||||||
void pw_node_process(struct pw_node *node, int status);
|
|
||||||
|
|
||||||
/** Prepare a link \memberof pw_link
|
/** Prepare a link \memberof pw_link
|
||||||
* Starts the negotiation of formats and buffers on \a link */
|
* Starts the negotiation of formats and buffers on \a link */
|
||||||
int pw_link_prepare(struct pw_link *link);
|
int pw_link_prepare(struct pw_link *link);
|
||||||
|
|
|
||||||
|
|
@ -189,8 +189,6 @@ static inline int push_queue(struct stream *stream, struct queue *queue, struct
|
||||||
queue->ids[index & MASK_BUFFERS] = buffer->id;
|
queue->ids[index & MASK_BUFFERS] = buffer->id;
|
||||||
spa_ringbuffer_write_update(&queue->ring, index + 1);
|
spa_ringbuffer_write_update(&queue->ring, index + 1);
|
||||||
|
|
||||||
pw_log_trace("stream %p: queued buffer %d", stream, buffer->id);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -605,8 +603,10 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
|
||||||
b->id = i;
|
b->id = i;
|
||||||
b->this.buffer = buffers[i];
|
b->this.buffer = buffers[i];
|
||||||
|
|
||||||
if (impl->direction == SPA_DIRECTION_OUTPUT)
|
if (impl->direction == SPA_DIRECTION_OUTPUT) {
|
||||||
|
pw_log_trace("stream %p: recycle buffer %d", stream, b->id);
|
||||||
push_queue(impl, &impl->dequeued, b);
|
push_queue(impl, &impl->dequeued, b);
|
||||||
|
}
|
||||||
|
|
||||||
spa_hook_list_call(&stream->listener_list, struct pw_stream_events,
|
spa_hook_list_call(&stream->listener_list, struct pw_stream_events,
|
||||||
add_buffer, &b->this);
|
add_buffer, &b->this);
|
||||||
|
|
@ -653,7 +653,9 @@ static int impl_node_process_input(struct spa_node *node)
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* pop buffer to recycle */
|
/* pop buffer to recycle */
|
||||||
b = pop_queue(impl, &impl->queued);
|
if ((b = pop_queue(impl, &impl->queued))) {
|
||||||
|
pw_log_trace("stream %p: recycle buffer %d", stream, b->id);
|
||||||
|
}
|
||||||
|
|
||||||
io->buffer_id = b ? b->id : SPA_ID_INVALID;
|
io->buffer_id = b ? b->id : SPA_ID_INVALID;
|
||||||
io->status = SPA_STATUS_NEED_BUFFER;
|
io->status = SPA_STATUS_NEED_BUFFER;
|
||||||
|
|
@ -676,8 +678,10 @@ static int impl_node_process_output(struct spa_node *node)
|
||||||
res = 0;
|
res = 0;
|
||||||
if (io->status != SPA_STATUS_HAVE_BUFFER) {
|
if (io->status != SPA_STATUS_HAVE_BUFFER) {
|
||||||
/* recycle old buffer */
|
/* recycle old buffer */
|
||||||
if ((b = get_buffer(stream, io->buffer_id)) != NULL)
|
if ((b = get_buffer(stream, io->buffer_id)) != NULL) {
|
||||||
|
pw_log_trace("stream %p: recycle buffer %d", stream, b->id);
|
||||||
push_queue(impl, &impl->dequeued, b);
|
push_queue(impl, &impl->dequeued, b);
|
||||||
|
}
|
||||||
|
|
||||||
/* pop new buffer */
|
/* pop new buffer */
|
||||||
if ((b = pop_queue(impl, &impl->queued)) != NULL) {
|
if ((b = pop_queue(impl, &impl->queued)) != NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue