summaryrefslogtreecommitdiffstats
path: root/audio/out/ao.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-08-29 16:27:56 +0200
committerwm4 <wm4@nowhere>2020-08-29 16:27:56 +0200
commit478d39c57492107ce8d5a33e80d5624db330ceab (patch)
tree71c4cd38145f5256fdbfd06403fbd8da7a988c14 /audio/out/ao.c
parent3427aa4776b73ce0b9c8996bc4ef38da87fe1557 (diff)
downloadmpv-478d39c57492107ce8d5a33e80d5624db330ceab.tar.bz2
mpv-478d39c57492107ce8d5a33e80d5624db330ceab.tar.xz
audio: fix inefficient behavior with ao_alsa, remove period_size field
It is now the AO's responsibility to handle period size alignment. The ao->period_size alignment field is unused as of the recent audio refactor commit. Remove it. It turns out that ao_alsa shows extremely inefficient behavior as a consequence of the removal of period size aligned writes in the mentioned refactor commit. This is because it could get into a state where it repeatedly wrote single samples (as small as 1 sample), and starved the rest of the player as a consequence. Too bad. Explicitly align the size in ao_alsa. Other AOs, which need this, should do the same. One reason why it broke so badly with ao_alsa was that it retried the write() even if all reported space could be written. So stop doing that too. Retry the write only if we somehow wrote less. I'm not sure about ao_pulse.
Diffstat (limited to 'audio/out/ao.c')
-rw-r--r--audio/out/ao.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index 32ffc3d82d..52a38b63be 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -204,8 +204,6 @@ static struct ao *ao_init(bool probing, struct mpv_global *global,
init_buffer_pre(ao);
- ao->period_size = 1;
-
int r = ao->driver->init(ao);
if (r < 0) {
// Silly exception for coreaudio spdif redirection
@@ -222,11 +220,6 @@ static struct ao *ao_init(bool probing, struct mpv_global *global,
}
ao->driver_initialized = true;
- if (ao->period_size < 1) {
- MP_ERR(ao, "Invalid period size set.\n");
- goto fail;
- }
-
ao->sstride = af_fmt_to_bytes(ao->format);
ao->num_planes = 1;
if (af_fmt_is_planar(ao->format)) {