Commit Graph

4206 Commits

Author SHA1 Message Date
Uri Lublin
ec5f9b008f tests: rename video-encoders to test-video-encoders
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-22 11:21:23 +01:00
Uri Lublin
e40a57027f ci: pre-install "file"
This fixes the following warning:
  ./configure: line 7040: /usr/bin/file: No such file or directory

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-22 11:21:20 +01:00
Frediano Ziglio
89edf80821 ci: Workaround an issue with GLib on Fedora 30
This remove this error running test-listen test on a Fedora 30 docker
image:

(/builds/spice/spice/build/server/tests/test-listen:2233): GLib-GIO-CRITICAL **: 15:29:03.123: g_file_new_for_path: assertion 'path != NULL' failed

This error is due to some missing configuration on the image.
On a fully installed Desktop/Server machine these configuration
are usually in place so you won't note the issue but on recent
docker images these configuration are missing.

Running the dconf command add required configuration.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-18 16:20:59 +01:00
Frediano Ziglio
2ababd6177 ci: Add some Valgrind suppressions for Fedora 30
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-18 15:56:07 +01:00
Frediano Ziglio
d2979e23e9 ci: Update glib.supp file
Sync with Glib master file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-18 15:56:07 +01:00
Frediano Ziglio
911455ba65 ci: Separate SPICE specific Valgrind suppression
Previously we add suppression to glib.supp file (suppressions from
Glib).
Keep the glib.supp file pristine and add another file specific
for SPICE.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-18 15:56:07 +01:00
Frediano Ziglio
642b1683ae websocket: Include proper type header
inttypes.h contains macro for format string while
stdint.h more specifically contains type definitions (like uint8_t).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-17 12:53:11 +01:00
Frediano Ziglio
4894d58ace reds: Fix use-after-free
video_codecs can be freed so use it before.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-17 12:53:11 +01:00
Uri Lublin
81c90b54b5 gst:mjpeg do not set max-threads
1. It was renamed in newer versions to 'threads'
2. The default is 1 anyway

Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-17 11:21:55 +01:00
Frediano Ziglio
705ae9c197 websocket: Make header self-independent
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-16 15:42:49 +01:00
Frediano Ziglio
3a8c0bc28d websocket: Add header guards
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-07-16 15:42:32 +01:00
Uri Lublin
da162ad411 dcc-send: fix use-after-free
'l' is being freed within the loop

Found-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-11 09:37:34 +01:00
Frediano Ziglio
636f9c25a6 dcc-send: remove unused variable 'image'
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-07-11 09:37:20 +01:00
Uri Lublin
44325e1154 dcc-send: remove useless pipe_item assignment pipe_item
In red_pipe_replace_rendered_drawables_with_images, the
value of pipe_item is re-written on the next iteration.

Since a78a7d2510 pipe_item
is no longer used to control the loop.

Found by Covscan.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-11 09:37:17 +01:00
Kevin Pouget
4000846c01 streaming: Restart streams on video-codec changes
Interrupt the video streams when the user changes the preferred
video-codecs (dcc_handle_preferred_video_codec_type) or when the host
admin updates the list of video-codecs allowed
(display_channel_set_video_codecs).

The video streaming will be automatically restarted by spice
video-detection rules.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-11 09:28:51 +01:00
Frediano Ziglio
3e299cede8 spice-char: Add some documentation to SpiceCharDeviceInterface
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-07-10 09:53:58 +01:00
Frediano Ziglio
a0497f0407 red-common: Add a comment for GLIST_FOREACH_GENERIC
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-07-09 11:10:27 +01:00
Frediano Ziglio
4f5c342eea red-qxl: Better encapsulation of device display information
Do not expose multiple functions to fetch different parts of
internal structure.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-07-08 13:19:12 +01:00
Frediano Ziglio
fdf104fe28 test-codecs-parsing: On bad codec string spice_server_set_video_codecs can fail
The 0 result means success however the function (correctly) could
report a failure if the string is incorrect.
This fixes the test after commit b4150de3cd
("spice_server_set_video_codecs: fail when no codec can be installed").

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com
2019-07-08 08:15:36 +01:00
Kevin Pouget
b4150de3cd reds: spice_server_set_video_codecs: fail when no codec can be installed
Public function spice_server_set_video_codecs: return -1 if no
encoder/codec has been installed, instead of always returning 0.

Internal function reds_set_video_codecs_from_string: return the number
of invalid encoder/codec entries found in the input list, and update
the installed pointer with the number of encoder/codec pairs
successfully installed.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-05 13:36:12 +01:00
Kevin Pouget
321c5cb7f6 reds: Add ability to query the video-codecs currently enabled
spice_server_get_video_codecs: new public function to query the video
encoders/codecs currently enabled in the spice server. It returns a
string that can be fed to the setter counter
(spice_server_set_video_codecs). The string returned by this function
should be released with spice_server_free_video_codecs.

spice_server_free_video_codecs: new public function to free the the
video codec list returned by spice_server_get_video_codecs.

video_codecs_to_string: new private function to transform an array of
RedVideoCodec into a string.

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-05 11:11:57 +01:00
Kevin Pouget
224a79acd3 manual: document host-side video streaming
Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-04 14:33:54 +01:00
Uri Lublin
c964ca4040 typo: fix the spelling of precede
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-04 10:05:19 +01:00
Uri Lublin
44d6d587b0 typo: image-encoders: fix the spelling of guaranteed
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-04 10:05:16 +01:00
Uri Lublin
8c510901dd typo: dcc: fix the spelling of unknown
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-04 10:05:13 +01:00
Frediano Ziglio
0c6dc28334 syntax-check: Add missing contributor name to AUTHORS
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-03 14:49:34 +01:00
Kevin Pouget
48ab22b728 gstreamer-encoder: fix compiler warning with Fedora 30
Fedora 30 / gcc 9.1.1 20190503 (Red Hat 9.1.1-1) fails to build
because of this error/warning:

