diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2019-08-13 02:10:59 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-08-13 02:10:59 +0000 |
commit | 70e5d9fa8b32b1bcef8306b26179cb71f54dfc2c (patch) | |
tree | 0022ab5cf74ddbc57af67b2ba32ac8256fda93b9 | |
parent | d2494793c2d86a3469b5aa3252ce67f09a2d35da (diff) | |
parent | 57c6ac44bc7d3dd25c81c498061394c13e9d4413 (diff) | |
download | libhardware-platform-tools-29.0.4.tar.gz |
Merge "Snap for 5798008 from 9359ffb16b2b8d573dd27930a000190c49cb374d to sdk-release" into sdk-releaseplatform-tools-29.0.4platform-tools-29.0.3
-rw-r--r-- | modules/audio_remote_submix/Android.bp | 3 | ||||
-rw-r--r-- | modules/audio_remote_submix/audio_hw.cpp | 29 |
2 files changed, 27 insertions, 5 deletions
diff --git a/modules/audio_remote_submix/Android.bp b/modules/audio_remote_submix/Android.bp index c7d018c0..f7b5c143 100644 --- a/modules/audio_remote_submix/Android.bp +++ b/modules/audio_remote_submix/Android.bp @@ -17,9 +17,6 @@ cc_library_shared { relative_install_path: "hw", vendor: true, srcs: ["audio_hw.cpp"], - include_dirs: [ - "system/media/audio_utils/include", - ], shared_libs: [ "liblog", "libcutils", diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp index 8c0c0971..e5231542 100644 --- a/modules/audio_remote_submix/audio_hw.cpp +++ b/modules/audio_remote_submix/audio_hw.cpp @@ -472,7 +472,7 @@ static void submix_audio_device_release_pipe_l(struct submix_audio_device * cons rsxadev->routes[route_idx].rsxSource.clear(); } memset(rsxadev->routes[route_idx].address, 0, AUDIO_DEVICE_MAX_ADDRESS_LEN); -#ifdef ENABLE_RESAMPLING +#if ENABLE_RESAMPLING memset(rsxadev->routes[route_idx].resampler_buffer, 0, sizeof(int16_t) * DEFAULT_PIPE_SIZE_IN_FRAMES); #endif @@ -488,17 +488,28 @@ 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; + route_idx = in->route_handle; + ALOG_ASSERT(rsxadev->routes[route_idx].input == in); + rsxadev->routes[route_idx].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; @@ -1609,7 +1620,9 @@ static int adev_open_input_stream(struct audio_hw_device *dev, if (!in) { in = (struct submix_stream_in *)calloc(1, sizeof(struct submix_stream_in)); if (!in) return -ENOMEM; +#if ENABLE_LEGACY_INPUT_OPEN in->ref_count = 1; +#endif // Initialize the function pointer tables (v-tables). in->stream.common.get_sample_rate = in_get_sample_rate; @@ -1648,6 +1661,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, @@ -1694,10 +1713,16 @@ static int adev_dump(const audio_hw_device_t *device, int fd) int n = snprintf(msg, sizeof(msg), "\nReroute submix audio module:\n"); write(fd, &msg, n); for (int i=0 ; i < MAX_ROUTES ; i++) { +#if ENABLE_RESAMPLING n = snprintf(msg, sizeof(msg), " route[%d] rate in=%d out=%d, addr=[%s]\n", i, rsxadev->routes[i].config.input_sample_rate, rsxadev->routes[i].config.output_sample_rate, rsxadev->routes[i].address); +#else + n = snprintf(msg, sizeof(msg), " route[%d], rate=%d addr=[%s]\n", i, + rsxadev->routes[i].config.common.sample_rate, + rsxadev->routes[i].address); +#endif write(fd, &msg, n); } return 0; |