File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1683,13 +1683,20 @@ class VolumeMeter : public ModifyingStream {
16831683 return begin ();
16841684 }
16851685
1686- bool begin () override { return true ; }
1686+ bool begin () override {
1687+ setAudioInfo (audioInfo ());
1688+ return true ;
1689+ }
16871690
16881691 void setAudioInfo (AudioInfo info) override {
1692+ int channels = info.channels ;
1693+ LOGI (" VolumeMeter::setAudioInfo: channels %d" , channels);
16891694 ModifyingStream::setAudioInfo (info);
1690- if (info.channels > 0 ) {
1691- volumes.resize (info.channels );
1692- volumes_tmp.resize (info.channels );
1695+ if (channels > 0 ) {
1696+ volumes.resize (channels);
1697+ volumes_tmp.resize (channels);
1698+ sum.resize (channels);
1699+ sum_tmp.resize (channels);
16931700 }
16941701 }
16951702
@@ -1800,6 +1807,7 @@ class VolumeMeter : public ModifyingStream {
18001807 size_t sample_count_per_channel = 0 ;
18011808
18021809 void updateVolumes (const uint8_t *data, size_t len) {
1810+ if (data == nullptr || len == 0 ) return ;
18031811 clear ();
18041812 switch (info.bits_per_sample ) {
18051813 case 8 :
You can’t perform that action at this time.
0 commit comments