Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ static void module_adapter_process_output(struct comp_dev *dev)
sink = container_of(blist, struct comp_buffer, source_list);
ca_copy_from_module_to_sink(&sink->stream, mod->output_buffers[i].data,
mod->output_buffers[i].size);
buffer_stream_writeback(sink, mod->output_buffers[i].size);
audio_stream_produce(&sink->stream, mod->output_buffers[i].size);
mod->output_buffers[i].size = 0;
i++;
Expand Down Expand Up @@ -522,6 +523,7 @@ int module_adapter_copy(struct comp_dev *dev)
struct comp_buffer *source;
struct comp_buffer *sink;
struct processing_module *mod = comp_get_drvdata(dev);
struct module_data *md = &mod->priv;
struct list_item *blist;
size_t size = MAX(mod->deep_buff_bytes, mod->period_bytes);
uint32_t min_free_frames = UINT_MAX;
Expand All @@ -546,13 +548,13 @@ int module_adapter_copy(struct comp_dev *dev)
source_frame_bytes = audio_stream_frame_bytes(&source->stream);
source = buffer_release(source);

bytes_to_process = frames * source_frame_bytes;
bytes_to_process = MIN(frames * source_frame_bytes, md->mpd.in_buff_size);

buffer_stream_invalidate(source, bytes_to_process);
mod->input_buffers[i].size = bytes_to_process;
mod->input_buffers[i].consumed = 0;
ca_copy_from_source_to_module(&source->stream, mod->input_buffers[i].data,
bytes_to_process, bytes_to_process);
md->mpd.in_buff_size, bytes_to_process);
i++;
}

Expand Down
14 changes: 7 additions & 7 deletions src/include/sof/audio/module_adapter/module/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
} while (0)

#define DECLARE_MODULE_ADAPTER(adapter, uuid, tr) \
static struct comp_dev *adapter_shim_new(const struct comp_driver *drv, \
static struct comp_dev *module_##adapter##_shim_new(const struct comp_driver *drv, \
struct comp_ipc_config *config, \
void *spec) \
{ \
return module_adapter_new(drv, config, &(adapter), spec);\
} \
\
static const struct comp_driver comp_module_adapter = { \
static const struct comp_driver comp_##adapter##_module = { \
.type = SOF_COMP_MODULE_ADAPTER, \
.uid = SOF_RT_UUID(uuid), \
.tctx = &(tr), \
.ops = { \
.create = adapter_shim_new, \
.create = module_##adapter##_shim_new, \
.prepare = module_adapter_prepare, \
.params = module_adapter_params, \
.copy = module_adapter_copy, \
Expand All @@ -54,14 +54,14 @@ static const struct comp_driver comp_module_adapter = { \
}, \
}; \
\
static SHARED_DATA struct comp_driver_info comp_module_adapter_info = { \
.drv = &comp_module_adapter, \
static SHARED_DATA struct comp_driver_info comp_module_##adapter##_info = { \
.drv = &comp_##adapter##_module, \
}; \
\
UT_STATIC void sys_comp_module_##adapter##_init(void) \
{ \
comp_register(platform_shared_get(&comp_module_adapter_info, \
sizeof(comp_module_adapter_info))); \
comp_register(platform_shared_get(&comp_module_##adapter##_info, \
sizeof(comp_module_##adapter##_info))); \
} \
\
DECLARE_MODULE(sys_comp_module_##adapter##_init)
Expand Down