mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
loop: add signal count to callback
Don't try to signal too many times
This commit is contained in:
parent
aff9564518
commit
91d54364fc
8 changed files with 20 additions and 12 deletions
|
|
@ -42,16 +42,16 @@ struct spa_graph {
|
||||||
struct spa_list nodes;
|
struct spa_list nodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SPA_VERSION_GRAPH_NODE_METHODS 0
|
|
||||||
struct spa_graph_node_methods {
|
struct spa_graph_node_methods {
|
||||||
|
#define SPA_VERSION_GRAPH_NODE_METHODS 0
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
|
||||||
int (*process_input) (struct spa_graph_node *node, void *user_data);
|
int (*process_input) (struct spa_graph_node *node, void *user_data);
|
||||||
int (*process_output) (struct spa_graph_node *node, void *user_data);
|
int (*process_output) (struct spa_graph_node *node, void *user_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SPA_VERSION_GRAPH_PORT_METHODS 0
|
|
||||||
struct spa_graph_port_methods {
|
struct spa_graph_port_methods {
|
||||||
|
#define SPA_VERSION_GRAPH_PORT_METHODS 0
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
|
||||||
int (*reuse_buffer) (struct spa_graph_port *port, uint32_t buffer_id, void *user_data);
|
int (*reuse_buffer) (struct spa_graph_port *port, uint32_t buffer_id, void *user_data);
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,8 @@ typedef void (*spa_source_io_func_t) (struct spa_loop_utils *utils,
|
||||||
typedef void (*spa_source_idle_func_t) (struct spa_loop_utils *utils,
|
typedef void (*spa_source_idle_func_t) (struct spa_loop_utils *utils,
|
||||||
struct spa_source *source, void *data);
|
struct spa_source *source, void *data);
|
||||||
typedef void (*spa_source_event_func_t) (struct spa_loop_utils *utils,
|
typedef void (*spa_source_event_func_t) (struct spa_loop_utils *utils,
|
||||||
struct spa_source *source, void *data);
|
struct spa_source *source,
|
||||||
|
uint64_t count, void *data);
|
||||||
typedef void (*spa_source_timer_func_t) (struct spa_loop_utils *utils,
|
typedef void (*spa_source_timer_func_t) (struct spa_loop_utils *utils,
|
||||||
struct spa_source *source, void *data);
|
struct spa_source *source, void *data);
|
||||||
typedef void (*spa_source_signal_func_t) (struct spa_loop_utils *utils,
|
typedef void (*spa_source_signal_func_t) (struct spa_loop_utils *utils,
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ loop_invoke(struct spa_loop *loop,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wakeup_func(struct spa_loop_utils *utils, struct spa_source *source, void *data)
|
static void wakeup_func(struct spa_loop_utils *utils, struct spa_source *source, uint64_t count, void *data)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
|
|
@ -458,7 +458,7 @@ static void source_event_func(struct spa_source *source)
|
||||||
if (read(source->fd, &count, sizeof(uint64_t)) != sizeof(uint64_t))
|
if (read(source->fd, &count, sizeof(uint64_t)) != sizeof(uint64_t))
|
||||||
spa_log_warn(impl->impl->log, NAME " %p: failed to read event fd: %s", source, strerror(errno));
|
spa_log_warn(impl->impl->log, NAME " %p: failed to read event fd: %s", source, strerror(errno));
|
||||||
|
|
||||||
impl->func.event(&impl->impl->utils, source, source->data);
|
impl->func.event(&impl->impl->utils, source, count, source->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spa_source *loop_add_event(struct spa_loop_utils *utils,
|
static struct spa_source *loop_add_event(struct spa_loop_utils *utils,
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ struct connection {
|
||||||
struct pw_protocol_native_connection *connection;
|
struct pw_protocol_native_connection *connection;
|
||||||
|
|
||||||
bool disconnecting;
|
bool disconnecting;
|
||||||
|
bool flush_signaled;
|
||||||
struct pw_listener need_flush;
|
struct pw_listener need_flush;
|
||||||
struct spa_source *flush_event;
|
struct spa_source *flush_event;
|
||||||
};
|
};
|
||||||
|
|
@ -473,9 +474,11 @@ on_remote_data(struct spa_loop_utils *utils,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void do_flush_event(struct spa_loop_utils *utils, struct spa_source *source, void *data)
|
static void do_flush_event(struct spa_loop_utils *utils, struct spa_source *source,
|
||||||
|
uint64_t count, void *data)
|
||||||
{
|
{
|
||||||
struct connection *impl = data;
|
struct connection *impl = data;
|
||||||
|
impl->flush_signaled = false;
|
||||||
if (impl->connection)
|
if (impl->connection)
|
||||||
if (!pw_protocol_native_connection_flush(impl->connection))
|
if (!pw_protocol_native_connection_flush(impl->connection))
|
||||||
impl->this.disconnect(&impl->this);
|
impl->this.disconnect(&impl->this);
|
||||||
|
|
@ -485,7 +488,11 @@ static void on_need_flush(struct pw_listener *listener, struct pw_protocol_nativ
|
||||||
{
|
{
|
||||||
struct connection *impl = SPA_CONTAINER_OF(listener, struct connection, need_flush);
|
struct connection *impl = SPA_CONTAINER_OF(listener, struct connection, need_flush);
|
||||||
struct pw_remote *remote = impl->this.remote;
|
struct pw_remote *remote = impl->this.remote;
|
||||||
pw_loop_signal_event(remote->core->main_loop, impl->flush_event);
|
|
||||||
|
if (!impl->flush_signaled) {
|
||||||
|
impl->flush_signaled = true;
|
||||||
|
pw_loop_signal_event(remote->core->main_loop, impl->flush_event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int impl_connect_fd(struct pw_protocol_connection *conn, int fd)
|
static int impl_connect_fd(struct pw_protocol_connection *conn, int fd)
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ static void *do_loop(void *user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void do_stop(struct spa_loop_utils *utils, struct spa_source *source, void *data)
|
static void do_stop(struct spa_loop_utils *utils, struct spa_source *source, uint64_t count, void *data)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
impl->running = false;
|
impl->running = false;
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,8 @@ enum pw_port_state {
|
||||||
|
|
||||||
struct pw_port;
|
struct pw_port;
|
||||||
|
|
||||||
#define PW_VERSION_PORT_IMPLEMENTATION 0
|
|
||||||
|
|
||||||
struct pw_port_implementation {
|
struct pw_port_implementation {
|
||||||
|
#define PW_VERSION_PORT_IMPLEMENTATION 0
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
|
||||||
int (*enum_formats) (struct pw_port *port,
|
int (*enum_formats) (struct pw_port *port,
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ static const struct spa_loop_control_hooks impl_hooks = {
|
||||||
after,
|
after,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void do_stop(struct spa_loop_utils *utils, struct spa_source *source, void *data)
|
static void do_stop(struct spa_loop_utils *utils, struct spa_source *source, uint64_t count, void *data)
|
||||||
{
|
{
|
||||||
struct thread_loop *impl = data;
|
struct thread_loop *impl = data;
|
||||||
impl->running = false;
|
impl->running = false;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,8 @@ struct impl {
|
||||||
};
|
};
|
||||||
/** \endcond */
|
/** \endcond */
|
||||||
|
|
||||||
static void process_work_queue(struct spa_loop_utils *utils, struct spa_source *source, void *data)
|
static void process_work_queue(struct spa_loop_utils *utils, struct spa_source *source,
|
||||||
|
uint64_t count, void *data)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
struct pw_work_queue *this = &impl->this;
|
struct pw_work_queue *this = &impl->this;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue