win-wasapi: Subtract frame duration from timestamp

It would appear that the timestamp values returned by devices are not
perfectly accurate, and in some cases may be calculated on the spot --
to combat that, it's best to subtract the audio segment's duration from
the current audio segment's timestamp to ensure the timing is as
accurate as possible.
This commit is contained in:
jp9000 2017-09-28 06:26:41 -07:00
parent 008e38f5b6
commit 5b20942247

View File

@ -421,6 +421,9 @@ bool WASAPISource::ProcessCaptureData()
data.timestamp = useDeviceTiming ?
ts*100 : os_gettime_ns();
data.timestamp -= (uint64_t)frames * 1000000000ULL /
(uint64_t)sampleRate;
obs_source_output_audio(source, &data);
capture->ReleaseBuffer(frames);