mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-28 08:26:16 +02:00
don't send audio to muted clients
This commit is contained in:
parent
69747ec316
commit
39c133e41a
4 changed files with 19 additions and 1 deletions
|
@ -68,6 +68,7 @@ int main(int argc, char* argv[])
|
|||
Value<size_t> streamBufferValue("", "streamBuffer", "Default stream read buffer [ms]", settings.streamReadMs, &settings.streamReadMs);
|
||||
|
||||
Value<int> bufferValue("b", "buffer", "Buffer [ms]", settings.bufferMs, &settings.bufferMs);
|
||||
Switch muteSwitch("", "sendToMuted", "Send audio to muted clients", &settings.sendAudioToMutedClients);
|
||||
Implicit<int> daemonOption("d", "daemon", "Daemonize\noptional process priority [-20..19]", 0, &processPriority);
|
||||
Value<string> userValue("", "user", "the user[:group] to run snapserver as when daemonized", "");
|
||||
|
||||
|
@ -81,6 +82,7 @@ int main(int argc, char* argv[])
|
|||
.add(codecValue)
|
||||
.add(streamBufferValue)
|
||||
.add(bufferValue)
|
||||
.add(muteSwitch)
|
||||
#ifdef HAS_DAEMON
|
||||
.add(daemonOption)
|
||||
.add(userValue)
|
||||
|
|
|
@ -44,6 +44,9 @@ Default stream read buffer [ms] (default = 20)
|
|||
\fB-b, --buffer\fR
|
||||
buffer [ms] (default = 1000)
|
||||
.TP
|
||||
\fB-b, --sendToMuted\fR
|
||||
Send audio to muted clients
|
||||
.TP
|
||||
\fB-d, --daemon\fR
|
||||
daemonize, optional process priority [-20..19]
|
||||
.TP
|
||||
|
|
|
@ -58,6 +58,17 @@ void StreamServer::onChunkRead(const PcmStream* pcmStream, const msg::PcmChunk*
|
|||
std::lock_guard<std::recursive_mutex> mlock(sessionsMutex_);
|
||||
for (auto s : sessions_)
|
||||
{
|
||||
if (!settings_.sendAudioToMutedClients)
|
||||
{
|
||||
GroupPtr group = Config::instance().getGroupFromClient(s->clientId);
|
||||
if (group)
|
||||
{
|
||||
ClientInfoPtr client = group->getClient(s->clientId);
|
||||
if ((client && client->config.volume.muted) || group->muted)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!s->pcmStream() && isDefaultStream)//->getName() == "default")
|
||||
s->sendAsync(shared_message);
|
||||
else if (s->pcmStream().get() == pcmStream)
|
||||
|
|
|
@ -50,7 +50,8 @@ struct StreamServerSettings
|
|||
codec("flac"),
|
||||
bufferMs(1000),
|
||||
sampleFormat("48000:16:2"),
|
||||
streamReadMs(20)
|
||||
streamReadMs(20),
|
||||
sendAudioToMutedClients(false)
|
||||
{
|
||||
}
|
||||
size_t port;
|
||||
|
@ -60,6 +61,7 @@ struct StreamServerSettings
|
|||
int32_t bufferMs;
|
||||
std::string sampleFormat;
|
||||
size_t streamReadMs;
|
||||
bool sendAudioToMutedClients;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue