0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00
mpv/audio/out
Tom Yan 14b429de8d ao_opensles: bump device buffer size to 250ms
Although half (non-fast track on sink rate) or one-third (non-fast track not on sink rate) of the buffer size of the created AudioTrack instance as the SL Enqueue buffer size is basically enough for dropout-free playback, only using the full size can avoid stutter upon (re)start of playback.

Here are the various buffer sizes on different track/sink rate when on Bluetooth audio on Android O:

aptX @ 48kHz:
Sink rate: 48000 Hz
44100 Hz: 10632 frames (241.09 ms)
48000 Hz: 11544 frames (240.50 ms)
88200 Hz: 21216 frames (240.54 ms)
96000 Hz: 23088 frames (240.50 ms)
176400 Hz: 42384 frames (240.27 ms)
192000 Hz: 46128 frames (240.25 ms)

SBC/AAC/aptX @ 44.1kHz:
Sink rate: 44100 Hz
44100 Hz: 10776 frames (244.35 ms)
48000 Hz: 11748 frames (244.75 ms)
88200 Hz: 21552 frames (244.35 ms)
96000 Hz: 23448 frames (244.25 ms)
176400 Hz: 43056 frames (244.08 ms)
192000 Hz: 46848 frames (244.00 ms)

The above results were produced with the following code:

import android.media.AudioAttributes;
import android.media.AudioFormat;
import android.media.AudioTrack;

class AudioInfo {
    public static void main(String[] args) {
	int nosr = AudioTrack.getNativeOutputSampleRate(3);
	System.out.printf("Sink rate: %d Hz\n", nosr);

	int[] rates = {44100,48000,88200,96000,176400,192000};
	for (int rate: rates) {
	    AudioAttributes aa = new AudioAttributes.Builder().setFlags(256).build();
	    AudioFormat af = new AudioFormat.Builder().setSampleRate(rate).build();
	    AudioTrack at = new AudioTrack(aa, af, 4, 1, 0);
	    int sr = at.getSampleRate();
	    int bs = at.getBufferSizeInFrames();
	    float ms = bs * (float) 1000 / sr;
	    at.release();
	    System.out.printf("%d Hz: %d frames (%.2f ms)\n", sr, bs, ms);
	}
    }
}

Therefore bumping the device buffer size to 250ms.
2018-04-05 04:35:49 +03:00
..
ao_alsa.c ao_alsa: reduce verbosity at -v 2018-01-25 20:18:32 -08:00
ao_audiounit.m ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio_chmap.c audio/out: add AudioUnit output driver for iOS 2016-11-01 16:25:40 +01:00
ao_coreaudio_chmap.h audio/out: add AudioUnit output driver for iOS 2016-11-01 16:25:40 +01:00
ao_coreaudio_exclusive.c ao_coreaudio: insane hack for passing through AC3 as float PCM 2017-06-30 09:06:01 +02:00
ao_coreaudio_properties.c ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio_properties.h ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio_utils.c ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio_utils.h ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio.c ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_jack.c Add checks for HAVE_GPL to various GPL-only source files 2017-10-10 15:51:16 +02:00
ao_lavc.c audio: fix annyoing af_get_best_sample_formats() definition 2018-01-25 20:18:32 -08:00
ao_null.c ao_null: add --ao-null-format option for debugging 2018-01-30 03:10:27 -08:00
ao_openal.c audio: fix annyoing af_get_best_sample_formats() definition 2018-01-25 20:18:32 -08:00
ao_opensles.c ao_opensles: bump device buffer size to 250ms 2018-04-05 04:35:49 +03:00
ao_oss.c audio: fix annyoing af_get_best_sample_formats() definition 2018-01-25 20:18:32 -08:00
ao_pcm.c ao_pcm: drop AF_FORMAT_S24 usage 2017-07-07 17:56:18 +02:00
ao_pulse.c ao_pulse: reorder format choice 2017-06-23 21:12:44 +02:00
ao_rsound.c ao_rsound: allow setting the host 2017-08-21 15:46:00 +02:00
ao_sdl.c ao_sdl: fix default buffer size 2018-03-08 17:12:32 -08:00
ao_sndio.c ao_sndio: drop AF_FORMAT_S24 usage 2017-07-07 17:56:18 +02:00
ao_wasapi_changenotify.c ao_wasapi_changenotify: use %ls instead of %S for wchar_t 2017-04-20 07:38:03 +02:00
ao_wasapi_utils.c audio: fix annyoing af_get_best_sample_formats() definition 2018-01-25 20:18:32 -08:00
ao_wasapi.c ao_wasapi: return bool instead of HRESULT from thread_init 2017-08-07 14:33:03 -07:00
ao_wasapi.h ao_wasapi: reorganize wasapi.h 2017-08-07 14:33:03 -07:00
ao.c ao: do not allow actual buffer size of 0 2018-03-08 17:12:32 -08:00
ao.h audio: add audio softvol processing to AO 2017-11-29 21:30:51 +01:00
internal.h ao: simplify hack for float atomics 2017-11-30 01:20:03 +01:00
pull.c audio: add audio softvol processing to AO 2017-11-29 21:30:51 +01:00
push.c Fix various typos in log messages 2017-12-03 21:24:18 +01:00