New setting "streaming_client.initial_volume"

This commit is contained in:
Nicolas Iselin 2022-06-26 08:53:40 +01:00 committed by badaix
parent fd4d82126f
commit 30fd1520cc
5 changed files with 27 additions and 0 deletions

View file

@ -268,3 +268,7 @@ meta:///<name of source#1>/<name of source#2>/.../<name of source#N>?name=<name>
Plays audio from the active source with the highest priority, with `source#1` having the highest priority and `source#N` the lowest.
Use `codec=null` for stream sources that should only serve as input for meta streams
## Streaming clients
Streaming clients connect to the server and receive configuration and audio data. The client is fully controlled from the server so clients don't have to persist any state. The `[streaming_client]` section has just one option currently:
- `initial_volume`: 0-100 [percent]: The volume a streaming client gets assigned on very first connect (i.e. the client is not known to the server yet). Defaults to 100 if unset.

View file

@ -156,6 +156,15 @@ source = pipe:///tmp/snapfifo?name=default
# Send audio to muted clients
#send_to_muted = false
#
# Streaming client options ####################################################
#
[streaming_client]
# Volume assigned to new snapclients [percent]
# Defaults to 100 if unset
#initial_volume = 100
#
###############################################################################

View file

@ -767,6 +767,10 @@ void Server::onMessageReceived(StreamSession* streamSession, const msg::BaseMess
}
ClientInfoPtr client = group->getClient(streamSession->clientId);
if (newGroup)
{
client->config.volume.percent = settings_.streamingclient.initialVolume;
}
LOG(DEBUG, LOG_TAG) << "Sending ServerSettings to " << streamSession->clientId << "\n";
auto serverSettings = make_shared<msg::ServerSettings>();

View file

@ -65,6 +65,11 @@ struct ServerSettings
std::vector<std::string> bind_to_address{{"0.0.0.0"}};
};
struct StreamingClient
{
uint16_t initialVolume{100};
};
struct Logging
{
std::string sink{""};
@ -75,6 +80,7 @@ struct ServerSettings
Http http;
Tcp tcp;
Stream stream;
StreamingClient streamingclient;
Logging logging;
};

View file

@ -118,6 +118,10 @@ int main(int argc, char* argv[])
conf.add<Value<bool>>("", "stream.send_to_muted", "Send audio to muted clients", settings.stream.sendAudioToMutedClients,
&settings.stream.sendAudioToMutedClients);
// streaming_client options
conf.add<Value<uint16_t>>("", "streaming_client.initial_volume", "Volume [percent] assigned to new streaming clients", settings.streamingclient.initialVolume,
&settings.streamingclient.initialVolume);
// logging settings
conf.add<Value<string>>("", "logging.sink", "log sink [null,system,stdout,stderr,file:<filename>]", settings.logging.sink, &settings.logging.sink);
auto logfilterOption = conf.add<Value<string>>(