switch WebRTC to BigEndian.

This commit is contained in:
Miroslav Šedivý 2021-02-13 00:01:56 +01:00
parent ed9f0276c7
commit 061fbe60cf
2 changed files with 8 additions and 8 deletions

View File

@ -47,7 +47,7 @@ func (manager *WebRTCManagerCtx) handle(msg webrtc.DataChannelMessage) error {
return err return err
} }
if err := binary.Read(bytes.NewBuffer(hbytes), binary.LittleEndian, header); err != nil { if err := binary.Read(bytes.NewBuffer(hbytes), binary.BigEndian, header); err != nil {
return err return err
} }
@ -56,14 +56,14 @@ func (manager *WebRTCManagerCtx) handle(msg webrtc.DataChannelMessage) error {
switch header.Event { switch header.Event {
case OP_MOVE: case OP_MOVE:
payload := &PayloadMove{} payload := &PayloadMove{}
if err := binary.Read(buffer, binary.LittleEndian, payload); err != nil { if err := binary.Read(buffer, binary.BigEndian, payload); err != nil {
return err return err
} }
manager.desktop.Move(int(payload.X), int(payload.Y)) manager.desktop.Move(int(payload.X), int(payload.Y))
case OP_SCROLL: case OP_SCROLL:
payload := &PayloadScroll{} payload := &PayloadScroll{}
if err := binary.Read(buffer, binary.LittleEndian, payload); err != nil { if err := binary.Read(buffer, binary.BigEndian, payload); err != nil {
return err return err
} }
@ -76,7 +76,7 @@ func (manager *WebRTCManagerCtx) handle(msg webrtc.DataChannelMessage) error {
manager.desktop.Scroll(int(payload.X), int(payload.Y)) manager.desktop.Scroll(int(payload.X), int(payload.Y))
case OP_KEY_DOWN: case OP_KEY_DOWN:
payload := &PayloadKey{} payload := &PayloadKey{}
if err := binary.Read(buffer, binary.LittleEndian, payload); err != nil { if err := binary.Read(buffer, binary.BigEndian, payload); err != nil {
return err return err
} }
@ -99,7 +99,7 @@ func (manager *WebRTCManagerCtx) handle(msg webrtc.DataChannelMessage) error {
} }
case OP_KEY_UP: case OP_KEY_UP:
payload := &PayloadKey{} payload := &PayloadKey{}
err := binary.Read(buffer, binary.LittleEndian, payload) err := binary.Read(buffer, binary.BigEndian, payload)
if err != nil { if err != nil {
return err return err
} }

View File

@ -43,7 +43,7 @@ func (webrtc_peer *WebRTCPeerCtx) SendCursorPosition(x, y int) error {
} }
buffer := &bytes.Buffer{} buffer := &bytes.Buffer{}
if err := binary.Write(buffer, binary.LittleEndian, data); err != nil { if err := binary.Write(buffer, binary.BigEndian, data); err != nil {
return err return err
} }
@ -73,11 +73,11 @@ func (webrtc_peer *WebRTCPeerCtx) SendCursorImage(cur *types.CursorImage) error
buffer := &bytes.Buffer{} buffer := &bytes.Buffer{}
if err := binary.Write(buffer, binary.LittleEndian, data); err != nil { if err := binary.Write(buffer, binary.BigEndian, data); err != nil {
return err return err
} }
if err := binary.Write(buffer, binary.LittleEndian, img); err != nil { if err := binary.Write(buffer, binary.BigEndian, img); err != nil {
return err return err
} }