From 9faf9932a48d6ff52493eee9d58672d17269bbd0 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 6 Aug 2023 16:57:26 +0200 Subject: 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. --- audio/out/ao_audiotrack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'audio/out') diff --git a/audio/out/ao_audiotrack.c b/audio/out/ao_audiotrack.c index e008b53e17..a66dbbeec8 100644 --- a/audio/out/ao_audiotrack.c +++ b/audio/out/ao_audiotrack.c @@ -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) { -- cgit v1.2.3