From 2d834e938c99978d4d02364588169e9289f7302d Mon Sep 17 00:00:00 2001 From: Rander Wang Date: Mon, 21 Aug 2023 10:07:23 +0800 Subject: [PATCH] copier: adjust valid format based on sample type Adjust valid format in copier for some types of dai gateway which need to use MSB type. Currently sample type only affect the copier module so we don't do it in audio_stream_fmt_conversion. Signed-off-by: Rander Wang (cherry picked from commit 65b2e0b390bcf3c69ead38cdf5e0c676733f6147) --- src/audio/copier/copier_generic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/audio/copier/copier_generic.c b/src/audio/copier/copier_generic.c index e9ca748a8b2e..c610d05a049d 100644 --- a/src/audio/copier/copier_generic.c +++ b/src/audio/copier/copier_generic.c @@ -284,6 +284,11 @@ pcm_converter_func get_converter_func(const struct ipc4_audio_format *in_fmt, audio_stream_fmt_conversion(out_fmt->depth, out_fmt->valid_bit_depth, &out, &out_valid, out_fmt->s_type); + if (in_fmt->s_type == IPC4_TYPE_MSB_INTEGER && in_valid == SOF_IPC_FRAME_S24_4LE) + in_valid = SOF_IPC_FRAME_S24_4LE_MSB; + if (out_fmt->s_type == IPC4_TYPE_MSB_INTEGER && out_valid == SOF_IPC_FRAME_S24_4LE) + out_valid = SOF_IPC_FRAME_S24_4LE_MSB; + /* check container & sample size */ if (use_no_container_convert_function(in, in_valid, out, out_valid)) return pcm_get_conversion_function(in, out);