Minor tweaks.

This commit is contained in:
Jared Goodwin 2019-05-02 22:44:48 -07:00
parent b3c0380e1f
commit 20df55882c
2 changed files with 9 additions and 11 deletions

View File

@ -119,14 +119,8 @@ namespace Remotely_ScreenCast.Core.Capture
}
finally
{
try
{
currentFrame.UnlockBits(bd1);
previousFrame.UnlockBits(bd2);
bd1 = null;
bd2 = null;
}
catch { }
currentFrame.UnlockBits(bd1);
previousFrame.UnlockBits(bd2);
}
}

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@ -103,15 +104,18 @@ namespace Remotely_ScreenCast.Core.Capture
await conductor.CasterSocket.SendScreenCapture(encodedImageBytes, viewerID, diffArea.Left, diffArea.Top, diffArea.Width, diffArea.Height, DateTime.UtcNow);
viewer.PendingFrames++;
}
// TODO: Even after disposing of the bitmap, GC doesn't collect in time. Memory usage soars quickly.
// Need to revisit this later.
GC.Collect();
}
}
catch (Exception ex)
{
Logger.Write(ex);
}
finally
{
// TODO: Even after disposing of the bitmap, GC doesn't collect in time. Memory usage soars quickly.
// Need to revisit this later.
GC.Collect();
}
}
Logger.Write($"Ended screen cast. Requester: {requesterName}. Viewer ID: {viewerID}.");
success = false;