diff options
author | Eric Laurent <elaurent@google.com> | 2019-03-01 18:39:26 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2019-03-04 19:45:12 +0000 |
commit | 5b78d419541a4e88077772da82160dfad82561e2 (patch) | |
tree | 71da2daaf1c22098880e9a3bbe0e1aca873d125a | |
parent | 7451fc7e50cca0e50893d62647bf9c51f46b2509 (diff) | |
download | libhardware-5b78d419541a4e88077772da82160dfad82561e2.tar.gz |
remote submix: force pipe shutdown on input close
Force mono pipe shutdown when all input stream clients are closed
so that a pending write is not stuck waiting for available buffer.
Bug: 119057550
Test: abort search on BLE remote
Change-Id: I4391e73874e502da5000b1746436fb61bb2fe869
-rw-r--r-- | modules/audio_remote_submix/audio_hw.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp index 8c0c0971..6fac56f0 100644 --- a/modules/audio_remote_submix/audio_hw.cpp +++ b/modules/audio_remote_submix/audio_hw.cpp @@ -488,17 +488,26 @@ static void submix_audio_device_destroy_pipe_l(struct submix_audio_device * cons ALOGV("submix_audio_device_destroy_pipe_l()"); int route_idx = -1; if (in != NULL) { + bool shut_down = false; #if ENABLE_LEGACY_INPUT_OPEN const_cast<struct submix_stream_in*>(in)->ref_count--; route_idx = in->route_handle; ALOG_ASSERT(rsxadev->routes[route_idx].input == in); if (in->ref_count == 0) { rsxadev->routes[route_idx].input = NULL; + shut_down = true; } ALOGV("submix_audio_device_destroy_pipe_l(): input ref_count %d", in->ref_count); #else rsxadev->input = NULL; + shut_down = true; #endif // ENABLE_LEGACY_INPUT_OPEN + if (shut_down) { + sp <MonoPipe> sink = rsxadev->routes[in->route_handle].rsxSink; + if (sink != NULL) { + sink->shutdown(true); + } + } } if (out != NULL) { route_idx = out->route_handle; @@ -1648,6 +1657,12 @@ static int adev_open_input_stream(struct audio_hw_device *dev, ALOGV("adev_open_input_stream(): about to create pipe"); submix_audio_device_create_pipe_l(rsxadev, config, DEFAULT_PIPE_SIZE_IN_FRAMES, DEFAULT_PIPE_PERIOD_COUNT, in, NULL, address, route_idx); + + sp <MonoPipe> sink = rsxadev->routes[route_idx].rsxSink; + if (sink != NULL) { + sink->shutdown(false); + } + #if LOG_STREAMS_TO_FILES if (in->log_fd >= 0) close(in->log_fd); in->log_fd = open(LOG_STREAM_IN_FILENAME, O_CREAT | O_TRUNC | O_WRONLY, |