Commit Graph

4582 Commits

Author SHA1 Message Date
Frediano Ziglio
0acf650afa reds: Remove not used preprocessor macros
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-27 06:29:53 +01:00
Frediano Ziglio
7f37f0bf82 gstreamer-encoder: Propagate correctly VideoEncodeResults
Do not use "int" to return VideoEncodeResults result type.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-26 10:07:28 +01:00
Frediano Ziglio
4a34111711 reds: Avoid a "end" label just to free password
"password" is pretty small, allocate on stack directly.
RSA is currently 1024 bits, that is more or less 128 bytes.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-06-26 10:06:40 +01:00
Frediano Ziglio
7f849777d3 docs: Update references to code in spice_threading_model.txt
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-06-25 16:09:37 +01:00
Frediano Ziglio
ba065d1bdf char-device: Update documentation reference
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-06-25 16:09:34 +01:00
Frediano Ziglio
3868e13bf3 video-encoder: Fix parameter name
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-06-25 16:09:32 +01:00
Frediano Ziglio
69640d1054 reds: Remove useless label and goto statements
Not needed anymore.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-06-25 16:09:25 +01:00
Frediano Ziglio
364a1fde82 video-stream: Better check for value from environment
Do not allow negative values from "SPICE_BIT_RATE".

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-25 09:42:54 +01:00
Frediano Ziglio
b174e757fa Enable -Wshadow warning
This flag allows to catch variables or arguments hiding other
variables or attributes.
It helps avoiding some possible mistakes.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-25 09:18:59 +01:00
Frediano Ziglio
9f4fbc2a08 red-channel-client: Initialise properly "monitor_latency"
This is a regression of commit 176970f3f1
(cfr "red-channel-client: Remove GObject type").

Attribute was not initialised.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-25 09:18:59 +01:00
Frediano Ziglio
4043757754 utils: Change comments to generate Doxygen output
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-25 09:12:37 +01:00
Frediano Ziglio
4c25ce1877 dispatcher: Update documentation
Move to Doxygen (output was not meant to generate output
automatically).
Update some part that were outdated.
Typo messsage_type -> message_type.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-25 09:12:37 +01:00
Frediano Ziglio
f64ace4e34 build: Add Doxygen support
Add configuration file for Doxygen.
Add a "doxy" target to both Meson and Autoconf using a simple
shell script.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-25 09:12:37 +01:00
Frediano Ziglio
dc65afb03a common-graphics-channel: Use marshaller structure for RedCachePipeItem
Allows to simplify a bit marshalling code in both CursorChannel
and DisplayChannel as they use the same marshalling structure.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 13:24:06 +01:00
Frediano Ziglio
e7cdaa668d cache-item: Move RedCachePipeItem declaration to common-graphics-channel.h
The pipe items are meant to be used by channel clients, so move
declaration where channel clients is.
This item is used by both CursorChannelClient and DisplayChannelClient
so the CommonGraphicsChannel is the proper place.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 13:24:06 +01:00
Frediano Ziglio
255f6b2fd3 cache-item: Simplify structure used for just memory optimization
RedCacheItem was using an union to reuse cache item memory
as a pipe item to release that specific cache item.
Instead of spreading that structure everywhere move the specific
optimization all in cache-item.tmpl.cpp.
This make also code less cluttered.
Add some comment on specific code.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 13:24:06 +01:00
Frediano Ziglio
a10e496c46 char-device: Remove "sin" parameter from read_one_msg_from_device
Not much used, can be retrieved from the class if needed.

There are some apparent test removal on reds.cpp.
The test "if (!reds->vdagent)" apparently disappeared but it's included in
the while.
reds->agent_dev cannot be NULL as SPICE server allows only one agent and we
are into a member of an object so it must be reds->agent_dev.get() == this.
As there's only an agent and as the interface (sin) is extracted from that
agent it must be reds->agent_dev.get() == sin->st and either reds->vdagent
== sin or reds->vdagent == NULL.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 12:49:43 +01:00
Frediano Ziglio
479a1a74a2 Reuse RedCharDevice::read
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 12:49:41 +01:00
Frediano Ziglio
66dacecda9 char-device: Add a read method to simplify reading data
Avoid to pass throught SpiceCharDeviceInterface.
When data is read from device the device get marked as active.
This is coherent with what is done in red_char_device_read_from_device.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 12:49:26 +01:00
Frediano Ziglio
3c8037d39f Remove DISPLAY_CHANNEL cast reusing DCC_TO_DC
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 10:39:08 +01:00
Frediano Ziglio
239d0f7166 build: Add possible missing library on Windows
websocket.c will use StrStrI from shlapi library.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 10:38:17 +01:00
Frediano Ziglio
d8dccabb7d red-channel: Simplify some preprocessor macros
Just pass rest of the arguments.
Removes some extra semicolon.
This change also remove a specific GCC extension.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-19 14:24:48 +01:00
Frediano Ziglio
43c7cb167e sound: Better management of PersistentPipeItem life
The handling of that specific pipe item reference counting
was a bit confusing. In particular every time before adding to
the queue the item was reset causing the reference counter to
be 1 however it was not sure that the item was not still referenced
when added again to the queue.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-19 14:22:23 +01:00
Frediano Ziglio
66ee75a810 sound: Do not depend on pipe item remove to detect data message sent
The assumption is a bit fragile as code could change adding
additional references to the pipe item.
Instead use marshaller cleanup routines, this surely will be
triggered when the message is queued to the network.
This also causes some additional cleanups.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-19 14:22:17 +01:00
Frediano Ziglio
0f2c28a63b test-display-base: Reuse SPICE_GNUC_NORETURN macro
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-19 13:34:55 +01:00
Frediano Ziglio
edebd1cc74 utils: Remove shared_ptr::release
It's never used.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-19 10:56:05 +01:00
Uri Lublin
7edd55d95b image_encoders_free_glz_drawables: enc is never NULL
It is called from 2 places.
1. display-channel.cpp:
   dcc_get_encoders always returns a non-null pointer.
