ao_audiotrack: don't ignore ao_read_data return value

The difference this makes is that the OS API will notice
when we underrun (as opposed to being fed silence).
Other AOs mostly seem to not do this because they've committed
to filling a buffer of a certain size no matter what, but I have
not observed any ill effects for AudioTrack in my testing.
This commit is contained in:
sfan5 2023-08-06 16:57:26 +02:00
parent 8b7904618e
commit 9faf9932a4
1 changed files with 1 additions and 2 deletions

View File

@ -575,8 +575,7 @@ static void *playthread(void *arg)
ts += (read_samples / (double)(ao->samplerate)) * 1e6;
ts += AudioTrack_getLatency(ao) * 1e6;
int samples = ao_read_data(ao, &p->chunk, read_samples, ts);
int write_samples = read_samples;
int ret = AudioTrack_write(ao, write_samples * ao->sstride);
int ret = AudioTrack_write(ao, samples * ao->sstride);
if (ret >= 0) {
p->written_frames += ret / ao->sstride;
} else if (ret == AudioManager.ERROR_DEAD_OBJECT) {