diff options
author | sfan5 <sfan5@live.de> | 2023-08-06 16:57:26 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-08-08 20:15:20 +0200 |
commit | 9faf9932a48d6ff52493eee9d58672d17269bbd0 (patch) | |
tree | 2de777771a59afdd74779792a8ffe0b04877a573 /audio/out/ao_audiotrack.c | |
parent | 8b7904618e159593c35fea91c49c6b973e4b5a3e (diff) | |
download | mpv-9faf9932a48d6ff52493eee9d58672d17269bbd0.tar.bz2 mpv-9faf9932a48d6ff52493eee9d58672d17269bbd0.tar.xz |
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.
Diffstat (limited to 'audio/out/ao_audiotrack.c')
-rw-r--r-- | audio/out/ao_audiotrack.c | 3 |
1 files changed, 1 insertions, 2 deletions
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) { |