impl-link: reset state to INIT if not destroyed

If the link isn't destroyed, don't allow changing state to
PAUSED for states < PAUSED. For example, if the deactivation
is called during the link being in NEGOTIATING it could then
jump directly to PAUSED and believe it is prepared.

Fixes #3619
This commit is contained in:
jdavidsson 2023-11-03 10:01:48 +01:00
parent 38157a8937
commit baac9aa549

View file

@ -884,9 +884,11 @@ int pw_impl_link_deactivate(struct pw_impl_link *this)
impl->activated = false;
pw_log_info("(%s) deactivated", this->name);
link_update_state(this, this->destroyed ?
PW_LINK_STATE_INIT : PW_LINK_STATE_PAUSED,
0, NULL);
if (this->info.state < PW_LINK_STATE_PAUSED || this->destroyed)
link_update_state(this, PW_LINK_STATE_INIT, 0, NULL);
else
link_update_state(this, PW_LINK_STATE_PAUSED, 0, NULL);
return 0;
}