mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
slave -> follower
We use master/follower terminology everywhere.
This commit is contained in:
parent
bdeeebfdd4
commit
a528189d26
22 changed files with 301 additions and 300 deletions
|
|
@ -647,7 +647,7 @@ static void set_loop(struct seq_state *state, double bw)
|
|||
|
||||
#define NSEC_TO_CLOCK(c,n) ((n) * (c)->rate.denom / ((c)->rate.num * SPA_NSEC_PER_SEC))
|
||||
|
||||
static int update_time(struct seq_state *state, uint64_t nsec, bool slave)
|
||||
static int update_time(struct seq_state *state, uint64_t nsec, bool follower)
|
||||
{
|
||||
snd_seq_queue_status_t *status;
|
||||
const snd_seq_real_time_t* queue_time;
|
||||
|
|
@ -699,13 +699,13 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool slave)
|
|||
else if (state->bw == BW_MED)
|
||||
set_loop(state, BW_MIN);
|
||||
|
||||
spa_log_debug(state->log, NAME" %p: slave:%d rate:%f bw:%f err:%f (%f %f %f)",
|
||||
state, slave, corr, state->bw, err, state->z1, state->z2, state->z3);
|
||||
spa_log_debug(state->log, NAME" %p: follower:%d rate:%f bw:%f err:%f (%f %f %f)",
|
||||
state, follower, corr, state->bw, err, state->z1, state->z2, state->z3);
|
||||
}
|
||||
|
||||
state->next_time += state->threshold / corr * 1e9 / state->rate.denom;
|
||||
|
||||
if (!slave && state->clock) {
|
||||
if (!follower && state->clock) {
|
||||
state->clock->nsec = nsec;
|
||||
state->clock->position += state->duration;
|
||||
state->clock->duration = state->duration;
|
||||
|
|
@ -726,7 +726,7 @@ int spa_alsa_seq_process(struct seq_state *state)
|
|||
|
||||
res = process_recycle(state);
|
||||
|
||||
if (state->slaved) {
|
||||
if (state->following) {
|
||||
update_time(state, state->position->clock.nsec, true);
|
||||
res |= process_read(state);
|
||||
}
|
||||
|
|
@ -791,7 +791,7 @@ static int set_timers(struct seq_state *state)
|
|||
spa_system_clock_gettime(state->data_system, CLOCK_MONOTONIC, &now);
|
||||
|
||||
state->next_time = SPA_TIMESPEC_TO_NSEC(&now);
|
||||
if (state->slaved) {
|
||||
if (state->following) {
|
||||
set_timeout(state, 0);
|
||||
} else {
|
||||
set_timeout(state, state->next_time);
|
||||
|
|
@ -799,7 +799,7 @@ static int set_timers(struct seq_state *state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline bool is_slaved(struct seq_state *state)
|
||||
static inline bool is_following(struct seq_state *state)
|
||||
{
|
||||
return state->position && state->clock && state->position->clock.id != state->clock->id;
|
||||
}
|
||||
|
|
@ -811,9 +811,9 @@ int spa_alsa_seq_start(struct seq_state *state)
|
|||
if (state->started)
|
||||
return 0;
|
||||
|
||||
state->slaved = is_slaved(state);
|
||||
state->following = is_following(state);
|
||||
|
||||
spa_log_debug(state->log, "alsa %p: start slave:%d", state, state->slaved);
|
||||
spa_log_debug(state->log, "alsa %p: start follower:%d", state, state->following);
|
||||
|
||||
if ((res = seq_start(state, &state->event)) < 0)
|
||||
return res;
|
||||
|
|
@ -844,7 +844,7 @@ int spa_alsa_seq_start(struct seq_state *state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int do_reslave(struct spa_loop *loop,
|
||||
static int do_reassign_follower(struct spa_loop *loop,
|
||||
bool async,
|
||||
uint32_t seq,
|
||||
const void *data,
|
||||
|
|
@ -856,18 +856,18 @@ static int do_reslave(struct spa_loop *loop,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int spa_alsa_seq_reslave(struct seq_state *state)
|
||||
int spa_alsa_seq_reassign_follower(struct seq_state *state)
|
||||
{
|
||||
bool slaved;
|
||||
bool following;
|
||||
|
||||
if (!state->started)
|
||||
return 0;
|
||||
|
||||
slaved = is_slaved(state);
|
||||
if (slaved != state->slaved) {
|
||||
spa_log_debug(state->log, "alsa %p: reslave %d->%d", state, state->slaved, slaved);
|
||||
state->slaved = slaved;
|
||||
spa_loop_invoke(state->data_loop, do_reslave, 0, NULL, 0, true, state);
|
||||
following = is_following(state);
|
||||
if (following != state->following) {
|
||||
spa_log_debug(state->log, "alsa %p: reassign follower %d->%d", state, state->following, following);
|
||||
state->following = following;
|
||||
spa_loop_invoke(state->data_loop, do_reassign_follower, 0, NULL, 0, true, state);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue