Merge "Return bits per sample and sample rate as metadata"
diff --git a/camera/ndk/Android.mk b/camera/ndk/Android.mk
index f5ff69d..53addf1 100644
--- a/camera/ndk/Android.mk
+++ b/camera/ndk/Android.mk
@@ -39,6 +39,8 @@
LOCAL_CFLAGS += -fvisibility=hidden -D EXPORT='__attribute__ ((visibility ("default")))'
LOCAL_CFLAGS += -Wall -Wextra -Werror
+LOCAL_LDFLAGS += -Wl,--version-script=$(LOCAL_PATH)/libcamera2ndk.map.txt
+
LOCAL_SHARED_LIBRARIES := \
libbinder \
liblog \
diff --git a/media/extractors/flac/FLACExtractor.cpp b/media/extractors/flac/FLACExtractor.cpp
index a721b65..ccf80d0 100644
--- a/media/extractors/flac/FLACExtractor.cpp
+++ b/media/extractors/flac/FLACExtractor.cpp
@@ -618,6 +618,7 @@
mTrackMetadata->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW);
mTrackMetadata->setInt32(kKeyChannelCount, getChannels());
mTrackMetadata->setInt32(kKeySampleRate, getSampleRate());
+ mTrackMetadata->setInt32(kKeyBitsPerSample, getBitsPerSample());
mTrackMetadata->setInt32(kKeyPcmEncoding, kAudioEncodingPcm16bit);
// sample rate is non-zero, so division by zero not possible
mTrackMetadata->setInt64(kKeyDuration,
diff --git a/media/extractors/wav/WAVExtractor.cpp b/media/extractors/wav/WAVExtractor.cpp
index f5a1b01..fe509bf 100644
--- a/media/extractors/wav/WAVExtractor.cpp
+++ b/media/extractors/wav/WAVExtractor.cpp
@@ -310,6 +310,7 @@
mTrackMeta.setInt32(kKeyChannelCount, mNumChannels);
mTrackMeta.setInt32(kKeyChannelMask, mChannelMask);
mTrackMeta.setInt32(kKeySampleRate, mSampleRate);
+ mTrackMeta.setInt32(kKeyBitsPerSample, mBitsPerSample);
mTrackMeta.setInt32(kKeyPcmEncoding, kAudioEncodingPcm16bit);
int64_t durationUs = 0;
diff --git a/media/libmedia/MediaUtils.cpp b/media/libmedia/MediaUtils.cpp
index 320c7a9..bcc7ebf 100644
--- a/media/libmedia/MediaUtils.cpp
+++ b/media/libmedia/MediaUtils.cpp
@@ -25,6 +25,7 @@
#include "MediaUtils.h"
extern "C" size_t __cfi_shadow_size();
+extern "C" void __scudo_set_rss_limit(size_t, int) __attribute__((weak));
namespace android {
@@ -65,6 +66,14 @@
maxMem = propVal;
}
+ // If 64-bit Scudo is in use, enforce the hard RSS limit (in MB).
+ if (maxMem != SIZE_MAX && sizeof(void *) == 8 &&
+ &__scudo_set_rss_limit != 0) {
+ __scudo_set_rss_limit(maxMem >> 20, 1);
+ ALOGV("Scudo hard RSS limit set to %zu MB", maxMem >> 20);
+ return;
+ }
+
// Increase by the size of the CFI shadow mapping. Most of the shadow is not
// backed with physical pages, and it is possible for the result to be
// higher than total physical memory. This is fine for RLIMIT_AS.