Oboe (AAudio) stream returning ErrorUnavailable on physical devices - Audio device issue?

493 Views Asked by At

Error in question:

AAudioStream_requestStart(s#1) returned -889 ---------
AudioEngine: Error starting stream. ErrorUnavailable

UPDATE: I have narrowed down this problem to physical devices, and there appears to be a condition for it's cause, but I have not found that yet. It happens rarely, so it's tough to pin down. So far I have noticed it to happen on a Pixel 3a and a Galaxy S9+.

I have been having this error occasionally, then It will go away, and I still have not found the solution to it or why it is happening. I have had a couple suspicions, but I have since proven them all false and I'm back to square one.

I have tried reproducing this via:

  • Turning on/off bluetooth (worked once, but can't reproduce)
  • connecting bluetooth headphones
  • connecting plug-in headphones
  • all of the above with app in focus, and when another app is loaded

To solve the issue, all I have to do is restart the physical device.

My Android Gradle Plugin is 4.0.1, and Gradle is 6.1.1 NDK Version: 21.0.6113669

My usage and setting up my audio stream:

AudioStreamBuilder builder;
builder.setCallback(this);
builder.setPerformanceMode(PerformanceMode::LowLatency);
builder.setSharingMode(SharingMode::Exclusive);
builder.setChannelCount(mChannelCount);

Result result = builder.openStream(&mStream);

if (result == Result::OK && mStream != nullptr) {
    // Grab stream info

    result = mStream->requestStart();
    if (result != Result::OK) {
        LOGE("AudioEngine: Error starting stream. %s", convertToText(result));
    }

    LOGD("AudioEngine: Starting Stream");
} else {
    LOGE("AudioEngine: Failed to create stream. Error: %s", convertToText(result));
}

Debug info:

I/AAudio: AAudioStreamBuilder_openStream() called ----------------------------------------
I/AudioStreamBuilder: rate   =      0, channels  = 2, format   = 0, sharing = EX, dir = OUTPUT
I/AudioStreamBuilder: device =      0, sessionId = -1, perfMode = 12, callback: ON with frames = 0
I/AudioStreamBuilder: usage  =      1, contentType = 2, inputPreset = 6, allowedCapturePolicy = 0
D/AudioStreamInternal_Client: open() original HW burst = 48, minMicros = 2000 => SW burst = 96
I/AAudio: AAudioStreamBuilder_openStream() returns 0 = AAUDIO_OK for s#1 ----------------
D/MyApp: AudioEngine: Sample Rate: 48000 FramesPerBurst: 96 BufferSize: 192
D/MyApp: AudioEngine: Channel count: 2 Format: Float Direction: Output
D/MyApp: AudioEngine: Current Buffer Size: 288 BufferCapacity: 3072 SharingMode: Exclusive PerformanceMode: LowLatency
D/AAudio: AAudioStream_requestStart(s#1) called --------------
D/AAudio: AAudioStream_requestStart(s#1) returned -889 ---------
E/MyApp: AudioEngine: Error starting stream. ErrorUnavailable

My suspicion is that since I do not programmatically define the playback method (headphones, speakers, bluetooth, etc), this happens occationally, but I currently cannot confirm this or know if this is in fact the issue.

0

There are 0 best solutions below