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:
parent
008e38f5b6
commit
5b20942247
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user