Merge "r_submix: Fix compilation for non-default configurations"
am: a5c2957f63
Change-Id: Iaa60e3cf875ce2f0606b4080eff06b66e8fa0072
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index 833c12b..f778693 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -472,7 +472,7 @@
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
@@ -499,7 +499,9 @@
}
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) {
@@ -1623,7 +1625,9 @@
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;
@@ -1714,10 +1718,16 @@
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;