mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
sink, source: Return early from set_mute()
This avoids redundant set_mute() callback calls. Some logging was added too.
This commit is contained in:
parent
7ac850d3b7
commit
70441d40fb
2 changed files with 18 additions and 8 deletions
|
|
@ -1792,16 +1792,21 @@ void pa_source_set_mute(pa_source *s, bool mute, bool save) {
|
|||
pa_assert(PA_SOURCE_IS_LINKED(s->state));
|
||||
|
||||
old_muted = s->muted;
|
||||
|
||||
if (mute == old_muted) {
|
||||
s->save_muted |= save;
|
||||
return;
|
||||
}
|
||||
|
||||
s->muted = mute;
|
||||
s->save_muted = (old_muted == s->muted && s->save_muted) || save;
|
||||
s->save_muted = save;
|
||||
|
||||
if (!(s->flags & PA_SOURCE_DEFERRED_VOLUME) && s->set_mute)
|
||||
s->set_mute(s);
|
||||
|
||||
pa_log_debug("The mute of source %s changed from %s to %s.", s->name, pa_yes_no(old_muted), pa_yes_no(mute));
|
||||
pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_MUTE, NULL, 0, NULL) == 0);
|
||||
|
||||
if (old_muted != s->muted)
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
}
|
||||
|
||||
/* Called from main thread */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue