p***@audiokinetic.com
2018-10-12 19:16:10 UTC
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
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.
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.