From df5689d534e747fb4e4fa5ee51cb7c0d2008dcf7 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 31 Aug 2019 00:52:36 -0700 Subject: [PATCH] libobs: Give a little extra time for pause to start/stop Audio latency can get really low, and if it's low enough, the timestamp can be passed by the audio subsystem before it's had a chance to pause with it. So instead, make the pause have a little bit of extra delay to ensure that doesn't occur. --- libobs/obs-output.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libobs/obs-output.c b/libobs/obs-output.c index 03f11bfe1..0f77a9877 100644 --- a/libobs/obs-output.c +++ b/libobs/obs-output.c @@ -541,10 +541,11 @@ static inline void end_pause(struct pause_data *pause, uint64_t ts) static inline uint64_t get_closest_v_ts(struct pause_data *pause) { uint64_t interval = obs->video.video_frame_interval_ns; + uint64_t i2 = interval * 2; uint64_t ts = os_gettime_ns(); return pause->last_video_ts + - ((ts - pause->last_video_ts + interval) / interval) * interval; + ((ts - pause->last_video_ts + i2) / interval) * interval; } static bool obs_encoded_output_pause(obs_output_t *output, bool pause)