aboutsummaryrefslogtreecommitdiffstats
path: root/src/StatsServer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-05-11 18:15:01 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-05-11 18:15:01 +0200
commite74146132c62818907dfd4801f5ab68db9eb3f09 (patch)
treea727668021e90b0733ca051d085093851aade846 /src/StatsServer.cpp
parent0e5797c291d29587d5ea5beebe6430cb041903bd (diff)
downloaddabmux-e74146132c62818907dfd4801f5ab68db9eb3f09.tar.gz
dabmux-e74146132c62818907dfd4801f5ab68db9eb3f09.tar.bz2
dabmux-e74146132c62818907dfd4801f5ab68db9eb3f09.zip
Add silence detection
Diffstat (limited to 'src/StatsServer.cpp')
-rw-r--r--src/StatsServer.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/StatsServer.cpp b/src/StatsServer.cpp
index eb30ebd..38c4607 100644
--- a/src/StatsServer.cpp
+++ b/src/StatsServer.cpp
@@ -360,6 +360,9 @@ std::string InputStat::encodeStateJSON()
case Unstable:
ss << "\"Unstable\"";
break;
+ case Silence:
+ ss << "\"Silent\"";
+ break;
case Streaming:
ss << "\"Streaming\"";
break;
@@ -400,7 +403,14 @@ input_state_t InputStat::determineState(void)
state = Unstable;
}
else {
- state = Streaming;
+ /* The input is streaming, check if the audio level is too low */
+
+ if (m_silence_counter > INPUT_AUDIO_LEVEL_SILENCE_COUNT) {
+ state = Silence;
+ }
+ else {
+ state = Streaming;
+ }
}
return state;