Update the android sdk build tools from 27.0.3 to 28.0.1, bringing
in d8 which is replacing dx.
This needs an update of the Docker image, so run scripts/update-docker.sh
to update it.
Turns out it's pretty easy to implement. Now the buffer queue will
stop requesting for data once the sink is suspended on idle. No
more power wasted.
Note that it is natural that there would be a bit of extra delay
when resume playback after the sink is suspended. In case it is
wanted to be avoided, make sure the module-suspend-on-idle is not
loaded.
This should work way better than the old code, as it makes use of
the buffer queue callback to do Enqueue(), which might be the only
nice/right way to use OpenSLES on Android. CPU usage is low and
RAM usage seems reasonable. No memory leak noticed. Tested with
mpv on my Oreo phone (wired and Bluetooth).
The latency was chosen base on Bluetooth audio requirement on Oreo.
Shouldn't be hard to make it configurable as a module param in the
future.
The new code has a known downside though, that is it doesn't really
support sink suspension, as in, silence will kept being written
to the audio device even when the sink is suspended, which may have
certain impact to battery time.
It's probably possible to catch the state change of the sink and
notify the buffer queue about it. It's just I don't want to bother
digging further at the moment.
The hack should no longer be necessary, as 0.29.0 includes a few
commits from me that makes the opensles output driver work more
properly.
Also include an extra patch that allows the buffer size to either
be increased and decreased (and done more properly).