Commit Graph

20 Commits

Author SHA1 Message Date
Rafael Gieschke
b4474e3d76 HACK: force H.264 with WebCodecs 2024-10-14 19:34:22 +02:00
zengdongbao
f279fe81fa optimized wire.js inbound function, reduce combine times
If the frame data is large, it will be divided into multiple packets. In the current processing mode, each packet will be merged with the old packet into a new buffer, resulting in a large number of redundant operations.
Optimization scheme: Use array cache packets, and finally use DataView.set to do a merge.

After testing, 1080p picture data merging time can be reduced from 100ms to <5ms

Signed-off-by: zengdongbao <zengdongbao@gmail.com>
2024-01-17 09:29:03 +00:00
David Edler
9c8377f86c fix keyboard mappings for international keyboard layouts
Key presses by a client with an international keyboard layout will often fail.
I.e. the key AltGr creates an error message "No mapping for key 255". This key is important to produce the @ symbol i.e. on German language keyboard. The currently used e.keyCode differs by browser vendor and is ambiguous for some keys.
This change relies instead on the event.code, which is stable for most common keys and more complete.
I keep the old implementation to rely on e.keyCode as a fallback if the e.code is not available or the mapping for it is missing.

See merge request spice/spice-html5!14

Signed-off-by: David Edler <david.edler@canonical.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2024-01-06 12:44:17 +00:00
Oliver Gutierrez
02084ebd19 Added needed import of function arraybuffer_to_str
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-07-02 16:51:25 +01:00
Jeremy White
e2dec1cea4 Make an attempt to follow the rules on auto play videos.
Browsers have stopped allowing auto play videos.  The documented solution
is to mute your video.  This patch mutes our videos and also attempts to
start playing if the auto play does not fire.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-09 09:13:16 +01:00
Jeremy White
2c36a2474b Allow pointer events to go through our videos.
If a video covers up a substantial portion of the screen,
you can no longer interact with it.

This change allows pointer events to flow through to our canvas.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-07 10:13:00 +01:00
Jeremy White
8b238f0eeb Make the audio and video uids different.
This does not appear to matter, but let's just be safe.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-07 10:08:44 +01:00
Jeremy White
4dc2401b75 Review the webm video track header and remove the fixmes.
This involved a review of the Firefox parsing code along
with the official specifcation, and setting these fields
to the specified default values.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-07 10:08:41 +01:00
Jeremy White
e1da56fe93 Bug fix: non square cursors were drawn improperly. 2020-01-13 10:14:43 -06:00
Joel Purra
e10791b986 Check if streams array exists in handle_draw_jpeg_onload
- It seems `SpiceDisplayConn` does not always have the array `this.o.sc.streams` set.
- It also seems (stream?) images can be loaded before `streams` is set.
- Without `streams`, or the specific stream matching `this.o.id`, `this.o.sc.streams[this.o.id].frames_loading` cannot be accessed.
- The check for the specific stream woth `this.o.id` is already in place, this patch adds a check for `this.o.sc.streams` in `handle_draw_jpeg_onload`.
- There might be a better place to ensure that `this.o.sc.streams` is initialized; this quick fix saved my bacon today though.

Might be related to, and perhaps fix:

- https://bugs.freedesktop.org/show_bug.cgi?id=94776
- https://bugzilla.redhat.com/show_bug.cgi?id=1323144

Signed-off-by: Joel Purra <mig@joelpurra.se>
2019-12-31 11:18:08 -06:00
Paul Hodges IV
1cc7987360 Add the sc object to sendCtrlAltDel because it is otherwise undefined and issues a JS error 2019-08-20 14:34:16 +00:00
Jeremy White
61373be8ec Adjust the presentation of two byte scan codes.
The previous implementation worked strictly due to a bug which would
luckily generate roughly the right scan codes, although we would send
more codes than required.

For example, the old implementation would send 0xdf48e0 for 'up key down'
and '0xdfc8e0' for 'up key up'.  The prepended 0xdf is incorrect; the
correct values should be 0x48e0 and 0xc8e0.  Essentially, it stored
the bytes in reverse order and had a bug while flipping them.

This code stores them in the order we transmit them which simplifies
the code.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-06 10:36:34 +01:00
Jeremy White
a14f8933a7 Update the documentation and organization of the scancodes.
The common scan codes were disjointed and logically belong together.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-06 10:36:31 +01:00
Jeremy White
bd96ebe0a9 Support the keypad minus key in Chrome.
The keypad minus key at 109 is common between at least Chrome and Firefox.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-06 10:36:28 +01:00
Jeremy White
c4e5fd1c3e Use a named constant from atKeynames.js for the PrintScreen/SysRq key.
Correct a typo from the upstream atKeynames.js at the same time.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-06 10:36:26 +01:00
Cédric Bosdonnat
54755c2565 More reliable mouse position reporting
Depending on the structure of the page, the computed mouse position was
not correct. Typically the case happend when there is no offset between
the canvas and the view area, but an offset on the view area.

The MouseEvent.offsetX and offsetY functions are now widely enough spread
to use them and avoid complex computations.
2019-02-15 10:06:21 -06:00
Cédric Bosdonnat
8ab92d030e resize_helper: round sizes down
If we round up, we may end up with a display slightly bigger than what
the window can have, thus adding scroll bars. When rounding down we
avoid this problems.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:13 -06:00
Cédric Bosdonnat
7b8f595b8f resize_helper, no message box case
The resize_handler need to check for the existence of the message box
before computing it's size.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:11 -06:00
Cédric Bosdonnat
ee0ec7c24f Document onsuccess callback
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:10 -06:00
Cédric Bosdonnat
ef82543195 Move sources into their own folder
To add some more order to the folder, move the JS files into their own
src folder.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:07 -06:00