diff options
| author | Phil Burk <philburk@google.com> | 2020-04-24 11:44:34 -0700 |
|---|---|---|
| committer | Phil Burk <philburk@google.com> | 2020-04-24 12:04:58 -0700 |
| commit | 4b182d70a8fbbd7e8d0405bfe0c0f1c8885bbf14 (patch) | |
| tree | bf68ccf40ab53880e99bd1427e50e2ad2fb59b73 | |
| parent | e5736050c6771ce58c54be118dcf13d3edb61630 (diff) | |
| download | platform_frameworks_wilhelm-android11-dev.tar.gz platform_frameworks_wilhelm-android11-dev.tar.bz2 platform_frameworks_wilhelm-android11-dev.zip | |
opensles: call setCallerName() for MediaMetricsandroid11-dev
This can be used to tell whether OpenSL ES
created the AudioTrack or AudioRecord object.
Bug: 149850236
Test: adb shell dumpsys media.metrics --clear
Test: Run an app that uses OpenSL ES.
Test: adb shell dumpsys media.metrics
Test: Look for "callerName=opensles" in the dump.
Change-Id: Iabc90299165869f0bc5d4e790f48ac72282c426d
| -rw-r--r-- | src/android/AudioPlayer_to_android.cpp | 4 | ||||
| -rw-r--r-- | src/android/AudioRecorder_to_android.cpp | 3 | ||||
| -rw-r--r-- | src/android/android_defs.h | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/src/android/AudioPlayer_to_android.cpp b/src/android/AudioPlayer_to_android.cpp index d8940b8..9dc0a8a 100644 --- a/src/android/AudioPlayer_to_android.cpp +++ b/src/android/AudioPlayer_to_android.cpp @@ -1695,6 +1695,10 @@ SLresult android_audioPlayer_realize(CAudioPlayer *pAudioPlayer, SLboolean async (void *) pAudioPlayer, // user notificationFrames, // see comment above pAudioPlayer->mSessionId); + + // Set it here so it can be logged by the destructor if the open failed. + pat->setCallerName(ANDROID_OPENSLES_CALLER_NAME); + android::status_t status = pat->initCheck(); if (status != android::NO_ERROR) { // AudioTracks are meant to be refcounted, so their dtor is protected. diff --git a/src/android/AudioRecorder_to_android.cpp b/src/android/AudioRecorder_to_android.cpp index 4e2f31d..2595112 100644 --- a/src/android/AudioRecorder_to_android.cpp +++ b/src/android/AudioRecorder_to_android.cpp @@ -703,6 +703,9 @@ SLresult android_audioRecorder_realize(CAudioRecorder* ar, SLboolean async) { // transfer type policy); // audio_input_flags_t + // Set it here so it can be logged by the destructor if the open failed. + ar->mAudioRecord->setCallerName(ANDROID_OPENSLES_CALLER_NAME); + android::status_t status = ar->mAudioRecord->initCheck(); if (android::NO_ERROR != status) { SL_LOGE("android_audioRecorder_realize(%p) error creating AudioRecord object; status %d", diff --git a/src/android/android_defs.h b/src/android/android_defs.h index 8b28983..daa7b70 100644 --- a/src/android/android_defs.h +++ b/src/android/android_defs.h @@ -221,5 +221,7 @@ union DataLocator2 { ANDROID_PERFORMANCE_MODE_NONE | \ ANDROID_PERFORMANCE_MODE_POWER_SAVING) +// This is used for exact matching by MediaMetrics. So do not change it. +#define ANDROID_OPENSLES_CALLER_NAME "opensles" } // namespace android |
