diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-05-11 18:15:01 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-05-11 18:15:01 +0200 |
commit | e74146132c62818907dfd4801f5ab68db9eb3f09 (patch) | |
tree | a727668021e90b0733ca051d085093851aade846 /src/StatsServer.cpp | |
parent | 0e5797c291d29587d5ea5beebe6430cb041903bd (diff) | |
download | dabmux-e74146132c62818907dfd4801f5ab68db9eb3f09.tar.gz dabmux-e74146132c62818907dfd4801f5ab68db9eb3f09.tar.bz2 dabmux-e74146132c62818907dfd4801f5ab68db9eb3f09.zip |
Add silence detection
Diffstat (limited to 'src/StatsServer.cpp')
-rw-r--r-- | src/StatsServer.cpp | 12 |
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; |