Răsfoiți Sursa

obs-ffmpeg: Fix seek offset being calculated incorrectly

If FFmpeg wrote data and then seeked back to immediately overwrite it,
the second seek would be skipped as our virtual offset was incorrectly
thinking it hadn't changed. This caused MP4 corruption when seeking
back in the file to write the moov atom.

Fixes https://github.com/obsproject/obs-studio/issues/7269
Fixes https://github.com/obsproject/obs-studio/issues/7144
Richard Stanway 3 ani în urmă
părinte
comite
3332beece5
1 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 6 1
      plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c

+ 6 - 1
plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c

@@ -780,7 +780,12 @@ static void *ffmpeg_mux_io_thread(void *data)
 			if (want_seek) {
 				os_fseeki64(ffm->io.output_file,
 					    next_seek_position, SEEK_SET);
-				current_seek_position = next_seek_position;
+
+				// Update the next virtual position, making sure to take
+				// into account the size of the chunk we're about to write.
+				current_seek_position =
+					next_seek_position + chunk_used;
+
 				want_seek = false;
 			}