From aead33ce858a4a90e834eaab5d9cfe83fafc40d6 Mon Sep 17 00:00:00 2001 From: Phil Burk Date: Wed, 25 Nov 2020 13:47:48 -0800 Subject: [PATCH] hello-oboe: fix latency supported logic It was turning off if the buffer size was changed. --- samples/hello-oboe/src/main/cpp/HelloOboeEngine.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/samples/hello-oboe/src/main/cpp/HelloOboeEngine.cpp b/samples/hello-oboe/src/main/cpp/HelloOboeEngine.cpp index 66aaaf69d..1fa06ea22 100644 --- a/samples/hello-oboe/src/main/cpp/HelloOboeEngine.cpp +++ b/samples/hello-oboe/src/main/cpp/HelloOboeEngine.cpp @@ -75,7 +75,6 @@ void HelloOboeEngine::setBufferSizeInBursts(int32_t numBursts) { std::lock_guard lock(mLock); if (!mStream) return; - mIsLatencyDetectionSupported = false; mLatencyCallback->setBufferTuneEnabled(numBursts == kBufferSizeAutomatic); auto result = mStream->setBufferSizeInFrames( numBursts * mStream->getFramesPerBurst()); @@ -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"); @@ -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; }