Skip to content

🔄 v2.9.2: Replay Buffer Auto-Restart Reliability Fix

Choose a tag to compare

@SlonickLab SlonickLab released this 17 May 10:39
· 62 commits to main since this release
588eb6f

A reliability fix that resolves an issue where the playback buffer remains disabled after saving large clips (over 1 GB). Thanks to @FireFox-d for the detailed bug report and testing! (Issue #22)


🐛 Bug fixes

  • 🔄 Replay buffer remains disabled (large files):

    • Fixed an issue where the replay buffer did not restart automatically after saving very large clips (>1 GB, buffer over 10 minutes). The main cause was that the script called obs_frontend_replay_buffer_stop () too soon after saving a large file—OBS needs time for internal stabilization (cleaning up I/O, finishing multiplexer operations, etc.), and calling the stop function during this window freezes the buffer in a “Stopping...” state, where the STOPPED event never triggers.
    • New approach: adaptive delay based on file size. Instead of a fixed 1-second delay (which was too short for large files), the script now measures the size of the saved file and calculates a proportional delay before stopping the buffer. This scales from 2 seconds for small files (~200 MB) to 45 seconds for very large files (~4 GB), giving OBS enough time to stabilize regardless of file size or disk speed.
  • ✅ Buffer startup check (retry mechanism):

    • After starting the buffer, the script now checks whether the buffer is actually active using obs_frontend_replay_buffer_active(). If the buffer did not start (for example, OBS silently ignored the start call), the script retries up to 3 times at 2-second intervals.
  • 🛡️ Safety timeout (forced restart):

    • Added a 5-second safety timeout: if the REPLAY_BUFFER_STOPPED event does not arrive after a stop call (e.g., due to internal OBS issues), the script will force a restart of the buffer as a last resort.
  • 📂 Restart regardless of file path:

    • The auto-restart logic now works regardless of file detection. If get_replay_path() returns nil, the script falls back to a conservative 3-second delay before stopping the buffer.

✨ Improvements

  • 🧹 Timer cleanup — All new restart/check timers are properly cleared in script_unload.
  • 📝 Debug Log — A detailed log for each step: file size measurement, calculated delay, stop call, check, and replay attempts.

💡 Update: Simply replace the Smart_Replay_Mover.lua file with the new version and restart OBS. All your settings and custom names will be preserved.