Преглед на файлове

obs-ffmpeg: Fix unpause causing certain encoders to fail

Due to the timeout detection, we need to factor in the current pause
offset to prevent pause from affecting the timeout.

Closes obsproject/obs-studio#7313
jp9000 преди 3 години
родител
ревизия
30463ba91c
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      plugins/obs-ffmpeg/obs-ffmpeg-video-encoders.c

+ 3 - 1
plugins/obs-ffmpeg/obs-ffmpeg-video-encoders.c

@@ -221,6 +221,8 @@ bool ffmpeg_video_encode(struct ffmpeg_video_encoder *enc,
 	AVPacket av_pkt = {0};
 	bool timeout = false;
 	const int64_t cur_ts = (int64_t)os_gettime_ns();
+	const int64_t pause_offset =
+		(int64_t)obs_encoder_get_pause_offset(enc->encoder);
 	int got_packet;
 	int ret;
 
@@ -270,7 +272,7 @@ bool ffmpeg_video_encode(struct ffmpeg_video_encoder *enc,
 		debug("cur: %lld, packet: %lld, diff: %lld", cur_ts,
 		      recv_ts_nsec, cur_ts - recv_ts_nsec);
 #endif
-		if ((cur_ts - recv_ts_nsec) > TIMEOUT_MAX_NSEC) {
+		if ((cur_ts - recv_ts_nsec - pause_offset) > TIMEOUT_MAX_NSEC) {
 			char timeout_str[16];
 			snprintf(timeout_str, sizeof(timeout_str), "%d",
 				 TIMEOUT_MAX_SEC);