mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
audioconvert: handle recursive Props set_param
When the node receives a set_param Props, it calls the follower set_param implementation. If that one calls set_param again on the adapter, discards the original set_param. This makes it possible for the follower to intercept the Props param and set a modified version on the converter. This can be used to intercept volume changes.
This commit is contained in:
parent
dad87fb3a8
commit
bf1b3bb157
1 changed files with 7 additions and 3 deletions
|
|
@ -51,6 +51,7 @@ struct impl {
|
||||||
uint64_t follower_flags;
|
uint64_t follower_flags;
|
||||||
struct spa_audio_info follower_current_format;
|
struct spa_audio_info follower_current_format;
|
||||||
struct spa_audio_info default_format;
|
struct spa_audio_info default_format;
|
||||||
|
int in_set_param;
|
||||||
|
|
||||||
struct spa_handle *hnd_convert;
|
struct spa_handle *hnd_convert;
|
||||||
struct spa_node *convert;
|
struct spa_node *convert;
|
||||||
|
|
@ -675,13 +676,16 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
case SPA_PARAM_Props:
|
case SPA_PARAM_Props:
|
||||||
if (this->target != this->follower)
|
{
|
||||||
res = spa_node_set_param(this->target, id, flags, param);
|
int in_set_param = ++this->in_set_param;
|
||||||
res2 = spa_node_set_param(this->follower, id, flags, param);
|
res = spa_node_set_param(this->follower, id, flags, param);
|
||||||
|
if (this->target != this->follower && this->in_set_param == in_set_param)
|
||||||
|
res2 = spa_node_set_param(this->target, id, flags, param);
|
||||||
if (res < 0 && res2 < 0)
|
if (res < 0 && res2 < 0)
|
||||||
return res;
|
return res;
|
||||||
res = 0;
|
res = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SPA_PARAM_ProcessLatency:
|
case SPA_PARAM_ProcessLatency:
|
||||||
res = spa_node_set_param(this->follower, id, flags, param);
|
res = spa_node_set_param(this->follower, id, flags, param);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue