diff options
author | wm4 <wm4@nowhere> | 2020-06-09 16:49:05 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-06-09 16:49:05 +0200 |
commit | d5de79d10f895aaa8f65340adf949d28bc09b2d7 (patch) | |
tree | 5dfa06599d2d3925d1cd5efd4fd78159e1fb59d7 /audio | |
parent | 0fb02f181f3df9e8336939b42c3412e01fb60427 (diff) | |
download | mpv-d5de79d10f895aaa8f65340adf949d28bc09b2d7.tar.bz2 mpv-d5de79d10f895aaa8f65340adf949d28bc09b2d7.tar.xz |
audio: require certain AOs to set device_buffer
AOs which use the "push" API must set this field now. Actually, this was
sort of always required, but happened to work anyway. The future
intention is to use device_buffer as the pre-buffer amount, which has to
be available right before audio playback is started. "Pull" AOs really
need this too conceptually, just that the API is underspecified.
From what I can see, only ao_null did not do this yet.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao.c | 2 | ||||
-rw-r--r-- | audio/out/ao_null.c | 4 |
2 files changed, 3 insertions, 3 deletions
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; |