Wait for buffer drain on any RTC DTO.

This commit is contained in:
Jared 2021-03-06 16:18:22 -08:00 committed by Jared Goodwin
parent 41e66d3a9a
commit 1f7890fbe7
2 changed files with 4 additions and 10 deletions

View File

@ -208,15 +208,9 @@ namespace Remotely.Desktop.Core.Services
MessageId = messageId
};
await SendToViewer(async () =>
{
await RtcSession.SendDto(fileDto);
await TaskHelper.DelayUntilAsync(() => RtcSession.CurrentBuffer == 0, TimeSpan.FromSeconds(5), 100);
},
async () =>
{
await CasterSocket.SendDtoToViewer(fileDto, ViewerConnectionID);
});
await SendToViewer(
() => RtcSession.SendDto(fileDto),
() => CasterSocket.SendDtoToViewer(fileDto, ViewerConnectionID));
progressUpdateCallback((double)fs.Position / fs.Length);
}

View File

@ -110,7 +110,7 @@ namespace Remotely.Desktop.Core.Services
public Task SendDto<T>(T dto) where T : BaseDto
{
CaptureChannel.SendMessage(MessagePackSerializer.Serialize(dto));
return Task.CompletedTask;
return TaskHelper.DelayUntilAsync(() => CurrentBuffer < 64, TimeSpan.FromSeconds(5));
}
public async Task SetRemoteDescription(string type, string sdp)