Skip to content

Commit a55cfa5

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 bb30aa2 commit a55cfa5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/audio/module_adapter/module_adapter.c

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

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

0 commit comments

Comments
 (0)