summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-05-04 14:19:09 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-05-04 14:20:28 +0200
commit20607d9aff6b1cee10fec1c7efc815ae2d77518c (patch)
treecce46efb84e057ac5a70a6ab41b07669d9b5b38e
parent903d2210d560e4c1877c40ee9209b74fbb502526 (diff)
downloadODR-AudioEnc-20607d9aff6b1cee10fec1c7efc815ae2d77518c.tar.gz
ODR-AudioEnc-20607d9aff6b1cee10fec1c7efc815ae2d77518c.tar.bz2
ODR-AudioEnc-20607d9aff6b1cee10fec1c7efc815ae2d77518c.zip
Move peak audio reset right before calculation
-rw-r--r--src/odr-audioenc.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/odr-audioenc.cpp b/src/odr-audioenc.cpp
index acc9295..9a0b0c4 100644
--- a/src/odr-audioenc.cpp
+++ b/src/odr-audioenc.cpp
@@ -462,10 +462,6 @@ public:
string dab_channel_mode;
- /* Keep track of peaks */
- int16_t peak_left = 0;
- int16_t peak_right = 0;
-
/* On silence, die after the silence_timeout expires */
bool die_on_silence = false;
int silence_timeout = 0;
@@ -1022,6 +1018,8 @@ int AudioEnc::run()
*
* \todo fix level measurement in mono
*/
+ int16_t peak_left = 0;
+ int16_t peak_right = 0;
for (int i = 0; i < read_bytes; i+=4) {
int16_t l = input_buf[i] | (input_buf[i+1] << 8);
int16_t r = input_buf[i+2] | (input_buf[i+3] << 8);
@@ -1250,9 +1248,6 @@ int AudioEnc::run()
stats_publisher->send_stats();
}
- peak_right = 0;
- peak_left = 0;
-
status = 0;
}