From 2849ba649ecbe58d690ee44655735764ea12e94c Mon Sep 17 00:00:00 2001 From: Jaroslaw Stelter Date: Thu, 21 Dec 2023 11:42:13 +0100 Subject: [PATCH] iadk: module_adapter: Fix return code for IADK proc IADK processing module interface uses uint32_t return code while cSOF is using int type. This patch checks return value from processing() method and returns -ENODATA in case of failure. Signed-off-by: Jaroslaw Stelter --- .../iadk/iadk_module_adapter.cpp | 19 +++++++++++++------ .../module_adapter/iadk/iadk_module_adapter.h | 8 ++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/audio/module_adapter/iadk/iadk_module_adapter.cpp b/src/audio/module_adapter/iadk/iadk_module_adapter.cpp index 92ad7bdc8661..c680622963ea 100644 --- a/src/audio/module_adapter/iadk/iadk_module_adapter.cpp +++ b/src/audio/module_adapter/iadk/iadk_module_adapter.cpp @@ -39,12 +39,12 @@ int IadkModuleAdapter::IadkModuleAdapter_Prepare(void) return 0; } -uint32_t IadkModuleAdapter::IadkModuleAdapter_Process(struct sof_source **sources, - int num_of_sources, - struct sof_sink **sinks, - int num_of_sinks) +int IadkModuleAdapter::IadkModuleAdapter_Process(struct sof_source **sources, + int num_of_sources, + struct sof_sink **sinks, + int num_of_sinks) { - uint32_t ret = 0; + int ret = 0; if ((num_of_sources > 0) && (num_of_sinks > 0)) { intel_adsp::InputStreamBuffer input_stream_buffers[INPUT_PIN_COUNT]; @@ -80,7 +80,14 @@ uint32_t IadkModuleAdapter::IadkModuleAdapter_Process(struct sof_source **source new (&output_stream_buffers[i]) intel_adsp::OutputStreamBuffer(osb_data); } - ret = processing_module_.Process(input_stream_buffers, output_stream_buffers); + uint32_t iadk_ret = + processing_module_.Process(input_stream_buffers, output_stream_buffers); + + /* IADK modules returns uint32_t return code. Convert to failure if Process + * not successful. + */ + if (iadk_ret != 0) + ret = -ENODATA; for (int i = 0; i < num_of_sources; i++) { source_release_data(sources[i], input_stream_buffers[i].size); diff --git a/src/include/sof/audio/module_adapter/iadk/iadk_module_adapter.h b/src/include/sof/audio/module_adapter/iadk/iadk_module_adapter.h index ed6e80ba03d7..b14cf169c909 100644 --- a/src/include/sof/audio/module_adapter/iadk/iadk_module_adapter.h +++ b/src/include/sof/audio/module_adapter/iadk/iadk_module_adapter.h @@ -64,10 +64,10 @@ namespace dsp_fw * samples provided by the codec_adapter and produce/output the processed * ones back to codec_adapter. */ - uint32_t IadkModuleAdapter_Process(struct sof_source **sources, - int num_of_sources, - struct sof_sink **sinks, - int num_of_sinks); + int IadkModuleAdapter_Process(struct sof_source **sources, + int num_of_sources, + struct sof_sink **sinks, + int num_of_sinks); /** * Module specific apply config procedure, called by codec_adapter every time