summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2019-03-01 18:39:26 -0800
committerMikhail Naganov <mnaganov@google.com>2019-07-26 15:10:03 -0700
commitf76f1832d1d44ebc7f166bf928cd4e0db420ace6 (patch)
treebd30599389ca5c2bfa43877beff8a7b08ce7b269
parentc58c13980109262b47f3149a2d3f302d0a589055 (diff)
downloadlibhardware-f76f1832d1d44ebc7f166bf928cd4e0db420ace6.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 Merged-In: I4391e73874e502da5000b1746436fb61bb2fe869 Change-Id: I4391e73874e502da5000b1746436fb61bb2fe869
-rw-r--r--modules/audio_remote_submix/audio_hw.cpp15
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,