diff options
author | Dudemanguy <random342@airmail.cc> | 2023-10-11 13:45:40 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-16 15:38:59 +0000 |
commit | 50025428b17e82c9689dab82fcd0486648c4a9fd (patch) | |
tree | f9039f4110dd54be060b5e7ef4ef3131be0a3e32 /audio/out/ao_audiotrack.c | |
parent | d310430332b9c7dbedf28398b7018364401d327d (diff) | |
download | mpv-50025428b17e82c9689dab82fcd0486648c4a9fd.tar.bz2 mpv-50025428b17e82c9689dab82fcd0486648c4a9fd.tar.xz |
ao: convert all timing code to nanoseconds
Pull AOs work off of a callback that relies on mpv's internal timer. So
like with the related video changes, convert all of these to nanoseconds
instead. In many cases, the underlying audio API does actually provide
nanosecond resolution as well.
Diffstat (limited to 'audio/out/ao_audiotrack.c')
-rw-r--r-- | audio/out/ao_audiotrack.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/audio/out/ao_audiotrack.c b/audio/out/ao_audiotrack.c index 3fd68e5783..9620e45bd6 100644 --- a/audio/out/ao_audiotrack.c +++ b/audio/out/ao_audiotrack.c @@ -563,9 +563,9 @@ static void *playthread(void *arg) } if (state == AudioTrack.PLAYSTATE_PLAYING) { int read_samples = p->chunksize / ao->sstride; - int64_t ts = mp_time_us(); - ts += (read_samples / (double)(ao->samplerate)) * 1e6; - ts += AudioTrack_getLatency(ao) * 1e6; + int64_t ts = mp_time_ns(); + ts += MP_TIME_S_TO_NS(read_samples / (double)(ao->samplerate)); + ts += MP_TIME_S_TO_NS(AudioTrack_getLatency(ao)); int samples = ao_read_data(ao, &p->chunk, read_samples, ts); int ret = AudioTrack_write(ao, samples * ao->sstride); if (ret >= 0) { |