mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
node: update the duration/rate from the target
Before scheduling the graph from the driver, update the duration and rate with the new targets.
This commit is contained in:
parent
1bdd5eee69
commit
6e8625cf96
13 changed files with 87 additions and 3 deletions
|
|
@ -951,6 +951,15 @@ static int impl_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffe
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void update_target(struct filter *impl)
|
||||
{
|
||||
struct spa_io_position *p = impl->rt.position;
|
||||
if (SPA_LIKELY(p != NULL)) {
|
||||
p->clock.duration = p->clock.target_duration;
|
||||
p->clock.rate = p->clock.target_rate;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_position(struct filter *impl)
|
||||
{
|
||||
struct spa_io_position *p = impl->rt.position;
|
||||
|
|
@ -1954,7 +1963,10 @@ do_trigger_process(struct spa_loop *loop,
|
|||
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
|
||||
{
|
||||
struct filter *impl = user_data;
|
||||
int res = impl_node_process(impl);
|
||||
int res;
|
||||
|
||||
update_target(impl);
|
||||
res = impl_node_process(impl);
|
||||
return spa_node_call_ready(&impl->callbacks, res);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -572,6 +572,15 @@ static int impl_set_param(void *object, uint32_t id, uint32_t flags, const struc
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void update_target(struct stream *impl)
|
||||
{
|
||||
struct spa_io_position *p = impl->rt.position;
|
||||
if (SPA_LIKELY(p != NULL)) {
|
||||
p->clock.duration = p->clock.target_duration;
|
||||
p->clock.rate = p->clock.target_rate;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_position(struct stream *impl, int64_t queued)
|
||||
{
|
||||
struct spa_io_position *p = impl->rt.position;
|
||||
|
|
@ -2263,7 +2272,9 @@ do_trigger_deprecated(struct spa_loop *loop,
|
|||
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
|
||||
{
|
||||
struct stream *impl = user_data;
|
||||
int res = impl->node_methods.process(impl);
|
||||
int res;
|
||||
update_target(impl);
|
||||
res = impl->node_methods.process(impl);
|
||||
return spa_node_call_ready(&impl->callbacks, res);
|
||||
}
|
||||
|
||||
|
|
@ -2414,6 +2425,8 @@ int pw_stream_trigger_process(struct pw_stream *stream)
|
|||
if (!impl->driving && !impl->trigger) {
|
||||
res = trigger_request_process(impl);
|
||||
} else {
|
||||
update_target(impl);
|
||||
|
||||
if (!impl->process_rt)
|
||||
call_process(impl);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue