Send initial frame.

This commit is contained in:
Jared Goodwin 2020-04-22 19:25:27 -07:00
parent f11235c11a
commit c1252507fb
5 changed files with 33 additions and 12 deletions

View File

@ -38,7 +38,15 @@ namespace Remotely.Agent.Installer.Win.Services
var value = args[i + 1];
if (value != null)
{
commandLineArgs.Add(key, args[i + 1].Trim());
if (value.StartsWith("-"))
{
commandLineArgs.Add(key, "true");
i -= 1;
}
else
{
commandLineArgs.Add(key, args[i + 1].Trim());
}
}
}
}

View File

@ -74,7 +74,15 @@ namespace Remotely.ScreenCast.Core
var value = args[i + 1];
if (value != null)
{
ArgDict.Add(key, args[i + 1].Trim());
if (value.StartsWith("-"))
{
ArgDict.Add(key, "true");
i -= 1;
}
else
{
ArgDict.Add(key, args[i + 1].Trim());
}
}
}
}

View File

@ -76,6 +76,14 @@ namespace Remotely.ScreenCast.Core.Services
await viewer.SendScreenSize(bounds.Width, bounds.Height, viewer.ViewerConnectionID);
};
await viewer.SendScreenCapture(
ImageUtils.EncodeBitmap(viewer.Capturer.CurrentFrame, viewer.EncoderParams),
viewer.ViewerConnectionID,
viewer.Capturer.CurrentScreenBounds.Left,
viewer.Capturer.CurrentScreenBounds.Top,
viewer.Capturer.CurrentScreenBounds.Width,
viewer.Capturer.CurrentScreenBounds.Height);
while (!viewer.DisconnectRequested && viewer.IsConnected)
{
try

View File

@ -39,7 +39,7 @@ namespace Remotely.ScreenCast.Linux.Services
{
try
{
PreviousFrame.Dispose();
PreviousFrame?.Dispose();
PreviousFrame = (Bitmap)CurrentFrame.Clone();
RefreshCurrentFrame();
}
@ -84,6 +84,8 @@ namespace Remotely.ScreenCast.Linux.Services
SetSelectedScreen(x11Screens.Keys.First());
CurrentFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb);
PreviousFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb);
GetNextFrame();
}
catch (Exception ex)
{

View File

@ -85,19 +85,12 @@ namespace Remotely.ScreenCast.Win.Services
Win32Interop.SwitchToInputDesktop();
PreviousFrame.Dispose();
PreviousFrame?.Dispose();
PreviousFrame = (Bitmap)CurrentFrame.Clone();
if (directxScreens.ContainsKey(SelectedScreen))
{
try
{
GetDirectXFrame();
}
catch
{
GetBitBltFrame();
}
GetDirectXFrame();
}
else
{
@ -126,6 +119,8 @@ namespace Remotely.ScreenCast.Win.Services
InitDirectX();
ScreenChanged?.Invoke(this, CurrentScreenBounds);
GetBitBltFrame();
}
public void SetSelectedScreen(string displayName)