summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2024-01-17 12:38:42 -0800
committerAndy Hung <hunga@google.com>2024-03-07 20:44:46 -0800
commitaa7f441d06e5895d05269b08a7e8b494fb0c61eb (patch)
treeb17da102fa5d542962f86e313a92d006bda12fd3
parent342901abcad3cb473ab381ce270ef4cc7f40bf78 (diff)
downloadmedia-aa7f441d06e5895d05269b08a7e8b494fb0c61eb.tar.gz
PowerLog: Balance memory for multiple levels
Test: atest powerlog_tests Test: adb shell showmap '$(pgrep audioserver)' Bug: 319566420 Merged-In: I2c97098da680febd7a2b568e01dc661390720ca7 Change-Id: I2c97098da680febd7a2b568e01dc661390720ca7
-rw-r--r--audio_utils/include/audio_utils/PowerLog.h3
-rw-r--r--audio_utils/tests/powerlog_tests.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/audio_utils/include/audio_utils/PowerLog.h b/audio_utils/include/audio_utils/PowerLog.h
index 7ab439bd..30317068 100644
--- a/audio_utils/include/audio_utils/PowerLog.h
+++ b/audio_utils/include/audio_utils/PowerLog.h
@@ -116,7 +116,8 @@ public:
size_t scale = 1;
for (size_t i = 0; i < levels; ++i) {
v[i] = std::make_shared<PowerLogBase>(
- sampleRate, channelCount, format, entries, framesPerEntry * scale);
+ sampleRate, channelCount, format,
+ entries / levels, framesPerEntry * scale);
scale *= 20; // each level's entry is 20x the temporal width of the prior.
}
return v;
diff --git a/audio_utils/tests/powerlog_tests.cpp b/audio_utils/tests/powerlog_tests.cpp
index aa00f1e7..2303ee1e 100644
--- a/audio_utils/tests/powerlog_tests.cpp
+++ b/audio_utils/tests/powerlog_tests.cpp
@@ -113,7 +113,7 @@ TEST(audio_utils_powerlog, basic_level_2) {
kSampleRate /* sampleRate */,
1 /* channelCount */,
AUDIO_FORMAT_PCM_16_BIT,
- 100 /* entries */,
+ 200 /* entries */,
1 /* framesPerEntry */,
2 /* levels */);