Skip to content

Commit 9d11205

Browse files
committed
audio: kpb: Discard input data if kd isn't active
Until the pipeline containing the kd module is started, discard incoming samples to avoid overrun on dai and not to pass a signal containing a glitch to kd. The kd module is placed on a separate pipeline, which can be started after the pipeline containing pkb. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 9129c46 commit 9d11205

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/audio/kpb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,14 @@ static int kpb_copy(struct comp_dev *dev)
12151215
break;
12161216
}
12171217

1218+
/* Discard data if sink is not active */
1219+
if (comp_buffer_get_sink_component(sink)->state != COMP_STATE_ACTIVE) {
1220+
copy_bytes = audio_stream_get_avail_bytes(&source->stream);
1221+
comp_update_buffer_consume(source, copy_bytes);
1222+
comp_dbg(dev, "KD not active, skipping %zu bytes...", copy_bytes);
1223+
break;
1224+
}
1225+
12181226
/* Validate sink */
12191227
if (!audio_stream_get_wptr(&sink->stream)) {
12201228
comp_err(dev, "invalid selector sink pointers.");

0 commit comments

Comments
 (0)