summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2023-05-18 19:02:03 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-05-18 19:02:03 +0000
commit753713172a646fb8298939bcd75124d57cae9ee6 (patch)
treebc73f9d33519c08271c059d3119ace48d23becdd
parent3d9b9d8071c868b46ab25f99caca6228c8ecee7e (diff)
parentb88e70f31d2ffb335de2ce72ce2c0cbc0509ed7d (diff)
downloadwilhelm-android14-d2-s5-release.tar.gz
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/wilhelm/+/23285183 Change-Id: I2d60aa4df985209e18e301cc78127ad89687aa62 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--src/android/AudioPlayer_to_android.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/android/AudioPlayer_to_android.cpp b/src/android/AudioPlayer_to_android.cpp
index 8acc499..5df053d 100644
--- a/src/android/AudioPlayer_to_android.cpp
+++ b/src/android/AudioPlayer_to_android.cpp
@@ -1609,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;
}
@@ -1633,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
@@ -1643,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);