sink, source: Call set_mute() from mute_changed()

This refactoring reduces duplication, as mute_changed() used to do the
same things as set_mute(). Other benefits are improved logging
(set_mute() logs the mute change, mute_changed() used to not do that)
and the soft mute state is kept up to date, because set_mute() sends
the SET_MUTE message to the IO thread.

The set_mute_in_progress flag is an extra precaution for preventing
recursion in case a sink/source implementation's set_mute() callback
causes mute_changed() to be called. Currently there are no such
implementations, but I think that would be a valid thing to do, so
some day there might be such implementation.
This commit is contained in:
Tanu Kaskinen 2014-04-15 13:56:09 +03:00
parent c93cfc1ca6
commit dbd2a8f851
4 changed files with 28 additions and 14 deletions

View file

@ -118,6 +118,8 @@ struct pa_source {
unsigned priority;
bool set_mute_in_progress;
/* Called when the main loop requests a state change. Called from
* main loop context. If returns -1 the state change will be
* inhibited */