Skip to content

Commit

Permalink
hello-oboe: fix latency supported logic
Browse files Browse the repository at this point in the history
It was turning off if the buffer size was changed.
  • Loading branch information
philburk authored and dturner committed Nov 26, 2020
1 parent 41b5733 commit aead33c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions samples/hello-oboe/src/main/cpp/HelloOboeEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ void HelloOboeEngine::setBufferSizeInBursts(int32_t numBursts) {
std::lock_guard<std::mutex> lock(mLock);
if (!mStream) return;

mIsLatencyDetectionSupported = false;
mLatencyCallback->setBufferTuneEnabled(numBursts == kBufferSizeAutomatic);
auto result = mStream->setBufferSizeInFrames(
numBursts * mStream->getFramesPerBurst());
Expand All @@ -87,19 +86,16 @@ void HelloOboeEngine::setBufferSizeInBursts(int32_t numBursts) {
}

void HelloOboeEngine::setAudioApi(oboe::AudioApi audioApi) {
mIsLatencyDetectionSupported = false;
mAudioApi = audioApi;
reopenStream();
}

void HelloOboeEngine::setChannelCount(int channelCount) {
mIsLatencyDetectionSupported = false;
mChannelCount = channelCount;
reopenStream();
}

void HelloOboeEngine::setDeviceId(int32_t deviceId) {
mIsLatencyDetectionSupported = false;
mDeviceId = deviceId;
if (reopenStream() != oboe::Result::OK) {
LOGW("Open stream failed, forcing deviceId to Unspecified");
Expand Down Expand Up @@ -152,6 +148,7 @@ oboe::Result HelloOboeEngine::start() {
mStream->getDeviceId());
} else {
LOGE("Error creating playback stream. Error: %s", oboe::convertToText(result));
mIsLatencyDetectionSupported = false;
}
return result;
}
Expand Down

0 comments on commit aead33c

Please sign in to comment.