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
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ struct impl {
|
|||
struct port port;
|
||||
|
||||
unsigned int started:1;
|
||||
unsigned int slaved:1;
|
||||
unsigned int following:1;
|
||||
|
||||
struct spa_source source;
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ static int impl_node_enum_params(void *object, int seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int do_reslave(struct spa_loop *loop,
|
||||
static int do_reassing_follower(struct spa_loop *loop,
|
||||
bool async,
|
||||
uint32_t seq,
|
||||
const void *data,
|
||||
|
|
@ -226,7 +226,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;
|
||||
}
|
||||
|
|
@ -234,7 +234,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);
|
||||
|
||||
|
|
@ -249,11 +249,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_reassing_follower, 0, NULL, 0, true, this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ struct impl {
|
|||
|
||||
/* Flags */
|
||||
unsigned int started:1;
|
||||
unsigned int slaved:1;
|
||||
unsigned int following:1;
|
||||
|
||||
/* Sources */
|
||||
struct spa_source source;
|
||||
|
|
@ -238,7 +238,7 @@ static void set_timeout(struct impl *this, time_t sec, long nsec)
|
|||
|
||||
static void reset_timeout(struct impl *this)
|
||||
{
|
||||
set_timeout(this, 0, this->slaved ? 0 : 1);
|
||||
set_timeout(this, 0, this->following ? 0 : 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -246,8 +246,8 @@ static void set_next_timeout(struct impl *this, uint64_t now_time)
|
|||
{
|
||||
struct port *port = &this->port;
|
||||
|
||||
/* Set the next timeout if not slaved, otherwise reset values */
|
||||
if (!this->slaved) {
|
||||
/* Set the next timeout if not following, otherwise reset values */
|
||||
if (!this->following) {
|
||||
/* Get the elapsed time */
|
||||
uint64_t elapsed_time = 0;
|
||||
if (now_time > this->start_time)
|
||||
|
|
@ -271,7 +271,7 @@ static void set_next_timeout(struct impl *this, uint64_t now_time)
|
|||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
@ -283,7 +283,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;
|
||||
}
|
||||
|
|
@ -291,7 +291,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(object != NULL, -EINVAL);
|
||||
|
||||
|
|
@ -306,11 +306,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, "sco-sink %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, "sco-sink %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;
|
||||
}
|
||||
|
|
@ -505,8 +505,8 @@ static int do_start(struct impl *this)
|
|||
/* Make sure the transport is valid */
|
||||
spa_return_val_if_fail (this->transport != NULL, -EIO);
|
||||
|
||||
/* Set the slaved flag */
|
||||
this->slaved = is_slaved(this);
|
||||
/* Set the following flag */
|
||||
this->following = is_following(this);
|
||||
|
||||
/* Do accept if Gateway; otherwise do connect for Head Unit */
|
||||
do_accept = this->transport->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ struct impl {
|
|||
struct port port;
|
||||
|
||||
unsigned int started:1;
|
||||
unsigned int slaved:1;
|
||||
unsigned int following:1;
|
||||
|
||||
struct spa_source source;
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ static int impl_node_enum_params(void *object, int seq,
|
|||
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,
|
||||
|
|
@ -219,7 +219,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;
|
||||
}
|
||||
|
|
@ -227,7 +227,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);
|
||||
|
||||
|
|
@ -242,11 +242,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, "sco-source %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, "sco-source %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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue