Browse Source

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.
jp9000 6 years ago
parent
commit
df5689d534
1 changed files with 2 additions and 1 deletions
  1. 2 1
      libobs/obs-output.c

+ 2 - 1
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)