Merge "audio policy: fix HOTWORD capture device" into qt-dev
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
index 8d30a61..bc666a9 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
@@ -230,9 +230,15 @@
*/
if (pToProcess != pProcessed)
{
+#ifdef SUPPORT_MC
+ Copy_Float(pToProcess, /* Source */
+ pProcessed, /* Destination */
+ (LVM_INT16)(NrChannels * NrFrames)); /* Copy all samples */
+#else
Copy_Float(pToProcess, /* Source */
pProcessed, /* Destination */
(LVM_INT16)(2 * SampleCount)); /* Left and right */
+#endif
}
/*
diff --git a/media/utils/Android.bp b/media/utils/Android.bp
index a11602b..3adb40f 100644
--- a/media/utils/Android.bp
+++ b/media/utils/Android.bp
@@ -49,6 +49,10 @@
},
},
+ include_dirs: [
+ // For android_mallopt definitions.
+ "bionic/libc/private"
+ ],
local_include_dirs: ["include"],
export_include_dirs: ["include"],
}
diff --git a/media/utils/MemoryLeakTrackUtil.cpp b/media/utils/MemoryLeakTrackUtil.cpp
index 18f5f25..2988b52 100644
--- a/media/utils/MemoryLeakTrackUtil.cpp
+++ b/media/utils/MemoryLeakTrackUtil.cpp
@@ -22,6 +22,8 @@
#include "media/MemoryLeakTrackUtil.h"
#include <sstream>
+#include <bionic_malloc.h>
+
/*
* The code here originally resided in MediaPlayerService.cpp
*/
@@ -47,29 +49,22 @@
namespace android {
-extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overallSize,
- size_t* infoSize, size_t* totalMemory, size_t* backtraceSize);
-
-extern "C" void free_malloc_leak_info(uint8_t* info);
-
std::string dumpMemoryAddresses(size_t limit)
{
- uint8_t *info;
- size_t overallSize;
- size_t infoSize;
- size_t totalMemory;
- size_t backtraceSize;
- get_malloc_leak_info(&info, &overallSize, &infoSize, &totalMemory, &backtraceSize);
+ android_mallopt_leak_info_t leak_info;
+ if (!android_mallopt(M_GET_MALLOC_LEAK_INFO, &leak_info, sizeof(leak_info))) {
+ return "";
+ }
size_t count;
- if (info == nullptr || overallSize == 0 || infoSize == 0
- || (count = overallSize / infoSize) == 0) {
+ if (leak_info.buffer == nullptr || leak_info.overall_size == 0 || leak_info.info_size == 0
+ || (count = leak_info.overall_size / leak_info.info_size) == 0) {
ALOGD("no malloc info, libc.debug.malloc.program property should be set");
- return std::string();
+ return "";
}
std::ostringstream oss;
- oss << totalMemory << " bytes in " << count << " allocations\n";
+ oss << leak_info.total_memory << " bytes in " << count << " allocations\n";
oss << " ABI: '" ABI_STRING "'" << "\n\n";
if (count > limit) count = limit;
@@ -83,14 +78,14 @@
uintptr_t backtrace[];
};
- const AllocEntry * const e = (AllocEntry *)(info + i * infoSize);
+ const AllocEntry * const e = (AllocEntry *)(leak_info.buffer + i * leak_info.info_size);
oss << (e->size * e->allocations)
<< " bytes ( " << e->size << " bytes * " << e->allocations << " allocations )\n";
- oss << backtrace_string(e->backtrace, backtraceSize) << "\n";
+ oss << backtrace_string(e->backtrace, leak_info.backtrace_size) << "\n";
}
oss << "\n";
- free_malloc_leak_info(info);
+ android_mallopt(M_FREE_MALLOC_LEAK_INFO, &leak_info, sizeof(leak_info));
return oss.str();
}
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 59ced26..711a6dd 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -7454,8 +7454,10 @@
// we formerly checked for a callback handler (non-0 tid),
// but that is no longer required for TRANSFER_OBTAIN mode
//
- // frame count is not specified, or is exactly the pipe depth
- ((frameCount == 0) || (frameCount == mPipeFramesP2)) &&
+ // Frame count is not specified (0), or is less than or equal the pipe depth.
+ // It is OK to provide a higher capacity than requested.
+ // We will force it to mPipeFramesP2 below.
+ (frameCount <= mPipeFramesP2) &&
// PCM data
audio_is_linear_pcm(format) &&
// hardware format