2. image-encoders.cpp: image_encoders_release_glz
   <- image_encoders_free (where enc is not checked)
   <- dcc.c:image_encoders_free
   where non-null pointer is passed.

Signed-off-by: Uri Lublin <uril@redhat.com>
2020-06-19 10:50:58 +01:00
Frediano Ziglio
8875e79c7c reds: Use socket_close instead of close
socket_close is mapped to close under Unix but under Windows
you should call closesocket instead so call socket_close which
will map to the proper close function on both environments.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <ulublin@redhat.com>
2020-06-18 16:57:50 +01:00
Uri Lublin
21323c8b6f glz_dictionary_window_add_image: error out when failed to alloc an image
__glz_dictionary_window_alloc_image may return NULL.
Check that the image was created successfully and if not
then error out using dict->cur_usr->error like it's done
few lines below.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-06-17 12:53:22 +01:00
Uri Lublin
031ab732dd glz_enc_dictionary_restore: return NULL upon failure
glz_enc_dictionary_create may return NULL.
glz_enc_dictionary_restore itself may return NULL so
add one more check.

Found-by: gcc (10) analyzer

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-06-17 12:53:19 +01:00
Uri Lublin
954eabaeb7 test-websocket: check setsockopt return value
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-06-17 12:48:25 +01:00
Frediano Ziglio
982d14dd69 dispatcher: Move some private functions to DispatcherPrivate
Reduce declaration in the header.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-17 10:59:38 +02:00
Frediano Ziglio
b8f4d7d2c7 websocket: Fix possible integer overflow
The shift of a uint_8 number by a number > 32 causes an overflow.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <ulublin@redhat.com>
2020-06-16 15:17:06 +01:00
Frediano Ziglio
70347f3175 dcc: Remove unused result from dcc_add_surface_area_image
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@redhat.com>
2020-06-16 11:27:53 +01:00
Frediano Ziglio
87b6b1993e sound: Make receive_buf field private
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-14 14:31:32 +01:00
Frediano Ziglio
87270d3037 basic-event-loop: Remove useless "ring.h" include
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-10 16:52:32 +01:00
Frediano Ziglio
4466230a85 red-parse-qxl: Add a note on red_get_cursor
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-10 10:13:20 +01:00
Frediano Ziglio
f03d094942 reds: Remove usage of "this"
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@redhat.com>
2020-06-08 10:00:43 +01:00
Frediano Ziglio
3c74601652 main-channel-client: Make some members const
Also use a more explicit return type.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-08 09:05:28 +01:00
Frediano Ziglio
64435c8934 main-channel: Fix typo in comment
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-07 20:51:07 +01:00
Frediano Ziglio
39c513b604 red-common: Fix typo in comment
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@redhat.com>
2020-06-04 11:07:32 +02:00
Frediano Ziglio
6c900f0442 inputs-channel-client: Avoid attribute shadowing
This regression was caused by commit
"2ffa7d00c60808e2f640df9bc9b5d62598455588"
(cfr "Improve encapsulation for InputsChannelClient")

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-06-04 09:34:18 +01:00
Frediano Ziglio
853a6df224 Avoid useless SPICE_CXX_GLIB_ALLOCATOR usage
Behaviour was already inherited.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-06-04 09:34:12 +01:00
Frediano Ziglio
4dbc6dae01 cursor-channel: Turn cursor_channel_reset into method
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:44 +01:00
Frediano Ziglio
e044c5bd50 cursor-channel: Turn cursor_channel_set_mouse_mode into method
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:42 +01:00
Frediano Ziglio
f30d35a8c7 cursor-channel: Turn cursor_channel_do_init into method
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:41 +01:00
Frediano Ziglio
0528fadff3 cursor-channel: Turn cursor_channel_process_cmd into method
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:38 +01:00
Frediano Ziglio
aa0dddde0f sound: Move define "trick" to spice-wrapped.h header
The spice-wrapped.h was introduced to deal with such tricks
in the code and limit them to a single place.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:37:36 +01:00
Frediano Ziglio
bd17418f9e char-device: Make RedCharDevice::write_retry private
Not meant to be called externally.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:36:11 +01:00
Frediano Ziglio
19f3406db6 spicevmc: Cleanup some "this" usage
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-05-28 14:34:03 +01:00