diff --git a/Core/RenderManager.cs b/Core/RenderManager.cs
index 0a96c1e..743c266 100644
--- a/Core/RenderManager.cs
+++ b/Core/RenderManager.cs
@@ -764,12 +764,15 @@ internal class RenderManager : MonoBehaviour
///
/// Takes frames from ImageQueue in passCount order and sends each one to the encoder, followed by the audio
/// samples of that frame. Waits on FrameAvailableEvent (50ms) while no frame is ready.
- /// Returns when the render is aborted or all requested frames have been sent after endRequested.
+ /// Returns when the render is aborted (checked before every frame, frames left in ImageQueue are released
+ /// by the cleanup after the thread ends) or all requested frames have been sent after endRequested.
///
private void EncodeQueuedFrames(FFmpegNativeEncoder videoFFmpeg)
{
while (true)
{
+ if (IsRenderAborted) return;
+
if (TryDequeueNextFrame(out var frame))
{
SendVideoFrame(videoFFmpeg, frame);
@@ -914,7 +917,7 @@ internal class RenderManager : MonoBehaviour
var reason = IsRenderFailed ? $"FAILED ({_failureReason})" : "CANCELLED";
Melon.Logger.Error($"Rendering {reason}. Safely cleaning up state and resources.");
- // 1. Wait for render background thread to finish processing remaining queued frames and terminate
+ // 1. Wait (up to 2s) for the render background thread to see the abort flag and terminate
if (RenderThread is { IsAlive: true })
{
RenderThread.Join(2000);