> gstreamer-encoder.c: In function 'set_video_bit_rate':
> gstreamer-encoder.c:518:17: error: taking the absolute value of
> unsigned type 'uint64_t' {aka 'long unsigned int'} has no effect
> [-Werror=absolute-value]
>  518 |     } else  if (abs(bit_rate - encoder->video_bit_rate) > encoder->video_bit_rate * SPICE_GST_VIDEO_BITRATE_MARGIN) {
>      |                 ^~~
> gstreamer-encoder.c:518:17: error: absolute value function 'abs'
> given an argument of type 'uint64_t' {aka 'long unsigned int'}

This patches solves these two warnings:

1) cast the substraction to a signed type (int64_t instead of
uint64_t) to preserve the operation meaning;

2) use a custom version of abs() to avoid data truncation and/or
platform-dependent type lengths (abs/labs/llabs)

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-03 14:24:25 +01:00
Francois Gouget
2bb96f105d utils: Make all the NSEC_PER_XXX constants 64 bit
Code dealing with nanosecond timestamps normally uses 64 bit integers
and not long long ints. So this makes it easier to print the value of
expressions using these constants.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-03 12:08:50 +01:00
Frediano Ziglio
94611ac175 red-parse-qxl: Reset mask attributes if brush image is missing
The attributes in this case are not used to apply the mask.
Doing so avoid sending garbage from the guest which usually
don't initialise the memory in case the mask is missing.
Guest should have cleared these bytes by its own however doing so
on the server fixes the problem too. Considering that these
command should not appears in newer OSes it's surely not a hot path
code.
These garbage came from video memory of the guest so they don't
contain sensitive data.

This fixes https://gitlab.freedesktop.org/spice/spice-server/issues/25.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-07-02 13:47:18 +01:00
Snir Sheriber
0591a09ca5 manual: Typo at Folder sharing section
Reported here:
https://gitlab.freedesktop.org/spice/spice-space-pages/issues/1

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-07-02 12:15:09 +03:00
Frediano Ziglio
2dae4de360 display-channel: Initialize priv as soon as possible
This avoid potentially memory errors while setting properties.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-06-27 11:52:51 +01:00
Frediano Ziglio
7eb321c1bb display-channel: Remove some useless function declarations
"image_surfaces_get" and "drawables_init" are already defined
in the same file earlier.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-06-27 10:52:50 +01:00
Frediano Ziglio
a68fd56b41 ci: Add test for websockets
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:19:43 +01:00
Frediano Ziglio
c1c5d8bf5a websocket: Handle continuation and 0-size frames
The WebSocket protocol allows 0-size frames so a returned lenth of
0 does not only mean an issue but it's perfectly expected.
This is also required by WebSocket specification.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:19:13 +01:00
Frediano Ziglio
9d6a438aae websocket: Handle text data
Allows to specify and get frame type.
Type and flags are returned calling websocket_read and returned
calling websocket_write or websocket_writev.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:19:10 +01:00
Frediano Ziglio
0c7f91511d websocket: Do not require "Sec-WebSocket-Protocol" header
Not strictly needed, client can work even without specifying
that.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:19:07 +01:00
Frediano Ziglio
975d444f21 test-websocket: Write a test helper to make possible to run Autobahn testsuite
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:19:05 +01:00
Frediano Ziglio
62582df789 websocket: Handle PING and PONG frames
Websocket implementations are required to implement such messages.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:19:02 +01:00
Frediano Ziglio
5a352c1823 websocket: Avoids to write close frame in the middle of data
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:59 +01:00
Frediano Ziglio
b5a622df76 websocket: Handle case if server cannot write the header entirely
Quite rare case, can only happen with congestion, buffers very low
and some space left in the former packet.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:57 +01:00
Frediano Ziglio
2ba66599c1 websocket: Support correctly protocol values
Ignore spaces before "binary" value.
HTTP allows space before and after the value although usually
browsers implementation start the value with a single ASCII space.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:55 +01:00
Frediano Ziglio
39a791a964 websocket: Avoid possible server crash using websockets
Currently code don't handle if system can't sent the
header in a single write command.
Don't cause abort but just close the connection.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:53 +01:00
Frediano Ziglio
0c2f386beb websocket: Fix updating remaining bytes to write in websocket_write
"len" is not always the full remainder (consider the case when
we are writing a partial frame).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:50 +01:00
Frediano Ziglio
9f1417c11f websocket: Propagate some variable
These were introduced moving code around.
No more reason to copy, just use directly structure fields.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:48 +01:00
Frediano Ziglio
6b41f3b542 websocket: Better variable types
"type" is just 8 bit.
"frame_ready" and "masked" as booleans.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:46 +01:00
Frediano Ziglio
007e009bc3 websocket: Detect and handle some header error
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:43 +01:00
Frediano Ziglio
55df5fa841 websocket: Better encapsulation
Move websocket structure declarations to C file.
Make some functions static as now not used externally.
Introduce a websocket_free function for symmetry.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:40 +01:00
Frediano Ziglio
a5c05ad845 websocket: New interface to create RedsWebSocket
Less coupling. This is a preparation for next patch.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:38 +01:00
Frediano Ziglio
b5f3ed1502 websocket: Make websocket_ack_close static
It's used only in websocket.c.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:36 +01:00
Frediano Ziglio
bbfb472154 websocket: Make websocket function more ABI compatibles with RedStream
Use same argument types as red_stream_* functions.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2019-06-26 14:18:33 +01:00