Skip to content

Commit e05a35a

Browse files
authored
Revert "Add audio performance to AdpfWrapper (#2330)" (#2352)
This reverts commit 4f48137.
1 parent 4bbb563 commit e05a35a

20 files changed

Lines changed: 26 additions & 400 deletions

apps/OboeTester/app/src/main/cpp/NativeAudioContext.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,6 @@ class ActivityContext {
341341
oboeCallbackProxy->setNotifyWorkloadIncreaseEnabled(enabled);
342342
}
343343

344-
void setReportActualDurationDisabled(bool disabled) {
345-
std::shared_ptr<oboe::AudioStream> stream = getOutputStream();
346-
if (stream) {
347-
stream->setReportActualDurationDisabled(disabled);
348-
}
349-
}
350-
351344
int32_t setBufferSizeInFrames(int streamIndex, int threshold);
352345

353346
virtual void setupMemoryBuffer([[maybe_unused]] std::unique_ptr<uint8_t[]>& buffer,

apps/OboeTester/app/src/main/cpp/cpu/AudioWorkloadTest.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ class AudioWorkloadTest : oboe::AudioStreamDataCallback {
9898
return static_cast<int32_t>(result);
9999
}
100100

101-
// Apply the current setting for reporting actual duration once the stream exists.
102-
mStream->setReportActualDurationDisabled(mReportActualDurationDisabled);
103-
104101
mFramesPerBurst = mStream->getFramesPerBurst();
105102
mSampleRate = mStream->getSampleRate();
106103
mPreviousXRunCount = 0;
@@ -152,8 +149,7 @@ class AudioWorkloadTest : oboe::AudioStreamDataCallback {
152149
*/
153150
int32_t start(int32_t targetDurationMillis, int32_t numBursts, int32_t numVoices,
154151
int32_t alternateNumVoices, int32_t alternatingPeriodMs, bool adpfEnabled,
155-
bool adpfWorkloadIncreaseEnabled, bool hearWorkload, bool highPerformanceAudio,
156-
bool reportActualDurationDisabled) {
152+
bool adpfWorkloadIncreaseEnabled, bool hearWorkload) {
157153
std::lock_guard<std::mutex> lock(mStreamLock);
158154
if (!mStream) {
159155
LOGE("Error: Stream not open.");
@@ -179,13 +175,7 @@ class AudioWorkloadTest : oboe::AudioStreamDataCallback {
179175
mRunning = true;
180176
mHearWorkload = hearWorkload;
181177
mAdpfWorkloadIncreaseEnabled = adpfWorkloadIncreaseEnabled;
182-
mReportActualDurationDisabled = reportActualDurationDisabled;
183178
mStream->setPerformanceHintEnabled(adpfEnabled);
184-
mStream->setReportActualDurationDisabled(mReportActualDurationDisabled);
185-
// Apply performance hint configuration if requested via runner flags.
186-
oboe::PerformanceHintConfig cfg;
187-
cfg.highPerformanceAudio = highPerformanceAudio;
188-
mStream->setPerformanceHintConfig(cfg);
189179
mStream->setBufferSizeInFrames(mNumBursts * mFramesPerBurst);
190180
mBufferSizeInFrames = mStream->getBufferSizeInFrames();
191181
oboe::Result result = mStream->start();
@@ -432,7 +422,6 @@ class AudioWorkloadTest : oboe::AudioStreamDataCallback {
432422
std::atomic<int64_t> mStartTimeMs{0};
433423
std::atomic<bool> mHearWorkload{false};
434424
std::atomic<bool> mAdpfWorkloadIncreaseEnabled{false};
435-
std::atomic<bool> mReportActualDurationDisabled{false};
436425

437426
// Lock to protect mCallbackStatistics
438427
std::mutex mStatisticsLock;

apps/OboeTester/app/src/main/cpp/cpu/AudioWorkloadTestRunner.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ class AudioWorkloadTestRunner {
7474
int32_t alternatingPeriodMs,
7575
bool adpfEnabled,
7676
bool adpfWorkloadIncreaseEnabled,
77-
bool hearWorkload,
78-
bool highPerformanceAudio,
79-
bool reportActualDurationDisabled) {
77+
bool hearWorkload) {
8078
if (mIsRunning) {
8179
LOGE("Error: Test already running.");
8280
return -1;
@@ -92,17 +90,15 @@ class AudioWorkloadTestRunner {
9290
mIsDone = false;
9391
mResult = 0;
9492

95-
int32_t result = mAudioWorkloadTest.start(
96-
targetDurationMs,
97-
numBursts,
98-
numVoices,
99-
alternateNumVoices,
100-
alternatingPeriodMs,
101-
adpfEnabled,
102-
adpfWorkloadIncreaseEnabled,
103-
hearWorkload,
104-
highPerformanceAudio,
105-
reportActualDurationDisabled);
93+
int32_t result = mAudioWorkloadTest.start(
94+
targetDurationMs,
95+
numBursts,
96+
numVoices,
97+
alternateNumVoices,
98+
alternatingPeriodMs,
99+
adpfEnabled,
100+
adpfWorkloadIncreaseEnabled,
101+
hearWorkload);
106102

107103
if (result != static_cast<int32_t>(oboe::Result::OK)) {
108104
mResult = -1;

apps/OboeTester/app/src/main/cpp/jni-bridge.cpp

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ Java_com_mobileer_oboetester_NativeEngine_getCpuCount(JNIEnv *env, jclass type)
154154
return sysconf(_SC_NPROCESSORS_CONF);
155155
}
156156

157-
JNIEXPORT jboolean JNICALL
158-
Java_com_mobileer_oboetester_NativeEngine_isHighPerformanceAudioSupported(JNIEnv *env, jclass type) {
159-
return oboe::AdpfWrapper::isHighPerformanceAudioSupported();
160-
}
161-
162157
JNIEXPORT void JNICALL
163158
Java_com_mobileer_oboetester_NativeEngine_setCpuAffinityMask(JNIEnv *env,
164159
jclass type,
@@ -328,13 +323,6 @@ Java_com_mobileer_oboetester_TestAudioActivity_setUseAlternativeAdpf(JNIEnv *env
328323
oboe::AdpfWrapper::setUseAlternative(enabled);
329324
}
330325

331-
JNIEXPORT void JNICALL
332-
Java_com_mobileer_oboetester_NativeEngine_setReportActualDurationDisabled(JNIEnv *env,
333-
jclass type,
334-
jboolean disabled) {
335-
engine.getCurrentActivity()->setReportActualDurationDisabled(disabled);
336-
}
337-
338326
JNIEXPORT jint JNICALL
339327
Java_com_mobileer_oboetester_OboeAudioStream_setBufferSizeInFrames(
340328
JNIEnv *env, jobject, jint streamIndex, jint threshold) {
@@ -367,17 +355,6 @@ Java_com_mobileer_oboetester_OboeAudioStream_setPerformanceHintEnabled(
367355
}
368356
}
369357

370-
JNIEXPORT void JNICALL
371-
Java_com_mobileer_oboetester_OboeAudioStream_setPerformanceHintConfig(
372-
JNIEnv *env, jobject, jint streamIndex, jboolean highPerformance) {
373-
std::shared_ptr<oboe::AudioStream> oboeStream = engine.getCurrentActivity()->getStream(streamIndex);
374-
if (oboeStream != nullptr) {
375-
oboe::PerformanceHintConfig cfg;
376-
cfg.highPerformanceAudio = highPerformance;
377-
oboeStream->setPerformanceHintConfig(cfg);
378-
}
379-
}
380-
381358
JNIEXPORT jint JNICALL
382359
Java_com_mobileer_oboetester_OboeAudioStream_getBufferCapacityInFrames(
383360
JNIEnv *env, jobject, jint streamIndex) {
@@ -1298,12 +1275,10 @@ JNIEXPORT jint JNICALL
12981275
Java_com_mobileer_oboetester_AudioWorkloadTestActivity_start(JNIEnv *env, jobject thiz,
12991276
jint targetDurationMs, jint numBursts, jint numVoices, jint numAlternateVoices,
13001277
jint alternatingPeriodMs, jboolean adpfEnabled, jboolean adpfWorkloadIncreaseEnabled,
1301-
jboolean hearWorkload, jboolean highPerformanceAudio,
1302-
jboolean reportActualDurationDisabled) {
1278+
jboolean hearWorkload) {
13031279
return sAudioWorkload.start(targetDurationMs, numBursts, numVoices,
13041280
numAlternateVoices, alternatingPeriodMs, adpfEnabled,
1305-
adpfWorkloadIncreaseEnabled, hearWorkload, highPerformanceAudio,
1306-
reportActualDurationDisabled);
1281+
adpfWorkloadIncreaseEnabled, hearWorkload);
13071282
}
13081283

13091284
JNIEXPORT jint JNICALL
@@ -1553,14 +1528,10 @@ Java_com_mobileer_oboetester_AudioWorkloadTestRunnerActivity_start(JNIEnv *env,
15531528
jint alternatingPeriodMillis,
15541529
jboolean adpfEnabled,
15551530
jboolean adpfWorkloadIncreaseEnabled,
1556-
jboolean hearWorkload,
1557-
jboolean highPerformanceAudio,
1558-
jboolean reportActualDurationDisabled) {
1559-
int32_t result = sAudioWorkloadRunner.start(targetDurationMs, numBursts, numVoices,
1531+
jboolean hearWorkload) {
1532+
return sAudioWorkloadRunner.start(targetDurationMs, numBursts, numVoices,
15601533
alternateNumVoices, alternatingPeriodMillis, adpfEnabled,
1561-
adpfWorkloadIncreaseEnabled, hearWorkload, highPerformanceAudio,
1562-
reportActualDurationDisabled);
1563-
return result;
1534+
adpfWorkloadIncreaseEnabled, hearWorkload);
15641535
}
15651536

15661537
JNIEXPORT jboolean JNICALL

apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AudioStreamBase.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ public void setPerformanceHintEnabled(boolean checked) {
8888
}
8989
public void setHearWorkload(boolean checked) {
9090
}
91-
/**
92-
* Configure performance hint options for this stream. Default implementation is no-op.
93-
* @param highPerformance true to request high performance audio mode when creating the session.
94-
*/
95-
public void setPerformanceHintConfig(boolean highPerformance) {
96-
}
9791
public int notifyWorkloadIncrease(boolean cpu, boolean gpu) {
9892
return -1;
9993
}

apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AudioWorkloadTestActivity.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ public class AudioWorkloadTestActivity extends BaseOboeTesterActivity {
4747
private CheckBox mEnableAdpfBox;
4848
private CheckBox mEnableAdpfWorkloadIncreaseBox;
4949
private CheckBox mHearWorkloadBox;
50-
private CheckBox mHighPerformanceAudioBox;
51-
private CheckBox mDisableAdpfDurationBox;
5250

5351
private int mCpuCount;
5452
private LinearLayout mAffinityLayout;
@@ -151,9 +149,6 @@ protected void onCreate(Bundle savedInstanceState) {
151149
mEnableAdpfBox = (CheckBox) findViewById(R.id.enable_adpf);
152150
mEnableAdpfWorkloadIncreaseBox = (CheckBox) findViewById(R.id.enable_adpf_workload_increase);
153151
mHearWorkloadBox = (CheckBox) findViewById(R.id.hear_workload);
154-
mHighPerformanceAudioBox = (CheckBox) findViewById(R.id.high_performance_audio);
155-
156-
mDisableAdpfDurationBox = (CheckBox) findViewById(R.id.disable_adpf_duration);
157152

158153
mOpenButton = (Button) findViewById(R.id.button_open);
159154
mStartButton = (Button) findViewById(R.id.button_start);
@@ -226,13 +221,10 @@ public void openAudio(View view) {
226221
}
227222

228223
public void startTest(View view) {
229-
boolean reportActualDurationDisabled = mDisableAdpfDurationBox.isChecked();
230-
231224
int result = start(mTargetDurationMsSlider.getValue(), mNumBurstsSlider.getValue(),
232-
mNumVoicesSlider.getValue(), mAlternateNumVoicesSlider.getValue(),
233-
mAlternatingPeriodMsSlider.getValue(), mEnableAdpfBox.isChecked(),
234-
mEnableAdpfWorkloadIncreaseBox.isChecked(), mHearWorkloadBox.isChecked(),
235-
mHighPerformanceAudioBox.isChecked(), reportActualDurationDisabled);
225+
mNumVoicesSlider.getValue(), mAlternateNumVoicesSlider.getValue(),
226+
mAlternatingPeriodMsSlider.getValue(), mEnableAdpfBox.isChecked(),
227+
mEnableAdpfWorkloadIncreaseBox.isChecked(), mHearWorkloadBox.isChecked());
236228
if (result != OPERATION_SUCCESS) {
237229
showErrorToast("start failed! Error:" + result);
238230
return;
@@ -326,8 +318,6 @@ public void enableParamsUI(boolean enabled) {
326318
mEnableAdpfBox.setEnabled(enabled);
327319
mEnableAdpfWorkloadIncreaseBox.setEnabled(enabled);
328320
mHearWorkloadBox.setEnabled(enabled);
329-
mHighPerformanceAudioBox.setEnabled(enabled);
330-
mDisableAdpfDurationBox.setEnabled(enabled);
331321
}
332322

333323
public void updateStreamInfoView() {
@@ -341,8 +331,7 @@ public void updateStreamInfoView() {
341331
private native int getBufferSizeInFrames();
342332
private native int start(int targetDurationMs, int numBursts, int numVoices,
343333
int numAlternateVoices, int alternatingPeriodMs, boolean adpfEnabled,
344-
boolean adpfWorkloadIncreaseEnabled, boolean hearWorkload,
345-
boolean highPerformanceAudio, boolean reportActualDurationDisabled);
334+
boolean adpfWorkloadIncreaseEnabled, boolean hearWorkload);
346335
private native int getCpuCount();
347336
private native int setCpuAffinityForCallback(int mask);
348337
private native int getXRunCount();

apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AudioWorkloadTestRunnerActivity.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public class AudioWorkloadTestRunnerActivity extends BaseOboeTesterActivity {
3838
private CheckBox mEnableAdpfBox;
3939
private CheckBox mEnableAdpfWorkloadIncreaseBox;
4040
private CheckBox mHearWorkloadBox;
41-
private CheckBox mHighPerformanceAudioBox;
42-
private CheckBox mDisableAdpfDurationBox;
4341

4442
private Button mStartButton;
4543
private Button mStopButton;
@@ -81,8 +79,6 @@ protected void onCreate(Bundle savedInstanceState) {
8179
mEnableAdpfBox = findViewById(R.id.enable_adpf);
8280
mEnableAdpfWorkloadIncreaseBox = findViewById(R.id.enable_adpf_workload_increase);
8381
mHearWorkloadBox = findViewById(R.id.hear_workload);
84-
mHighPerformanceAudioBox = findViewById(R.id.high_performance_audio);
85-
mDisableAdpfDurationBox = findViewById(R.id.disable_adpf_duration);
8682

8783
mStartButton = findViewById(R.id.button_start_test);
8884
mStopButton = findViewById(R.id.button_stop_test);
@@ -111,12 +107,9 @@ public void startTest(View view) {
111107
boolean adpfEnabled = mEnableAdpfBox.isChecked();
112108
boolean adpfWorkloadIncreaseEnabled = mEnableAdpfWorkloadIncreaseBox.isChecked();
113109
boolean hearWorkload = mHearWorkloadBox.isChecked();
114-
boolean highPerformanceAudio = mHighPerformanceAudioBox.isChecked();
115-
boolean reportActualDurationDisabled = mDisableAdpfDurationBox.isChecked();
116110

117111
int result = start(targetDurationMs, numBursts, numVoices, alternateNumVoices,
118-
alternatingPeriodMs, adpfEnabled, adpfWorkloadIncreaseEnabled, hearWorkload,
119-
highPerformanceAudio, reportActualDurationDisabled);
112+
alternatingPeriodMs, adpfEnabled, adpfWorkloadIncreaseEnabled, hearWorkload);
120113
if (result != OPERATION_SUCCESS) {
121114
showErrorToast("start failed! Error:" + result);
122115
return;
@@ -151,8 +144,6 @@ public void enableParamsUI(boolean enabled) {
151144
mEnableAdpfBox.setEnabled(enabled);
152145
mEnableAdpfWorkloadIncreaseBox.setEnabled(enabled);
153146
mHearWorkloadBox.setEnabled(enabled);
154-
mHighPerformanceAudioBox.setEnabled(enabled);
155-
mDisableAdpfDurationBox.setEnabled(enabled);
156147
}
157148

158149
private void updateResultTextView() {
@@ -169,9 +160,7 @@ private void updateResultTextView() {
169160

170161
public native int start(int targetDurationMs, int numBursts, int numVoices,
171162
int alternateNumVoices, int alternatingPeriodMs, boolean adpfEnabled,
172-
boolean adpfWorkloadIncreaseEnabled, boolean hearWorkload,
173-
boolean highPerformanceAudio,
174-
boolean reportActualDurationDisabled);
163+
boolean adpfWorkloadIncreaseEnabled, boolean hearWorkload);
175164
public native boolean stopIfDone();
176165
public native String getStatus();
177166
public native int stop();

0 commit comments

Comments
 (0)