mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
context: rename current_quantum/rate to target_*
They are really the target rate and quantum that we would like to have and are only current after target_pending is false.
This commit is contained in:
parent
25f5165e4c
commit
87d64f5cad
3 changed files with 41 additions and 41 deletions
|
|
@ -1291,7 +1291,7 @@ again:
|
||||||
if (n->reconfigure)
|
if (n->reconfigure)
|
||||||
running = true;
|
running = true;
|
||||||
|
|
||||||
current_rate = n->current_rate.denom;
|
current_rate = n->target_rate.denom;
|
||||||
if (!restore_rate &&
|
if (!restore_rate &&
|
||||||
(lock_rate || n->reconfigure || !running ||
|
(lock_rate || n->reconfigure || !running ||
|
||||||
(!force_rate && (n->info.state > PW_NODE_STATE_IDLE))))
|
(!force_rate && (n->info.state > PW_NODE_STATE_IDLE))))
|
||||||
|
|
@ -1318,23 +1318,23 @@ again:
|
||||||
pw_log_info("(%s-%u) state:%s new rate:%u/(%u)->%u",
|
pw_log_info("(%s-%u) state:%s new rate:%u/(%u)->%u",
|
||||||
n->name, n->info.id,
|
n->name, n->info.id,
|
||||||
pw_node_state_as_string(n->info.state),
|
pw_node_state_as_string(n->info.state),
|
||||||
n->current_rate.denom, current_rate,
|
n->target_rate.denom, current_rate,
|
||||||
target_rate);
|
target_rate);
|
||||||
|
|
||||||
if (force_rate) {
|
if (force_rate) {
|
||||||
if (settings->clock_rate_update_mode == CLOCK_RATE_UPDATE_MODE_HARD)
|
if (settings->clock_rate_update_mode == CLOCK_RATE_UPDATE_MODE_HARD)
|
||||||
do_reconfigure = !n->current_pending;
|
do_reconfigure = !n->target_pending;
|
||||||
} else {
|
} else {
|
||||||
if (n->info.state >= PW_NODE_STATE_SUSPENDED)
|
if (n->info.state >= PW_NODE_STATE_SUSPENDED)
|
||||||
do_reconfigure = !n->current_pending;
|
do_reconfigure = !n->target_pending;
|
||||||
}
|
}
|
||||||
if (do_reconfigure)
|
if (do_reconfigure)
|
||||||
reconfigure_driver(context, n);
|
reconfigure_driver(context, n);
|
||||||
|
|
||||||
/* we're setting the pending rate. This will become the new
|
/* we're setting the pending rate. This will become the new
|
||||||
* current rate in the next iteration of the graph. */
|
* current rate in the next iteration of the graph. */
|
||||||
n->current_rate = SPA_FRACTION(1, target_rate);
|
n->target_rate = SPA_FRACTION(1, target_rate);
|
||||||
n->current_pending = true;
|
n->target_pending = true;
|
||||||
n->forced_rate = force_rate;
|
n->forced_rate = force_rate;
|
||||||
current_rate = target_rate;
|
current_rate = target_rate;
|
||||||
/* we might be suspended now and the links need to be prepared again */
|
/* we might be suspended now and the links need to be prepared again */
|
||||||
|
|
@ -1365,27 +1365,27 @@ again:
|
||||||
if (settings->clock_power_of_two_quantum)
|
if (settings->clock_power_of_two_quantum)
|
||||||
quantum = flp2(quantum);
|
quantum = flp2(quantum);
|
||||||
|
|
||||||
if (running && quantum != n->current_quantum && !lock_quantum) {
|
if (running && quantum != n->target_quantum && !lock_quantum) {
|
||||||
pw_log_info("(%s-%u) new quantum:%"PRIu64"->%u",
|
pw_log_info("(%s-%u) new quantum:%"PRIu64"->%u",
|
||||||
n->name, n->info.id,
|
n->name, n->info.id,
|
||||||
n->current_quantum,
|
n->target_quantum,
|
||||||
quantum);
|
quantum);
|
||||||
/* this is the new pending quantum */
|
/* this is the new pending quantum */
|
||||||
n->current_quantum = quantum;
|
n->target_quantum = quantum;
|
||||||
n->current_pending = true;
|
n->target_pending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n->info.state < PW_NODE_STATE_RUNNING && n->current_pending) {
|
if (n->info.state < PW_NODE_STATE_RUNNING && n->target_pending) {
|
||||||
/* the driver node is not actually running and we have a
|
/* the driver node is not actually running and we have a
|
||||||
* pending change. Apply the change to the position now so
|
* pending change. Apply the change to the position now so
|
||||||
* that we have the right values when we change the node
|
* that we have the right values when we change the node
|
||||||
* states of the driver and followers to RUNNING below */
|
* states of the driver and followers to RUNNING below */
|
||||||
pw_log_debug("%p: apply duration:%"PRIu64" rate:%u/%u", context,
|
pw_log_debug("%p: apply duration:%"PRIu64" rate:%u/%u", context,
|
||||||
n->current_quantum, n->current_rate.num,
|
n->target_quantum, n->target_rate.num,
|
||||||
n->current_rate.denom);
|
n->target_rate.denom);
|
||||||
n->rt.position->clock.duration = n->current_quantum;
|
n->rt.position->clock.duration = n->target_quantum;
|
||||||
n->rt.position->clock.rate = n->current_rate;
|
n->rt.position->clock.rate = n->target_rate;
|
||||||
n->current_pending = false;
|
n->target_pending = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_log_debug("%p: driver %p running:%d runnable:%d quantum:%u '%s'",
|
pw_log_debug("%p: driver %p running:%d runnable:%d quantum:%u '%s'",
|
||||||
|
|
|
||||||
|
|
@ -688,8 +688,8 @@ static void update_io(struct pw_impl_node *node)
|
||||||
pw_log_debug("%p: set position %p", node, &node->rt.activation->position);
|
pw_log_debug("%p: set position %p", node, &node->rt.activation->position);
|
||||||
node->rt.position = &node->rt.activation->position;
|
node->rt.position = &node->rt.activation->position;
|
||||||
|
|
||||||
node->current_rate = node->rt.position->clock.rate;
|
node->target_rate = node->rt.position->clock.rate;
|
||||||
node->current_quantum = node->rt.position->clock.duration;
|
node->target_quantum = node->rt.position->clock.duration;
|
||||||
} else if (node->driver) {
|
} else if (node->driver) {
|
||||||
pw_log_warn("%p: can't set position on driver", node);
|
pw_log_warn("%p: can't set position on driver", node);
|
||||||
}
|
}
|
||||||
|
|
@ -804,8 +804,8 @@ do_move_nodes(struct spa_loop *loop,
|
||||||
pw_log_trace("%p: set position %p", node, &driver->rt.activation->position);
|
pw_log_trace("%p: set position %p", node, &driver->rt.activation->position);
|
||||||
node->rt.position = &driver->rt.activation->position;
|
node->rt.position = &driver->rt.activation->position;
|
||||||
|
|
||||||
node->current_rate = node->rt.position->clock.rate;
|
node->target_rate = node->rt.position->clock.rate;
|
||||||
node->current_quantum = node->rt.position->clock.duration;
|
node->target_quantum = node->rt.position->clock.duration;
|
||||||
|
|
||||||
if (node->source.loop != NULL) {
|
if (node->source.loop != NULL) {
|
||||||
remove_node(node);
|
remove_node(node);
|
||||||
|
|
@ -842,15 +842,15 @@ int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driv
|
||||||
|
|
||||||
if (old != node && old->driving && driver->info.state < PW_NODE_STATE_RUNNING) {
|
if (old != node && old->driving && driver->info.state < PW_NODE_STATE_RUNNING) {
|
||||||
pw_log_info("move quantum:%"PRIu64"->%"PRIu64" rate:%d->%d (%s-%d -> %s-%d)",
|
pw_log_info("move quantum:%"PRIu64"->%"PRIu64" rate:%d->%d (%s-%d -> %s-%d)",
|
||||||
driver->current_quantum,
|
driver->target_quantum,
|
||||||
old->current_quantum,
|
old->target_quantum,
|
||||||
driver->current_rate.denom,
|
driver->target_rate.denom,
|
||||||
old->current_rate.denom,
|
old->target_rate.denom,
|
||||||
old->name, old->info.id,
|
old->name, old->info.id,
|
||||||
driver->name, driver->info.id);
|
driver->name, driver->info.id);
|
||||||
driver->current_rate = old->current_rate;
|
driver->target_rate = old->target_rate;
|
||||||
driver->current_quantum = old->current_quantum;
|
driver->target_quantum = old->target_quantum;
|
||||||
driver->current_pending = true;
|
driver->target_pending = true;
|
||||||
}
|
}
|
||||||
was_driving = node->driving;
|
was_driving = node->driving;
|
||||||
node->driving = node->driver && driver == node;
|
node->driving = node->driver && driver == node;
|
||||||
|
|
@ -1220,11 +1220,11 @@ static void reset_position(struct pw_impl_node *this, struct spa_io_position *po
|
||||||
uint32_t quantum = s->clock_force_quantum == 0 ? s->clock_quantum : s->clock_force_quantum;
|
uint32_t quantum = s->clock_force_quantum == 0 ? s->clock_quantum : s->clock_force_quantum;
|
||||||
uint32_t rate = s->clock_force_rate == 0 ? s->clock_rate : s->clock_force_rate;
|
uint32_t rate = s->clock_force_rate == 0 ? s->clock_rate : s->clock_force_rate;
|
||||||
|
|
||||||
this->current_rate = SPA_FRACTION(1, rate);
|
this->target_rate = SPA_FRACTION(1, rate);
|
||||||
this->current_quantum = quantum;
|
this->target_quantum = quantum;
|
||||||
|
|
||||||
pos->clock.rate = this->current_rate;
|
pos->clock.rate = this->target_rate;
|
||||||
pos->clock.duration = this->current_quantum;
|
pos->clock.duration = this->target_quantum;
|
||||||
pos->video.flags = SPA_IO_VIDEO_SIZE_VALID;
|
pos->video.flags = SPA_IO_VIDEO_SIZE_VALID;
|
||||||
pos->video.size = s->video_size;
|
pos->video.size = s->video_size;
|
||||||
pos->video.stride = pos->video.size.width * 16;
|
pos->video.stride = pos->video.size.width * 16;
|
||||||
|
|
@ -1683,15 +1683,15 @@ static int node_ready(void *data, int status)
|
||||||
node->rt.target.signal_func(node->rt.target.data);
|
node->rt.target.signal_func(node->rt.target.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->current_pending) {
|
if (node->target_pending) {
|
||||||
pw_log_debug("apply quantum %"PRIu64"->%"PRIu64" %d->%d",
|
pw_log_debug("apply quantum %"PRIu64"->%"PRIu64" %d->%d",
|
||||||
node->rt.position->clock.duration,
|
node->rt.position->clock.duration,
|
||||||
node->current_quantum,
|
node->target_quantum,
|
||||||
node->rt.position->clock.rate.denom,
|
node->rt.position->clock.rate.denom,
|
||||||
node->current_rate.denom);
|
node->target_rate.denom);
|
||||||
node->rt.position->clock.duration = node->current_quantum;
|
node->rt.position->clock.duration = node->target_quantum;
|
||||||
node->rt.position->clock.rate = node->current_rate;
|
node->rt.position->clock.rate = node->target_rate;
|
||||||
node->current_pending = false;
|
node->target_pending = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_type = check_updates(node, &reposition_owner);
|
sync_type = check_updates(node, &reposition_owner);
|
||||||
|
|
|
||||||
|
|
@ -696,7 +696,7 @@ struct pw_impl_node {
|
||||||
unsigned int lock_quantum:1; /**< don't change graph quantum */
|
unsigned int lock_quantum:1; /**< don't change graph quantum */
|
||||||
unsigned int lock_rate:1; /**< don't change graph rate */
|
unsigned int lock_rate:1; /**< don't change graph rate */
|
||||||
unsigned int transport_sync:1; /**< supports transport sync */
|
unsigned int transport_sync:1; /**< supports transport sync */
|
||||||
unsigned int current_pending:1; /**< a quantum/rate update is pending */
|
unsigned int target_pending:1; /**< a quantum/rate update is pending */
|
||||||
unsigned int moved:1; /**< the node was moved drivers */
|
unsigned int moved:1; /**< the node was moved drivers */
|
||||||
unsigned int added:1; /**< the node was add to graph */
|
unsigned int added:1; /**< the node was add to graph */
|
||||||
unsigned int pause_on_idle:1; /**< Pause processing when IDLE */
|
unsigned int pause_on_idle:1; /**< Pause processing when IDLE */
|
||||||
|
|
@ -750,10 +750,10 @@ struct pw_impl_node {
|
||||||
|
|
||||||
struct ratelimit rate_limit;
|
struct ratelimit rate_limit;
|
||||||
} rt;
|
} rt;
|
||||||
struct spa_fraction current_rate;
|
struct spa_fraction target_rate;
|
||||||
uint64_t current_quantum;
|
uint64_t target_quantum;
|
||||||
|
|
||||||
void *user_data; /**< extra user data */
|
void *user_data; /**< extra user data */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_impl_port_mix {
|
struct pw_impl_port_mix {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue