Android Oboe: AudioDeviceManager not updated when connecting headphones

First of all, thanks for integrating Oboe. It has bumped performance of our android app after implementing stabilized callback. supercool!

But there is bug: available audio devices are not updating. I’m on Android 9, Samsung Galaxy Note 8.

When app is started without headset connected it is using speakers, and if I connect headset it is still playing thru speakers. If I start app with headphones already connected - it is using headphones. I’ve tried to use AudioDeviceManager’s change callback to catch headphones connection but it is never called. Then I placed timer tracking list of currently available devices:

const auto& deviceTypes =  audioDeviceManager.getAvailableDeviceTypes();
for (auto dt : deviceTypes)
    DBG ("Type " + dt->getTypeName() + " default - " + String(dt->getDefaultDeviceIndex(false)));
    const auto devices = dt->getDeviceNames();
    for (auto d : devices)
        DBG (d);

When headset is not connected:

Type Android Oboe default - 1
SM-N950F built-in earphone speaker
SM-N950F built-in speaker

And when i connect headphones it remains the same
Lets start app with headset already connected:

Type Android Oboe default - 2
SM-N950F built-in earphone speaker
SM-N950F built-in speaker
h2w wired headset

Moreover if app is running without headset, i can connect it and run any other app e.g Youtube and playback in my app will magically switch to headset.
Please help.

P.S. I’m surprised that audioDeviceManager.getAvailableDeviceTypes() forces closing of current AAudio stream and rebuilding new one. Is it normal behavior?

anyone else has this problem?


This sounds similar to

Please could you file an issue on the Oboe github site and we’ll investigate further there.

Thanks for looking into this. I saw this issue but its not the same behavior. It was year ago so i hoped it was fixed in the patch to Pie. So its more related to Oboe problem than to AudioDeviceManager class? I will create this topic on github