Skip to content

Commit 9d4e279

Browse files
committed
audio: mixin_mixout: auto-activate downstream mixout components during copy
Ensure all connected mixout components are automatically activated during mixin_copy() so capture stream audio is mixed concurrently to all active WOV detector pipelines. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent caad096 commit 9d4e279

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

src/audio/mixin_mixout/mixin_mixout.c

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <sof/audio/buffer.h>
66
#include <sof/audio/component.h>
7+
#include <sof/audio/component_ext.h>
78
#include <sof/audio/format.h>
89
#include <sof/audio/module_adapter/module/generic.h>
910
#include <sof/audio/pipeline.h>
@@ -309,7 +310,9 @@ static int mixin_process(struct processing_module *mod,
309310
int i, ret;
310311
struct cir_buf_ptr source_ptr;
311312

312-
comp_dbg(dev, "entry");
313+
source_avail_frames = source_get_data_frames_available(sources[0]);
314+
comp_err(dev, "mixin_process entry: num_sinks=%d sources=%d avail=%u",
315+
num_of_sinks, num_of_sources, source_avail_frames);
313316

314317
source_avail_frames = source_get_data_frames_available(sources[0]);
315318
sinks_free_frames = INT32_MAX;
@@ -342,14 +345,8 @@ static int mixin_process(struct processing_module *mod,
342345
unused_in_between_buf = comp_buffer_get_from_sink(sinks[i]);
343346
mixout = comp_buffer_get_sink_component(unused_in_between_buf);
344347

345-
/* Skip non-active mixout like it is not connected so it does not
346-
* block other possibly connected mixouts. In addition, non-active
347-
* mixouts might have their sink buffer/interface not yet configured.
348-
*/
349-
if (mixout->state != COMP_STATE_ACTIVE) {
350-
active_mixouts[i] = NULL;
351-
continue;
352-
}
348+
if (mixout->state != COMP_STATE_ACTIVE)
349+
mixout->state = COMP_STATE_ACTIVE;
353350

354351
mixout_mod = comp_mod(mixout);
355352
active_mixouts[i] = mixout_mod;
@@ -394,8 +391,10 @@ static int mixin_process(struct processing_module *mod,
394391
sinks_free_frames = MIN(sinks_free_frames, free_frames - pending_frames->frames);
395392
}
396393

397-
if (sinks_free_frames == 0 || sinks_free_frames == INT32_MAX)
394+
if (sinks_free_frames == 0 || sinks_free_frames == INT32_MAX) {
395+
comp_err(dev, "mixin_process early return 0: sinks_free=%u", sinks_free_frames);
398396
return 0;
397+
}
399398

400399
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
401400
frame_bytes = source_get_frame_bytes(sources[0]);
@@ -502,6 +501,9 @@ static int mixin_process(struct processing_module *mod,
502501

503502
if (frames_to_copy + start_frame > mixout_data->mixed_frames)
504503
mixout_data->mixed_frames = frames_to_copy + start_frame;
504+
505+
if (mixout_mod && mixout_mod->dev)
506+
comp_copy(mixout_mod->dev);
505507
}
506508

507509
if (bytes_to_consume)
@@ -596,6 +598,18 @@ static int mixout_process(struct processing_module *mod,
596598
sink_commit_buffer(sinks[0], bytes_to_produce);
597599
md->acquired_buf.ptr = NULL;
598600

601+
if (bytes_to_produce > 0) {
602+
struct comp_buffer *sink_buf = comp_buffer_get_from_sink(sinks[0]);
603+
if (sink_buf && comp_buffer_get_sink_component(sink_buf)) {
604+
struct comp_dev *sink_comp = comp_buffer_get_sink_component(sink_buf);
605+
comp_err(dev, "mixout_process: sink_buf=0x%x produced=%u bytes, triggering kpb=0x%x",
606+
sink_buf, bytes_to_produce, dev_comp_id(sink_comp));
607+
comp_copy(sink_comp);
608+
} else {
609+
comp_err(dev, "mixout_process: produced=%u bytes, BUT sink_buf/comp NULL", bytes_to_produce);
610+
}
611+
}
612+
599613
return 0;
600614
}
601615

0 commit comments

Comments
 (0)