diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 554b6242..ab9536cc 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -7188,7 +7188,7 @@ static size_t in_get_buffer_size(const struct audio_stream *stream) if(in->usecase == USECASE_COMPRESS_VOIP_CALL) return voice_extn_compress_voip_in_get_buffer_size(in); else if(audio_extn_compr_cap_usecase_supported(in->usecase)) - return audio_extn_compr_cap_get_buffer_size(in->config.format); + return audio_extn_compr_cap_get_buffer_size(pcm_format_to_audio_format(in->config.format)); else if(audio_extn_cin_attached_usecase(in)) return audio_extn_cin_get_buffer_size(in); diff --git a/hal/audio_hw.h b/hal/audio_hw.h index d24202c6..058d7a27 100644 --- a/hal/audio_hw.h +++ b/hal/audio_hw.h @@ -947,4 +947,29 @@ audio_patch_handle_t generate_patch_handle(); * and latch at last. */ +static inline audio_format_t pcm_format_to_audio_format(const enum pcm_format format) +{ + audio_format_t ret = AUDIO_FORMAT_INVALID; + switch(format) { + case PCM_FORMAT_S16_LE: + ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_16_BIT; + break; + case PCM_FORMAT_S32_LE: + ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_32_BIT; + break; + case PCM_FORMAT_S8: + ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_8_BIT; + break; + case PCM_FORMAT_S24_LE: + ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_8_24_BIT; + break; + case PCM_FORMAT_S24_3LE: + ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED; + break; + default: + break; + } + return ret; +} + #endif // QCOM_AUDIO_HW_H