Send only ready when we finish rendering the received frame

This commit is contained in:
DanyLE 2023-01-07 19:29:37 +01:00
parent 90382e2f33
commit fc515ff012
2 changed files with 773 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -149,12 +149,15 @@ class WVNC
process: (msg) ->
if not @socket
@socket.send(@buildCommand 0x04, 1)
return
data = new Uint8Array msg.pixels
ctx = @canvas.getContext "2d", { alpha: false }
imgData = ctx.createImageData msg.w, msg.h
imgData.data.set data
ctx.putImageData imgData,msg.x, msg.y
# tell the server that we are ready
@socket.send(@buildCommand 0x04, 1)
setScale: (n) ->
@ -329,7 +332,6 @@ class WVNC
when 0x84
# send data to web assembly for decoding
@decoder.postMessage data.buffer, [data.buffer]
@socket.send(@buildCommand 0x04, 1)
when 0x85
# clipboard data from server
data = data.subarray 1