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:
Wim Taymans 2023-03-23 18:39:27 +01:00
parent 1bdd5eee69
commit 6e8625cf96
13 changed files with 87 additions and 3 deletions

View file

@ -682,9 +682,18 @@ static int process_write(struct seq_state *state)
return res;
}
static void update_target(struct seq_state *state)
{
if (SPA_LIKELY(state->position)) {
struct spa_io_clock *clock = &state->position->clock;
clock->duration = clock->target_duration;
clock->rate = clock->target_rate;
}
}
static void update_position(struct seq_state *state)
{
if (state->position) {
if (SPA_LIKELY(state->position)) {
struct spa_io_clock *clock = &state->position->clock;
state->rate = clock->rate;
if (state->rate.num == 0 || state->rate.denom == 0)
@ -789,6 +798,8 @@ static void alsa_on_timeout_event(struct spa_source *source)
}
}
update_target(state);
state->current_time = state->next_time;
spa_log_trace(state->log, "timeout %"PRIu64, state->current_time);