slave -> follower

We use master/follower terminology everywhere.
This commit is contained in:
Wim Taymans 2020-02-21 10:47:32 +01:00
parent bdeeebfdd4
commit a528189d26
22 changed files with 301 additions and 300 deletions

View file

@ -112,7 +112,7 @@ struct impl {
struct port port;
unsigned int started:1;
unsigned int slaved:1;
unsigned int following:1;
struct spa_source source;
int timerfd;
@ -246,7 +246,7 @@ static int set_timers(struct impl *this)
int res;
ts.it_value.tv_sec = 0;
if (this->slaved) {
if (this->following) {
ts.it_value.tv_nsec = 0;
} else {
ts.it_value.tv_nsec = 1;
@ -260,7 +260,7 @@ static int set_timers(struct impl *this)
return res;
}
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,
@ -272,7 +272,7 @@ static int do_reslave(struct spa_loop *loop,
return 0;
}
static inline bool is_slaved(struct impl *this)
static inline bool is_following(struct impl *this)
{
return this->position && this->clock && this->position->clock.id != this->clock->id;
}
@ -280,7 +280,7 @@ static inline bool is_slaved(struct impl *this)
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
{
struct impl *this = object;
bool slaved;
bool following;
spa_return_val_if_fail(this != NULL, -EINVAL);
@ -295,11 +295,11 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
return -ENOENT;
}
slaved = is_slaved(this);
if (this->started && slaved != this->slaved) {
spa_log_debug(this->log, NAME " %p: reslave %d->%d", this, this->slaved, slaved);
this->slaved = slaved;
spa_loop_invoke(this->data_loop, do_reslave, 0, NULL, 0, true, this);
following = is_following(this);
if (this->started && following != this->following) {
spa_log_debug(this->log, NAME " %p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_reassign_follower, 0, NULL, 0, true, this);
}
return 0;
}
@ -626,7 +626,7 @@ static int flush_data(struct impl *this, uint64_t now_time)
spa_log_trace(this->log, NAME" %p: %"PRIu64" %"PRIi64" %"PRIu64" %"PRIu64" %d", this,
now_time, queued, this->sample_time, elapsed, this->write_samples);
if (!this->slaved) {
if (!this->following) {
if (queued < FILL_FRAMES * this->write_samples) {
queued = (FILL_FRAMES + 1) * this->write_samples;
if (this->sample_time < elapsed) {
@ -797,9 +797,9 @@ static int do_start(struct impl *this)
if (this->started)
return 0;
this->slaved = is_slaved(this);
this->following = is_following(this);
spa_log_debug(this->log, NAME " %p: start slaved:%d", this, this->slaved);
spa_log_debug(this->log, NAME " %p: start following:%d", this, this->following);
if ((res = spa_bt_transport_acquire(this->transport, false)) < 0)
return res;