diff options
author | Deal(一线灵) <[email protected]> | 2023-05-26 00:23:24 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-25 16:23:24 +0000 |
commit | 68908eebbec50ed8f4343f93fd8cd52427ea7ca8 (patch) | |
tree | b26b51e73276ac4a3a2107855cd1a2db781016b3 /alc/backends/oboe.cpp | |
parent | c7109d88f425a033f065421545430b7f450ce869 (diff) |
Improve oboe backend (#848)
* Improve oboe backend
This change should handle handphone call event properly and fix crash at stop (because the mStream was disconnected by system when handphone call income)
* Invoke mDevice->handleDisconnect when AAudio stream disconnected
Diffstat (limited to 'alc/backends/oboe.cpp')
-rw-r--r-- | alc/backends/oboe.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/alc/backends/oboe.cpp b/alc/backends/oboe.cpp index c74b0180..01d6fb85 100644 --- a/alc/backends/oboe.cpp +++ b/alc/backends/oboe.cpp @@ -5,7 +5,6 @@ #include <cassert> #include <cstring> -#include <mutex> #include <stdint.h> #include "alnumeric.h" @@ -29,6 +28,8 @@ struct OboePlayback final : public BackendBase, public oboe::AudioStreamCallback oboe::DataCallbackResult onAudioReady(oboe::AudioStream *oboeStream, void *audioData, int32_t numFrames) override; + void onErrorAfterClose(oboe::AudioStream* /* audioStream */, oboe::Result /* error */) override; + void open(const char *name) override; bool reset() override; void start() override; @@ -47,6 +48,13 @@ oboe::DataCallbackResult OboePlayback::onAudioReady(oboe::AudioStream *oboeStrea return oboe::DataCallbackResult::Continue; } +void OboePlayback::onErrorAfterClose(oboe::AudioStream* audioStream, oboe::Result error) +{ + if (error == oboe::Result::ErrorDisconnected) { + mDevice->handleDisconnect("Oboe AudioStream was disconnected: %s", oboe::convertToText(error)); + } + TRACE("Error was %s", oboe::convertToText(error)); +} void OboePlayback::open(const char *name) { |