audioserver: impose memory restrictions

Impose restrictions to limit effect of excessive memory
allocation.

adb shell setprop audio.maxmem SOME_VALUE_GREATER_THAN_60MB_IN_BYTES
adb shell pkill audioserver

and see what happens when AudioTracks / AudioRecords are created

Test: as above
Bug: 69927864
Change-Id: I0a6a90db3321f066a25fb2fcd01e9f834d199979
gugelfrei
Andy Hung 7 years ago
parent cef7b7a656
commit 21052719e6

@ -15,6 +15,7 @@ LOCAL_SHARED_LIBRARIES := \
liblog \
libhidltransport \
libhwbinder \
libmedia \
libmedialogservice \
libnbaio \
libsoundtriggerservice \
@ -35,6 +36,7 @@ LOCAL_C_INCLUDES := \
frameworks/av/media/libaaudio/include \
frameworks/av/media/libaaudio/src \
frameworks/av/media/libaaudio/src/binding \
frameworks/av/media/libmedia \
$(call include-path-for, audio-utils) \
external/sonic \

@ -35,12 +35,19 @@
#include "AAudioService.h"
#include "utility/AAudioUtilities.h"
#include "MediaLogService.h"
#include "MediaUtils.h"
#include "SoundTriggerHwService.h"
using namespace android;
int main(int argc __unused, char **argv)
{
// TODO: update with refined parameters
limitProcessMemory(
"audio.maxmem", /* "ro.audio.maxmem", property that defines limit */
(size_t)512 * (1 << 20), /* SIZE_MAX, upper limit in bytes */
20 /* upper limit as percentage of physical RAM */);
signal(SIGPIPE, SIG_IGN);
bool doLog = (bool) property_get_bool("ro.test_harness", 0);

Loading…
Cancel
Save