diff --git a/audio/out/ao.c b/audio/out/ao.c index 9ac42806e4..32ffc3d82d 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -236,7 +236,7 @@ static struct ao *ao_init(bool probing, struct mpv_global *global, } ao->bps = ao->samplerate * ao->sstride; - if (ao->device_buffer < 0 && ao->driver->write) { + if (ao->device_buffer <= 0 && ao->driver->write) { MP_ERR(ao, "Device buffer size not set.\n"); goto fail; } diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index ac113ca186..2f58ea22c3 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -105,7 +105,7 @@ static int init(struct ao *ao) // A "buffer" for this many seconds of audio int bursts = (int)(ao->samplerate * priv->bufferlen + 1) / priv->outburst; - priv->buffersize = priv->outburst * bursts + priv->latency; + ao->device_buffer = priv->outburst * bursts + priv->latency; priv->last_time = mp_time_sec(); @@ -175,7 +175,7 @@ static void get_state(struct ao *ao, struct mp_pcm_state *state) drain(ao); - state->free_samples = priv->buffersize - priv->latency - priv->buffered; + state->free_samples = ao->device_buffer - priv->latency - priv->buffered; state->free_samples = state->free_samples / priv->outburst * priv->outburst; state->queued_samples = priv->buffered;