mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
hook: return number of hooks called
Do finish_format ourselved when nobody was listening for the format change.
This commit is contained in:
parent
fb7a51c6e7
commit
8cadcd7f56
2 changed files with 13 additions and 4 deletions
|
|
@ -78,19 +78,23 @@ static inline void spa_hook_remove(struct spa_hook *hook)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Call all hooks in a list, starting from the given one and optionally stopping
|
/** Call all hooks in a list, starting from the given one and optionally stopping
|
||||||
* after calling the first non-NULL function */
|
* after calling the first non-NULL function, returns the number of methods
|
||||||
|
* called */
|
||||||
#define spa_hook_list_do_call(l,start,type,method,once,...) ({ \
|
#define spa_hook_list_do_call(l,start,type,method,once,...) ({ \
|
||||||
struct spa_hook_list *list = l; \
|
struct spa_hook_list *list = l; \
|
||||||
struct spa_list *s = start ? (struct spa_list *)start : &list->list; \
|
struct spa_list *s = start ? (struct spa_list *)start : &list->list; \
|
||||||
struct spa_hook *ci, *t; \
|
struct spa_hook *ci, *t; \
|
||||||
|
int count = 0; \
|
||||||
spa_list_for_each_safe_next(ci, t, &list->list, s, link) { \
|
spa_list_for_each_safe_next(ci, t, &list->list, s, link) { \
|
||||||
const type *cb = ci->funcs; \
|
const type *cb = ci->funcs; \
|
||||||
if (cb->method) { \
|
if (cb->method) { \
|
||||||
cb->method(ci->data, ## __VA_ARGS__); \
|
cb->method(ci->data, ## __VA_ARGS__); \
|
||||||
|
count++; \
|
||||||
if (once) \
|
if (once) \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
count; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define spa_hook_list_call(l,t,m,...) spa_hook_list_do_call(l,NULL,t,m,false,##__VA_ARGS__)
|
#define spa_hook_list_call(l,t,m,...) spa_hook_list_do_call(l,NULL,t,m,false,##__VA_ARGS__)
|
||||||
|
|
|
||||||
|
|
@ -800,6 +800,8 @@ client_node_port_set_param(void *data,
|
||||||
struct pw_type *t = &stream->remote->core->type;
|
struct pw_type *t = &stream->remote->core->type;
|
||||||
|
|
||||||
if (id == t->param.idFormat) {
|
if (id == t->param.idFormat) {
|
||||||
|
int count;
|
||||||
|
|
||||||
pw_log_debug("stream %p: format changed %d", stream, seq);
|
pw_log_debug("stream %p: format changed %d", stream, seq);
|
||||||
|
|
||||||
if (impl->format)
|
if (impl->format)
|
||||||
|
|
@ -814,9 +816,12 @@ client_node_port_set_param(void *data,
|
||||||
|
|
||||||
impl->pending_seq = seq;
|
impl->pending_seq = seq;
|
||||||
|
|
||||||
spa_hook_list_call(&stream->listener_list,
|
count = spa_hook_list_call(&stream->listener_list,
|
||||||
struct pw_stream_events,
|
struct pw_stream_events,
|
||||||
format_changed, impl->format);
|
format_changed, impl->format);
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
pw_stream_finish_format(stream, 0, NULL, 0);
|
||||||
|
|
||||||
if (impl->format)
|
if (impl->format)
|
||||||
stream_set_state(stream, PW_STREAM_STATE_READY, NULL);
|
stream_set_state(stream, PW_STREAM_STATE_READY, NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue