diff options
author | Aman Karmani <aman@tmm1.net> | 2021-10-19 14:27:37 -0700 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-10-21 17:20:51 +0200 |
commit | fa691e0f694b6d541a2b86f3866cfd2985358adf (patch) | |
tree | 697da907c81743da7cb925f2401e3a65b27d5d4f | |
parent | 6473711dce3b85012298842445595035865dcaec (diff) | |
download | mpv-fa691e0f694b6d541a2b86f3866cfd2985358adf.tar.bz2 mpv-fa691e0f694b6d541a2b86f3866cfd2985358adf.tar.xz |
ao_audiotrack: allocate chunk buffer based on negotiated size
Signed-off-by: Aman Karmani <aman@tmm1.net>
-rw-r--r-- | audio/out/ao_audiotrack.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/out/ao_audiotrack.c b/audio/out/ao_audiotrack.c index 16f8a67223..3ddd559ffe 100644 --- a/audio/out/ao_audiotrack.c +++ b/audio/out/ao_audiotrack.c @@ -720,8 +720,6 @@ static int init(struct ao *ao) MP_FATAL(ao, "AudioTrack.getMinBufferSize returned an invalid size: %d", buffer_size); return -1; } - p->chunksize = buffer_size; - p->chunk = malloc(buffer_size); int min = 0.200 * p->samplerate * af_fmt_to_bytes(ao->format); int max = min * 3 / 2; @@ -729,6 +727,9 @@ static int init(struct ao *ao) MP_VERBOSE(ao, "Setting bufferSize = %d (driver=%d, min=%d, max=%d)\n", p->size, buffer_size, min, max); ao->device_buffer = p->size / af_fmt_to_bytes(ao->format); + p->chunksize = p->size; + p->chunk = malloc(p->size); + jobject timestamp = MP_JNI_NEW(AudioTimestamp.clazz, AudioTimestamp.ctor); if (!timestamp || MP_JNI_EXCEPTION_LOG(ao) < 0) { MP_FATAL(ao, "AudioTimestamp could not be created\n"); |