summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp6
-rw-r--r--TEST_MAPPING4
-rw-r--r--src/MPH_to.h2
-rw-r--r--src/android/AudioPlayer_to_android.cpp26
-rw-r--r--src/android/android_Effect.cpp6
-rw-r--r--src/sles.cpp2
6 files changed, 28 insertions, 18 deletions
diff --git a/Android.bp b/Android.bp
index a961572..c5e3230 100644
--- a/Android.bp
+++ b/Android.bp
@@ -43,6 +43,9 @@ ndk_library {
symbol_file: "src/libOpenMAXAL.map.txt",
first_version: "14",
unversioned_until: "current",
+ export_header_libs: [
+ "libOpenMAXAL_headers",
+ ],
}
ndk_headers {
@@ -58,6 +61,9 @@ ndk_library {
symbol_file: "src/libOpenSLES.map.txt",
first_version: "9",
unversioned_until: "current",
+ export_header_libs: [
+ "libOpenSLES_ndk_headers",
+ ],
}
cc_library_headers {
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 55bbe66..65fa610 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,13 +2,13 @@
{
"presubmit": [
{
- "name": "CtsMediaTestCases",
+ "name": "CtsMediaAudioTestCases",
"options" : [
{
"include-annotation": "android.platform.test.annotations.Presubmit"
},
{
- "include-filter": "android.media.cts.AudioNativeTest"
+ "include-filter": "android.media.audio.cts.AudioNativeTest"
}
]
}
diff --git a/src/MPH_to.h b/src/MPH_to.h
index 1dc83c4..d922bcd 100644
--- a/src/MPH_to.h
+++ b/src/MPH_to.h
@@ -33,6 +33,6 @@ extern const signed char
MPH_to_MediaPlayer[MPH_MAX];
/** \brief Maximum number of interfaces on a single object. */
-#define MAX_INDEX 32
+#define SLES_MAX_INDEX 32
#endif // !defined(__MPH_to_H)
diff --git a/src/android/AudioPlayer_to_android.cpp b/src/android/AudioPlayer_to_android.cpp
index ef466b6..5df053d 100644
--- a/src/android/AudioPlayer_to_android.cpp
+++ b/src/android/AudioPlayer_to_android.cpp
@@ -1049,8 +1049,6 @@ SLresult android_audioPlayer_checkSourceSink(CAudioPlayer *pAudioPlayer)
const SLuint32 sinkLocatorType = *(SLuint32 *)pAudioSnk->pLocator;
const SLuint32 sourceFormatType = *(SLuint32 *)pAudioSrc->pFormat;
- const SLuint32 *df_representation = NULL; // pointer to representation field, if it exists
-
switch (sourceLocatorType) {
//------------------
// Buffer Queues
@@ -1060,12 +1058,7 @@ SLresult android_audioPlayer_checkSourceSink(CAudioPlayer *pAudioPlayer)
// Buffer format
switch (sourceFormatType) {
// currently only PCM buffer queues are supported,
- case SL_ANDROID_DATAFORMAT_PCM_EX: {
- const SLAndroidDataFormat_PCM_EX *df_pcm =
- (const SLAndroidDataFormat_PCM_EX *) pAudioSrc->pFormat;
- // checkDataFormat() already checked representation
- df_representation = &df_pcm->representation;
- } // SL_ANDROID_DATAFORMAT_PCM_EX - fall through to next test.
+ case SL_ANDROID_DATAFORMAT_PCM_EX:
FALLTHROUGH_INTENDED;
case SL_DATAFORMAT_PCM: {
// checkDataFormat() already did generic checks, now do the Android-specific checks
@@ -1616,19 +1609,23 @@ SLresult android_audioPlayer_realize(CAudioPlayer *pAudioPlayer, SLboolean async
checkAndSetPerformanceModePre(pAudioPlayer);
audio_output_flags_t policy;
+ audio_flags_mask_t attrFlags = AUDIO_FLAG_NONE;
switch (pAudioPlayer->mPerformanceMode) {
case ANDROID_PERFORMANCE_MODE_POWER_SAVING:
policy = AUDIO_OUTPUT_FLAG_DEEP_BUFFER;
+ attrFlags = static_cast<audio_flags_mask_t>(attrFlags | AUDIO_FLAG_DEEP_BUFFER);
break;
case ANDROID_PERFORMANCE_MODE_NONE:
policy = AUDIO_OUTPUT_FLAG_NONE;
break;
case ANDROID_PERFORMANCE_MODE_LATENCY_EFFECTS:
policy = AUDIO_OUTPUT_FLAG_FAST;
+ attrFlags = static_cast<audio_flags_mask_t>(attrFlags | AUDIO_FLAG_LOW_LATENCY);
break;
case ANDROID_PERFORMANCE_MODE_LATENCY:
default:
policy = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW);
+ attrFlags = static_cast<audio_flags_mask_t>(attrFlags | AUDIO_FLAG_LOW_LATENCY);
break;
}
@@ -1640,9 +1637,13 @@ SLresult android_audioPlayer_realize(CAudioPlayer *pAudioPlayer, SLboolean async
} else {
notificationFrames = 0;
}
+ audio_attributes_t attributes = AUDIO_ATTRIBUTES_INITIALIZER;
+ attributes.usage = usageForStreamType(pAudioPlayer->mStreamType);
+ attributes.flags = attrFlags;
+
const auto callbackHandle = android::sp<android::AudioTrackCallback>::make(pAudioPlayer);
const auto pat = android::sp<android::AudioTrack>::make(
- pAudioPlayer->mStreamType, // streamType
+ AUDIO_STREAM_DEFAULT, // streamType
sampleRate, // sampleRate
sles_to_android_sampleFormat(df_pcm), // format
channelMask, // channel mask
@@ -1650,7 +1651,12 @@ SLresult android_audioPlayer_realize(CAudioPlayer *pAudioPlayer, SLboolean async
policy, // flags
callbackHandle, // callback
notificationFrames, // see comment above
- pAudioPlayer->mSessionId);
+ pAudioPlayer->mSessionId,
+ android::AudioTrack::TRANSFER_DEFAULT, // transferType
+ nullptr, // offloadInfo
+ AttributionSourceState(), // attributionSource
+ &attributes // pAttributes
+ );
// Set it here so it can be logged by the destructor if the open failed.
pat->setCallerName(ANDROID_OPENSLES_CALLER_NAME);
diff --git a/src/android/android_Effect.cpp b/src/android/android_Effect.cpp
index 2b5582f..c87e584 100644
--- a/src/android/android_Effect.cpp
+++ b/src/android/android_Effect.cpp
@@ -677,8 +677,7 @@ bool android_fx_initEffectObj(audio_session_t sessionId, android::sp<android::Au
effect->set(type, EFFECT_UUID_NULL,
0,// priority
- 0,// effect callback
- 0,// callback data
+ nullptr,// effect callback
sessionId,// session ID
0); // output
@@ -826,8 +825,7 @@ SLresult android_genericFx_createEffect(IAndroidEffect* iae, SLInterfaceID pUuid
pFx->set(NULL, // not using type to create effect
(const effect_uuid_t*)pUuid,
0,// priority
- 0,// effect callback
- 0,// callback data
+ nullptr,// effect callback
sessionId,
0 );// output
diff --git a/src/sles.cpp b/src/sles.cpp
index 0761d24..6b393dc 100644
--- a/src/sles.cpp
+++ b/src/sles.cpp
@@ -37,7 +37,7 @@ bool IsInterfaceInitialized(IObject *thiz, unsigned MPH)
if (0 > (index = clazz->mMPH_to_index[MPH])) {
return false;
}
- assert(MAX_INDEX >= clazz->mInterfaceCount);
+ assert(SLES_MAX_INDEX >= clazz->mInterfaceCount);
assert(clazz->mInterfaceCount > (unsigned) index);
switch (thiz->mInterfaceStates[index]) {
case INTERFACE_EXPOSED: