Discussion:
AAudio AAUDIO_ERROR_DISCONNECTED not always firing?
(too old to reply)
p***@audiokinetic.com
2018-10-12 19:16:10 UTC
Permalink
Hello,

I am currently implementing an AAudio sink for Android in a native
application. Everything is going great, but I noticed a bug: when
unplugging wired headphones, my error callback function is not reliably
being called back for the AAUDIO_ERROR_DISCONNECTED event.

It only fires perhaps once in 7 or 8 attempts. However, when I plug the
headphones back in, the event *always *fires. I suspect that it has to do
with the way the plug physically twists in the jack before yanking out...

I tried polling the audio stream regularly using AAudioStream_getState() in
my main loop, but it reports the PLAYING state even though the headphones
are disconnected.

I need this event to fire reliably so that I can reset the audio stream and
resume playing on the new default output device (the phone's speakers).

I am testing using a Pixel phone, upgraded to Android 9.0. I tried two
different headphones and the result is the same.

Is there a known workaround for this problem? Am I doing something wrong?

Thanks in advance,

Philippe Milot
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/0ee99f3e-c32e-47cf-bb17-995054c8e01c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Phil Burk' via android-ndk
2018-10-15 17:26:49 UTC
Permalink
Yes. That was a regression in Pie. Internal bug number b/111711159
It affects Pixel phones running Pie in AAudio Low Latency mode. Sorry about
that.

It was fixed too late for the normal Pie release but will go into a future
update.
There is no known workaround.

BTW, we recommend coding to Oboe instead of AAudio directly. It is a thin
wrapper over AAudio that falls back to OpenSL ES on older devices. Oboe
includes workarounds for version specific bugs if possible.

https://github.com/google/oboe

Phil Burk
Post by p***@audiokinetic.com
Hello,
I am currently implementing an AAudio sink for Android in a native
application. Everything is going great, but I noticed a bug: when
unplugging wired headphones, my error callback function is not reliably
being called back for the AAUDIO_ERROR_DISCONNECTED event.
It only fires perhaps once in 7 or 8 attempts. However, when I plug the
headphones back in, the event *always *fires. I suspect that it has to do
with the way the plug physically twists in the jack before yanking out...
I tried polling the audio stream regularly using AAudioStream_getState()
in my main loop, but it reports the PLAYING state even though the
headphones are disconnected.
I need this event to fire reliably so that I can reset the audio stream
and resume playing on the new default output device (the phone's speakers).
I am testing using a Pixel phone, upgraded to Android 9.0. I tried two
different headphones and the result is the same.
Is there a known workaround for this problem? Am I doing something wrong?
Thanks in advance,
Philippe Milot
--
You received this message because you are subscribed to the Google Groups
"android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-ndk/0ee99f3e-c32e-47cf-bb17-995054c8e01c%40googlegroups.com
<https://groups.google.com/d/msgid/android-ndk/0ee99f3e-c32e-47cf-bb17-995054c8e01c%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CACL%3DQ7zB1RhAy94inUCZ3y_8wN7gBeVU0vNknoLqVuPPj1VcZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Philippe Milot
2018-10-16 13:52:23 UTC
Permalink
I see. I guess I'll just have to wait it out. Thank you for your help!

On Mon, Oct 15, 2018 at 1:27 PM 'Phil Burk' via android-ndk <
Post by 'Phil Burk' via android-ndk
Yes. That was a regression in Pie. Internal bug number b/111711159
It affects Pixel phones running Pie in AAudio Low Latency mode. Sorry
about that.
It was fixed too late for the normal Pie release but will go into a future
update.
There is no known workaround.
BTW, we recommend coding to Oboe instead of AAudio directly. It is a thin
wrapper over AAudio that falls back to OpenSL ES on older devices. Oboe
includes workarounds for version specific bugs if possible.
https://github.com/google/oboe
Phil Burk
Post by p***@audiokinetic.com
Hello,
I am currently implementing an AAudio sink for Android in a native
application. Everything is going great, but I noticed a bug: when
unplugging wired headphones, my error callback function is not reliably
being called back for the AAUDIO_ERROR_DISCONNECTED event.
It only fires perhaps once in 7 or 8 attempts. However, when I plug the
headphones back in, the event *always *fires. I suspect that it has to
do with the way the plug physically twists in the jack before yanking out...
I tried polling the audio stream regularly using AAudioStream_getState()
in my main loop, but it reports the PLAYING state even though the
headphones are disconnected.
I need this event to fire reliably so that I can reset the audio stream
and resume playing on the new default output device (the phone's speakers).
I am testing using a Pixel phone, upgraded to Android 9.0. I tried two
different headphones and the result is the same.
Is there a known workaround for this problem? Am I doing something wrong?
Thanks in advance,
Philippe Milot
--
You received this message because you are subscribed to the Google Groups
"android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-ndk/0ee99f3e-c32e-47cf-bb17-995054c8e01c%40googlegroups.com
<https://groups.google.com/d/msgid/android-ndk/0ee99f3e-c32e-47cf-bb17-995054c8e01c%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the
Google Groups "android-ndk" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/android-ndk/OwAZc8g0Y4s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-ndk/CACL%3DQ7zB1RhAy94inUCZ3y_8wN7gBeVU0vNknoLqVuPPj1VcZQ%40mail.gmail.com
<https://groups.google.com/d/msgid/android-ndk/CACL%3DQ7zB1RhAy94inUCZ3y_8wN7gBeVU0vNknoLqVuPPj1VcZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAHztrxBvy40zy9zDgc5PTaaBF_HnMyddLh%3D8vsqSq-L%3DcZtX_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...