--- a/src/ohsndrcv.cxx
+++ b/src/ohsndrcv.cxx
@@ -47,10 +47,12 @@
: dev(dv), makeisendercmd(starterpath), mpdport(port) {
// Stream volume control ? This decides if the aux mpd has
// mixer "software" or "none"
- std::unique_lock<std::mutex>(g_configlock);
string value;
if (g_config->get("scstreamscaled", value)) {
scalestream = atoi(value.c_str()) != 0;
+ }
+ if (g_config->get("scscriptgracesecs", value)) {
+ graceperiodms = atoi(value.c_str()) * 1000;
}
}
~Internal() {
@@ -78,6 +80,7 @@
string makeisendercmd;
int mpdport;
bool scalestream{true};
+ int graceperiodms{0};
};
@@ -126,6 +129,9 @@
if (script.empty() && !m->isender) {
// Internal source, first time: Start fifo MPD and Sender
m->isender = sndcmd = new ExecCmd();
+ if (m->graceperiodms) {
+ sndcmd->setKillTimeout(m->graceperiodms);
+ }
vector<string> args;
args.push_back("-p");
args.push_back(SoapHelp::i2s(m->mpdport));
@@ -139,6 +145,9 @@
// it just in case
deleteZ(m->ssender);
m->ssender = sndcmd = new ExecCmd();
+ if (m->graceperiodms) {
+ sndcmd->setKillTimeout(m->graceperiodms);
+ }
vector<string> args;
args.push_back("-f");
args.push_back(m->dev->m_friendlyname);