Skip to content

Commit 1b08d6c

Browse files
singalsukv2019i
authored andcommitted
Audio: Volume: Clear peak meter channel max values in init and reset
This patch avoids garbage values to be sent to mailbox by peak_vol_update() as very first peak volume measurement in stream start. The data structures cd->peak_vol and cd->peak_regs.peak_meter were not cleared. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 1872a10 commit 1b08d6c

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/audio/volume/volume.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,10 @@ void volume_reset_state(struct vol_data *cd)
377377
cd->sample_rate_inv = 0;
378378
cd->copy_gain = true;
379379
cd->is_passthrough = false;
380+
381+
#if CONFIG_COMP_PEAK_VOL
382+
memset(cd->peak_regs.peak_meter, 0, sizeof(cd->peak_regs.peak_meter));
383+
#endif
380384
}
381385

382386
void volume_prepare_ramp(struct comp_dev *dev, struct vol_data *cd)

src/audio/volume/volume_ipc4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ int volume_init(struct processing_module *mod)
139139
/* malloc memory to store temp peak volume 4 times to ensure the address
140140
* is 8-byte aligned for multi-way xtensa intrinsic operations.
141141
*/
142-
cd->peak_vol = rmalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, vol_size);
142+
cd->peak_vol = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, vol_size);
143143
if (!cd->peak_vol) {
144144
rfree(cd->vol);
145145
rfree(cd);

0 commit comments

Comments
 (0)