Skip to content

Commit b30d200

Browse files
mod: too quick draining buffer fix
DP may produce a huge chunk of output data (i.e. 10 LL cycles), and the following module should be able to consume it in 1 cycle chunks, one by one unfortunately some modules are not prepared to work when there's more than 1 data portion available in the buffer and are draining buffers with data loss a workaround: copy only the following module's IBS in each LL cycle required fix: all modules using sink/src interface must be aware to process only data they need, not forcefully draining a buffer Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
1 parent 3bd9991 commit b30d200

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/audio/module_adapter/module_adapter.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,13 +1072,27 @@ static int module_adapter_copy_dp_queues(struct comp_dev *dev)
10721072
list_for_item(blist, &dev->bsink_list) {
10731073
/* output - we need to copy data from dp_queue (as source)
10741074
* to audio_stream (as sink)
1075+
*
1076+
* a trick is needed there as a workaround
1077+
* DP may produce a huge chunk of output data (i.e. 10 LL
1078+
* cycles), and the following module should be able to consume it in 1 cycle chunks
1079+
*
1080+
* unfortunately some modules are not prepared to work when there's more than
1081+
* 1 data portion available in the buffer and are draining buffers with data loss
1082+
*
1083+
* a workaround: copy only the following module's IBS in each LL cycle
1084+
*
1085+
* required fix: all modules using sink/src interface must be aware to
1086+
* process only data they need, not forcefully draining a buffer
10751087
*/
10761088
assert(dp_queue);
10771089
struct comp_buffer *buffer =
10781090
container_of(blist, struct comp_buffer, source_list);
10791091
struct sof_sink *data_sink = audio_stream_get_sink(&buffer->stream);
1092+
struct sof_source *following_mod_data_source =
1093+
audio_stream_get_source(&buffer->stream);
10801094
struct sof_source *data_src = dp_queue_get_source(dp_queue);
1081-
uint32_t to_copy = MIN(sink_get_free_size(data_sink),
1095+
uint32_t to_copy = MIN(source_get_min_available(following_mod_data_source),
10821096
source_get_data_available(data_src));
10831097

10841098
err = source_to_sink_copy(data_src, data_sink, true, to_copy);

0 commit comments

Comments
 (0)