Open thewierdnut opened 3 months ago
When playback starts, the android implementation sets a playback_started
flag, and then clears it when playback is stopped. When it sends AudioControlPoint messages, it sets a command_acked
flag to false
, and then sets it to true
when it gets the AudioStatus notification.
When it receives audio, it checks that both command_acked
and playback_started
are true. If they are not, then it just drops the audio. This means that when shutting down, it sets playback_started
and command_acked
to false, but it never ends up checking command_acked
for anything.
This doesn't match the behavior as specified in the spec, but hearing device manufacturers will have tested against the android code, so I would trust it better than the spec.
I suspect that you won't be able to drive your state machine using the status notifications. Instead, you should be able to use it to determine if the audio device is ready to receive data after the AudioControlPoint start has been sent.
As a reference point. I think I saw that my Oticon More did send an AudioStatus notification on stop.
I've gotten my (unrelated) asha implementation working using the suggested design.
When testing e303de8 on the asha-support branch, I run simple-asha, and I hear audio just fine. After hitting Ctrl-C, it waits for about 20 seconds or so before apparently timing out and quitting with this exception:
I can see the ACP stop command being sent, but it is not followed by an AudioStatus notification as expected. This may be behavior specific to my starkey hearing aids.
Here are the bluetoothd logs and btmon captures: shutdown_delay.zip
Of note: