File tree 1 file changed +12
-4
lines changed
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 {
1683
1683
return begin ();
1684
1684
}
1685
1685
1686
- bool begin () override { return true ; }
1686
+ bool begin () override {
1687
+ setAudioInfo (audioInfo ());
1688
+ return true ;
1689
+ }
1687
1690
1688
1691
void setAudioInfo (AudioInfo info) override {
1692
+ int channels = info.channels ;
1693
+ LOGI (" VolumeMeter::setAudioInfo: channels %d" , channels);
1689
1694
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);
1693
1700
}
1694
1701
}
1695
1702
@@ -1800,6 +1807,7 @@ class VolumeMeter : public ModifyingStream {
1800
1807
size_t sample_count_per_channel = 0 ;
1801
1808
1802
1809
void updateVolumes (const uint8_t *data, size_t len) {
1810
+ if (data == nullptr || len == 0 ) return ;
1803
1811
clear ();
1804
1812
switch (info.bits_per_sample ) {
1805
1813
case 8 :
You can’t perform that action at this time.
0 commit comments