From 8f9ac31aa31f538bd31ecf6677f5bba8263a6a5a Mon Sep 17 00:00:00 2001 From: Mac Chiang Date: Wed, 26 Feb 2025 20:48:37 +0800 Subject: [PATCH] codec_adapter: correct the way to get the scheduling period Scheduling period should be acquired from dev->pipeline->period Signed-off-by: CY Kuei Signed-off-by: Mac Chiang (backport from commit 285df36f1b435278cd230500385d4bd9f515c56f) --- src/audio/codec_adapter/codec/waves.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/audio/codec_adapter/codec/waves.c b/src/audio/codec_adapter/codec/waves.c index d61f7c7c73d4..b59aee38f6d7 100644 --- a/src/audio/codec_adapter/codec/waves.c +++ b/src/audio/codec_adapter/codec/waves.c @@ -330,7 +330,10 @@ static int waves_effect_init(struct comp_dev *dev) waves_codec->o_format = waves_codec->i_format; waves_codec->sample_size_in_bytes = sample_bytes; - waves_codec->buffer_samples = (src_fmt->rate * 2) / 1000; /* 2 ms io buffers */ + /* Prepare a buffer for 1 period worth of data + * dev->pipeline->period stands for the scheduling period in us + */ + waves_codec->buffer_samples = src_fmt->rate * dev->pipeline->period / 1000000; waves_codec->buffer_bytes = waves_codec->buffer_samples * src_fmt->channels * waves_codec->sample_size_in_bytes;