With LibreSSL SSL_OP_NO_CLIENT_RENEGOTIATION is opaque which is not
compatible with the OpenSSL 1.0.2 and earlier code path in
red-stream.cpp while SSL_OP_NO_RENEGOTIATION is not yet defined for the
newer OpenSSL code path in reds.cpp.
So with OpenSSL 1.1.0 and later if SSL_OP_NO_RENEGOTIATION is undefined
and SSL_OP_NO_CLIENT_RENEGOTIATION is defined then define the former as
the latter. This will allow the build to succeed with LibreSSL 3.7.2 and
in the future when newer LibreSSL versions add SSL_OP_NO_RENEGOTIATION
that code path will then be used automatically.
Signed-off-by: orbea <orbea@riseup.net>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
Using Fedora 38 the compilation fails due to this warning:
In file included from /usr/include/gstreamer-1.0/gst/video/video.h:202,
from ../../server/gstreamer-encoder.c:27:
/usr/include/gstreamer-1.0/gst/video/video-sei.h:39:21: error: 'H265_MISP_NANOSECONDS' defined but not used [-Werror=unused-const-variable=]
39 | static const guint8 H265_MISP_NANOSECONDS[] = {
| ^~~~~~~~~~~~~~~~~~~~~
Ignore the warning for Gstreamer includes.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
The variable 'now' counts in audio sample frames, but the variable
'data' is of type uint8_t *. Multiply 'now' by the size of an audio
sample frame to get the correct source pointer.
This improves the quality of audio recordings in QEMU a little bit.
Fixes: 5d5a7bd181 ("sound: Avoid cast that could cause alignment problems")
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
Spice uses rand() to generate the random id, but qemu (at least in the case
of qemu-system-x86) fails to initialize the RNG seed (with e.g. srand()).
The result is, that every SPICE session started (by e.g. libvirtd) has the
same client_id. Usually, this is not a problem, but running something like
a SPICE proxy, relying on the client_id to correctly route connections,
this creates problems.
Fixes:
https://gitlab.com/qemu-project/qemu/-/issues/163
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Remove deprecation warnings like
In file included from ../../server/char-device.cpp:28:
../../server/safe-list.hpp:108:43: error: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator' is deprecated [-Werror=deprecated-declarations]
108 | class safe_list<T>::iterator: public std::iterator<std::forward_iterator_tag, T>
| ^~~~~~~~
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
This leak causes a CI failure running test-listen test with
Valgrind.
Note that "check-valgrind" CI job will still fail but with
less issues.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
gstreamer-plugins-base 1.20 includes a new member in the
GstAppSinkCallbacks struct:
gboolean (*new_event) (GstAppSink *appsink, gpointer user_data);
So it has to be initialized in order to build test-gst.cpp
successfully.
(added in
0a657d6db5
)
Acked-by: Frediano Ziglio <freddy77@gmail.com>
Due to reds->vm_running being initialized to TRUE (since c302e12c
"spice.h: add entries for tracking vm state") the assumption in c23cbd6f
"reds: start QXL devices if VM is running" was wrong and we can't check
on vm_running until that initialization isn't on TRUE (it is that way for
backward compatibility).
Without this revert on qemu initializing spice we will have the
display_init side of qemu not yet ready and therefore respond badly when
spice sends an event as reaction to `red_qxl_start`:
"qxl_send_events: spice-server bug: guest stopped, ignoring."
At least with qemu > v2.0 as a spice consumer is not showing issues as
`red_qxl_start` will be called just after the qemu side is ready
`qemu_spice_display_start` -> `spice_server_vm_start` ... `red_qxl_start`.
Therefore - for now to avoid the current regression - Revert c23cbd6f
"reds: start QXL devices if VM is running" until that old (2012)
initialization is updated (probably an ABI change and therefore taking
some time).
Fixes: https://gitlab.freedesktop.org/spice/spice/-/issues/64
This reverts commit c23cbd6fa8.
Using Fedora 35 the compilation fails due to this warning:
../server/gstreamer-encoder.c: In function 'create_pipeline':
../server/gstreamer-encoder.c:994:5: error: braces around scalar initializer [-Werror]
994 | GstAppSinkCallbacks appsink_cbs = {NULL, NULL, &new_sample, {NULL}};
| ^~~~~~~~~~~~~~~~~~~
../server/gstreamer-encoder.c:994:5: note: (near initialization for 'appsink_cbs.new_event')
../server/gstreamer-encoder.c:994:5: error: missing initializer for field '_gst_reserved' of 'GstAppSinkCallbacks' [-Werror=missing-field-initializers]
In file included from ../server/gstreamer-encoder.c:26:
/usr/include/gstreamer-1.0/gst/app/gstappsink.h:81:16: note: '_gst_reserved' declared here
81 | gpointer _gst_reserved[GST_PADDING - 1];
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
Change structure initialisation to avoid the warning.
The same syntax is already used in server/tests/test-gst.cpp.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
A well behaved client implementing the SPICE protocol should check to see
if the server supports the capabilities it needs. This implementation of
the spice-server supports `SPICE_MAIN_CAP_NAME_AND_UUID` and `
SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS` so it should report this to the
client.
Acked-by: Frediano Ziglio <freddy77@gmail.com>
In OpenSSL3, the SSL_accept call now emits proper errors, which we dump
*before* emitting the expected "SSL_accept failed" error message. The
g_test_expect_message framework doesn't really allow us to discard
messages AFAICT, so instead we add a new expectation with fairly loose
criteria.
Fixes#63
Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
Some systems use 32-bits, other 64-bits.
Some systems use signed integers, other unsigned integers.
Compute maximum constant based on time_t type.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
These conversions allowed extra conversions to for range loops in
addition to replacing macro usage with .size().
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
display_channel_surface_id_unref resets the surface so
display_channel_surface_has_canvas will return false.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Store pointers to surface object in "surfaces" and allows to
have different surfaces with same ID in memory.
The surface was keep "busy" if there was pending drawing around.
Consider the following case:
1- receive drawing command
2- queue command on DCCs
3- destroy surface
4- send draw
Previously at point 4) you would have to use a surface from
"surfaces" which was destroyed, that is we would have to maintain
the pointer (and canvas) to the surface until reference counter
was 0.
However consider this case:
1- receive drawing command
2- queue command on DCCs
3- destroy surface
4- create surface
5- send draw
What would happen in point 4) ?
We could not change the surface as it will be used by point 5).
To avoid this the code attempts to wait the commands to release the
surface. However this can be an issue, you can't force the clients
to receive pending data if network is slow.
So this patch change this allowing to create surfaces while the old
version will still be used.
This is also more clean from the reference pointer prospective,
as the reference is increased for a specific surface.
Note that now instead of checking for canvas to not be NULL a
simple check for surface pointer is enough.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Mostly left on dcc-send.cpp.
Other minor too.
The change in BitmapData seems odd but the id for cached image
was not used so the only information left was the surface.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Instead of computing the value inside the function to then
compute also in the caller return it.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
As we use reference counting is more direct to use direct pointers.
Also this will allow to have a surface in a "released state"
reducing the complexity of code destroying a surface.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Similar to shared_ptr_counted but avoid atomic counter and
polymorphism.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Makes sure a message is sent with the proper message number.
Reduce mistakes associating types with wrong registered number.
Make easier to add new messages in the future.
Avoids having to type the message number every time, it's inferred
from the type.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>