API changes
New callback classes
Added new classes AudioStreamDataCallback
and AudioStreamErrorCallback
. These classes replace AudioStreamCallback
which is now deprecated. The new callback classes separate the responsibilities of data handling and error handling.
Additionally, AudioStreamErrorCallback
includes a new onError
method. This allows you to override the default error handling and stop/close the audio stream yourself. More details.
New features
- Channel count conversion. Oboe now includes a
ChannelCountConverter
. This is part of theflowgraph
library. It can be used directly for performing channel count conversion. Internally this class is used to handle situations where opening a stream with a specific channel count results in suboptimal performance. For example, some devices cannot obtain a low latency mono input stream so Oboe opens the stream in stereo and performs a seamless stereo->mono conversion for the application. [commit, PR] - Set a minimum buffer size for LatencyTuner. Added method
LatencyTuner::setMinimumBufferSize
which allows you to set the minimum buffer size in frames. This stops the LatencyTuner from reducing the buffer size below a user-defined threshold. Note that the value specified for the minimum buffer size should be an integer multiple of the burst size. [PR]
Bug fixes / workarounds
- If you attempt to open an AAudio input stream without the relevant permission Oboe will now output a more useful error message. [commit]
- Fixed a race condition that could cause a crash during close() if a callback was still running. [PR]
- Fixed an issue with the sample rate converter which could cause input streams using callbacks to stall. [issue, commit]
- Fixed several crashes associated with using
setFramesPerCallback
. [commit] - Fixed a bug that could cause
stop()
of an OpenSL ES stream with a non-zero timeout value to spin forever. [original issue] - In cases where the
VoicePerformance
input preset is not supported (OpenSL ES and Android P and below) Oboe will use theVoiceRecognition
preset instead. [commit, commit] - In Android RQ1A a regression was introduced which meant that when a stream disconnects (e.g. headphones unplugged) a TIMEOUT error code was supplied rather than the expected DISCONNECT. This only affects SHARED AAudio MMAP streams. Oboe works around this by returning a DISCONNECT error code if a TIMEOUT error code is received on RQ1A. [commit]
- Fixed a potential race condition when closing an OpenSL ES stream. [PR]
- Fixed a problem where AAudio might accidentally call the flowgraph units in Oboe instead of in AAudio. [PR]
- Added a workaround for broken mono recording on Samsung S9. [PR]
Documentation and samples updates
- [docs] Added the OpenSL ES migration guide.
- [all samples] Standardise package name to
com.google.oboe.samples
- [hello-oboe] Save user settings, use shared stream, use locks to prevent race conditions [commit]
- [RhythmGame] Updates to the FFmpeg extractor and decoder [commit, commit]
- [DrumThumper] Audio is resampled on app load to avoid resampling penalty during playback [commit]
- [DrumThumper] App is now published on Play Store.
- [parselib] Fixed a problem with parsing unexpected chunks in a WAV file. [issue]
- [OboeTester] can now print a device and microphone report.
All commits since 1.4.3: 1.4.3...1.5.0
How to update existing code
On previous version of Oboe you implement AudioStreamCallback
and override onAudioReady
for data handling and the onError*
methods for error handling.
In Oboe 1.5 data callbacks and error callbacks have been split into 2 separate classes. To migrate your code, create an AudioStreamDataCallback
and an AudioStreamErrorCallback
. Then copy the code from your existing AudioStreamCallback
implementation to the new methods, as per the following table:
Deprecated method | New method |
AudioStreamCallback::onAudioReady
| AudioStreamDataCallback::onAudioReady
|
AudioStreamCallback::onErrorBeforeClose
| AudioStreamErrorCallback::onErrorBeforeClose
|
AudioStreamCallback::onErrorAfterClose
| AudioStreamErrorCallback::onErrorAfterClose
|
Corresponding setDataCallback
and setErrorCallback
methods have been added to AudioStreamBuilder
and you must use these in place of setCallback
.
The term "callback" within Oboe is now ambiguous so the following methods have been renamed to refer specifically to the data callback. If you're using any *FramesPerCallback
methods, you should use the new methods instead.
Deprecated method | New method |
AudioStreamBuilder::setFramesPerCallback
| AudioStreamBuilder::setFramesPerDataCallback
|
AudioStream::getFramesPerCallback
| AudioStream::setFramesPerDataCallback
|
For further guidance take a look at this PR which updates the Oboe sample code.