diff options
author | Mikhail Naganov <mnaganov@google.com> | 2018-03-01 13:46:57 -0800 |
---|---|---|
committer | Mikhail Naganov <mnaganov@google.com> | 2018-03-01 13:49:58 -0800 |
commit | ab5b51838c94afc60f9979cdde2117930ef90ea9 (patch) | |
tree | 72c6d8cd3bcded46ff70d94bf0cf2b8907c0b5d4 | |
parent | 1df8a0039ffaa5161e1ecdfda3ae3f7e5c7068c2 (diff) | |
download | libhardware-ab5b51838c94afc60f9979cdde2117930ef90ea9.tar.gz |
r_submix: Fix logspam on pipe corruption
Prevent logging an error message on every attempt to write
if the FIFO backing up the MonoPipe got corrupted. This condition
can be detected by checking for -EIO error code.
Bug: 74067530
Test: make audio_utils_fifo_base::mIsShutdown to be set by default,
run r_submix_tests and observe logcat
Change-Id: I5d67997e902e834f04c10f9ffb39b16cba9c5739
-rw-r--r-- | modules/audio_remote_submix/audio_hw.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp index d78e723d..e826ac31 100644 --- a/modules/audio_remote_submix/audio_hw.cpp +++ b/modules/audio_remote_submix/audio_hw.cpp @@ -821,6 +821,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, written_frames = 0; return 0; + } else if (written_frames == -EIO) { + // receiving -EIO means that the underlying FIFO has shut itself down + // due to reader/writer indices corruption. This state is irreversible, + // so shut down the monopipe. It will be destroyed on the next call to 'write.' + sink->shutdown(true); } else { // write() returned UNDERRUN or WOULD_BLOCK, retry ALOGE("out_write() write to pipe returned unexpected %zd", written_frames); |