Skip to content

Commit fe802ae

Browse files
afq984Chromeos LUCI
authored and
Chromeos LUCI
committed
cras_stream_apm: Skip processing on the main thread
process_reverse might be unexpectedlly called from the main thread, if an iodev does not have start ops and cras_iodev_fill_odev_zeros is used as a fallback. This CL workarounds the assertion failure by doing nothing in process_reverse() if it finds itself called out of the audio thread. Skipping this data for the reverse apm stream is OK because the zeros are expected to not be helpful for echo cancellation anyway. BUG=b:340129658 TEST=tast run dut12 audio.CrasMultiChannelCapture.\* audio.CrasAEC.\* Change-Id: Ic3cdf3f0b6a007e39f97d01e5f3d823171461653 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5534460 Commit-Queue: Li-Yu Yu <[email protected]> Tested-by: [email protected] <[email protected]> Reviewed-by: Yu-Hsuan Hsu <[email protected]>
1 parent 7fa6bd7 commit fe802ae

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cras/src/server/cras_stream_apm.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,12 @@ int cras_stream_apm_destroy(struct cras_stream_apm* stream) {
847847
static int process_reverse(struct float_buffer* fbuf,
848848
unsigned int frame_rate,
849849
const struct cras_iodev* echo_ref) {
850-
struct cras_audio_ctx* actx = checked_audio_ctx();
850+
// TODO(b/340138001): Switch back to checked_audio_ctx() after we stop
851+
// calling this function in the main thread.
852+
struct cras_audio_ctx* actx = get_audio_ctx_or_null();
853+
if (!actx) {
854+
return 0;
855+
}
851856

852857
struct active_apm* active;
853858
int ret;

0 commit comments

Comments
 (0)