Skip to content

Commit

Permalink
AdpfWrapper should use CLOCK_MONOTONIC instead of CLOCK_REALTIME
Browse files Browse the repository at this point in the history
There doesn't seem to be any upsides in using CLOCK_REALTIME over CLOCK_MONOTONIC in AdpfWrapper.cpp. Since the rest of the Oboe codebase uses CLOCK_MONOTONIC, we should also use it here.
  • Loading branch information
robertwu1 authored Jan 22, 2025
1 parent 71d6185 commit 043291b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/AdpfWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ void AdpfWrapper::close() {

void AdpfWrapper::onBeginCallback() {
if (isOpen()) {
mBeginCallbackNanos = oboe::AudioClock::getNanoseconds(CLOCK_REALTIME);
mBeginCallbackNanos = oboe::AudioClock::getNanoseconds();
}
}

void AdpfWrapper::onEndCallback(double durationScaler) {
if (isOpen()) {
int64_t endCallbackNanos = oboe::AudioClock::getNanoseconds(CLOCK_REALTIME);
int64_t endCallbackNanos = oboe::AudioClock::getNanoseconds();
int64_t actualDurationNanos = endCallbackNanos - mBeginCallbackNanos;
int64_t scaledDurationNanos = static_cast<int64_t>(actualDurationNanos * durationScaler);
reportActualDuration(scaledDurationNanos);
Expand Down

0 comments on commit 043291b

Please sign in to comment.