Skip to content

Conversation

@robertwu1
Copy link
Collaborator

@robertwu1 robertwu1 commented Nov 21, 2025

When using Oboe, apps can now see if the power HAL supports a special audio performance mode with ADPF and use it.

@robertwu1 robertwu1 changed the title WIP: Test potential APERF_HINT_HIGH_PERFORMANCE_AUDIO Add audio performance to AdpfWrapper Dec 17, 2025
@robertwu1 robertwu1 requested a review from flamme December 17, 2025 17:51
bool adpfEnabled,
bool adpfWorkloadIncreaseEnabled,
bool hearWorkload) {
int32_t targetDurationMs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all indents are changed? should be 8 spaces instead of 4.

std::shared_ptr<oboe::AudioStream> oboeStream = engine.getCurrentActivity()->getStream(streamIndex);
if (oboeStream != nullptr) {
oboe::PerformanceHintConfig cfg;
cfg.highPerformanceAudio = (highPerformance == JNI_TRUE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it is needed to compare to JNI_TRUE?

mNumVoicesSlider.getValue(), mAlternateNumVoicesSlider.getValue(),
mAlternatingPeriodMsSlider.getValue(), mEnableAdpfBox.isChecked(),
mEnableAdpfWorkloadIncreaseBox.isChecked(), mHearWorkloadBox.isChecked(),
mHighPerformanceAudioBox.isChecked(), reportActualDurationEnabled);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If adpf box is not checked, is reporting duration still needed?

// If the platform does not support the high-performance-audio APERF feature,
// hide or disable the UI control so users don't attempt to enable it.
boolean hpSupported = NativeEngine.isHighPerformanceAudioSupported();
if (!hpSupported && mHighPerformanceAudioBox != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: when will mHighPerformanceAudioBox be null?

android:layout_height="wrap_content"
android:layout_marginRight="8sp"
android:text="Hear Workload" />

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there are some common part of the UI can be extracted to a common class.

--ez use_workload {true, false} // if true and using ADPF then report workload changes. Default is false.
--ez scroll_graphics {true, false} // if true then continually update the power scope. Default is false.
--ez use_workload_increase_api {true, false} // if true and using ADPF, notify adpf with workload increase/reset apis. Default is false.
--ez use_high_performance_audio {true, false} // if true, request highPerformanceAudio in the performance hint session creation config. Default is false.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: do you also want the option for reporting duration?

--ez use_workload {true, false} // if true and using ADPF then report workload changes. Default is false.
--ez scroll_graphics {true, false} // if true then continually update the power scope. Default is false.
--ez use_workload_increase_api {true, false} // if true and using ADPF, notify adpf with workload increase/reset apis. Default is false.
--ez use_high_performance_audio {true, false} // if true, request highPerformanceAudio in the performance hint session creation config. Default is false.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the implementation of use_high_performance_audio, I cannot find it from the code.

}

void setReportActualDurationEnabled(bool enabled) override {
// Public API expects 'enabled'; internally we manage a 'disabled' flag.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of managing disable flag internally? This looks easily cause issue in the future because of inconsistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants