Re: [Spice-devel] [PATCH spice-gtk] channel-main: Fix typo in comment

2019-06-25 Thread Jakub Janku
Sure, Acked-by: Jakub Janků On Tue, Jun 25, 2019 at 12:13 PM Frediano Ziglio wrote: > > explicitely -> explicitly > > Signed-off-by: Frediano Ziglio > --- > src/channel-main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/channel-main.c b/src/channel-main.c > in

[Spice-devel] [client v3 1/6] channel-display: Minimize the stream lag by ignoring the server one

2019-06-25 Thread Francois Gouget
The client is in a better position than the server to pick the minimum lag needed to compensate for frame arrival time jitter and ensure smooth video playback. To do so: - It ignores the lag specified by the server through the mmtime clock adjustments (but this lag is still tracked for the stream

[Spice-devel] [client v3 4/6] channel-display: Remove playback_sync_drops_seq_len

2019-06-25 Thread Francois Gouget
display_handle_stream_data() now has its own mechanism to avoid dropping frames which does not depend on the playback latency. Signed-off-by: Francois Gouget --- src/channel-display-priv.h | 2 -- src/channel-display.c | 8 src/channel-playback-priv.h | 1 - src/channel-playba

[Spice-devel] [client v3 3/6] channel-display: No need to rechedule on mmtime offset changes

2019-06-25 Thread Francois Gouget
The frame display time is no longer based on the mmtime clock and thus is not impacted by mmtime offset changes. Signed-off-by: Francois Gouget --- src/channel-display-gst.c | 21 - src/channel-display-mjpeg.c | 13 src/channel-display-priv.h | 3 -- src/channel-display.

[Spice-devel] [client v3 2/6] playback: Use the audio timestamps for the global mmtime conversion

2019-06-25 Thread Francois Gouget
More data helps improve the accuracy of the estimation of the true clock offset and minimum network latency. Signed-off-by: Francois Gouget --- src/channel-playback.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/channel-playback.c b/src/channel-playback.c i

[Spice-devel] [client v3 5/6] spice-session: Keep track of the global streams lag

2019-06-25 Thread Francois Gouget
Each video and audio stream has its own lag: for video streams it is the decoding time and for audio ones buffering by the audio subsystem. The only way to keep them all in sync is to synchronize to the most laggy stream. Signed-off-by: Francois Gouget --- src/channel-display-gst.c | 9 ++

[Spice-devel] [client v3 6/6] mjpeg: Take the decoding time into account to display frames

2019-06-25 Thread Francois Gouget
Signed-off-by: Francois Gouget --- src/channel-display-mjpeg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c index 20e10d9b..764f0611 100644 --- a/src/channel-display-mjpeg.c +++ b/src/channel-display-mjpeg.c @@ -189,6 +189,9 @@ s

Re: [Spice-devel] [client v2 07/12] channel-display: Minimize the stream lag by ignoring the server one

2019-06-25 Thread Francois Gouget
On Thu, 20 Jun 2019, Frediano Ziglio wrote: [...] > > - It performs its own frame mmtime conversion to the local monotonic > > clock spice_session_get_client_time() since the server-controlled > > mmtime clock cannot be relied on. This conversion uses data from all > > The "since the server-co

Re: [Spice-devel] [PATCH spice-server 00/23] WebSocket support

2019-06-25 Thread Jeremy White
Series Acked-by: Jeremy White On 6/25/19 11:11 AM, Frediano Ziglio wrote: Updated a longstanding patch for WebSocket support. This includes: - style updates: - types (C99 instead of GLib); - memory allocation (GLib instead of SPICE functions); - support for Windows; - different fixes; -

Re: [Spice-devel] [spice v3] utils: Remove the LL suffix from NSEC_PER_SEC

2019-06-25 Thread Francois Gouget
On Tue, 25 Jun 2019, Frediano Ziglio wrote: [...] > > uint64_t foo = 1234; > > spice_debug("foo=%" PRId64, foo / NSEC_PER_SEC); [...] > If you assume long long == 64 bit should not be a big problem > although you can still have the warning. Not a warning. A compilation error: CC g

[Spice-devel] [PATCH spice-server 22/23] websocket: Handle continuation and 0-size frames

2019-06-25 Thread Frediano Ziglio
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 --- server/tests/test-websocket.c | 25 +++-- server/websocket.c|

[Spice-devel] [PATCH spice-server 18/23] websocket: Handle PING and PONG frames

2019-06-25 Thread Frediano Ziglio
Websocket implementations are required to implement such messages. Signed-off-by: Frediano Ziglio --- server/websocket.c | 127 +++-- 1 file changed, 112 insertions(+), 15 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index 72a4b064b..

[Spice-devel] [PATCH spice-server 16/23] websocket: Handle case if server cannot write the header entirely

2019-06-25 Thread Frediano Ziglio
Quite rare case, can only happen with congestion, buffers very low and some space left in the former packet. Signed-off-by: Frediano Ziglio --- server/websocket.c | 78 -- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/server/websocket

[Spice-devel] [PATCH spice-server 20/23] websocket: Do not require "Sec-WebSocket-Protocol" header

2019-06-25 Thread Frediano Ziglio
Not strictly needed, client can work even without specifying that. Signed-off-by: Frediano Ziglio --- server/websocket.c | 33 +++-- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index cb222c693..514e72c96 1006

[Spice-devel] [PATCH spice-server 21/23] websocket: Handle text data

2019-06-25 Thread Frediano Ziglio
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 --- server/red-stream.c | 12 +--- server/tests/test-websocket.c | 6 -- server/websocket.c

[Spice-devel] [PATCH spice-server 23/23] ci: Add test for websockets

2019-06-25 Thread Frediano Ziglio
--- .gitlab-ci.yml | 20 server/tests/autobahn-check-report | 18 ++ server/tests/fuzzingclient.json| 11 +++ 3 files changed, 49 insertions(+) create mode 100755 server/tests/autobahn-check-report create mode 100644 server/tes

[Spice-devel] [PATCH spice-server 19/23] test-websocket: Write a test helper to make possible to run Autobahn testsuite

2019-06-25 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/tests/.gitignore | 1 + server/tests/Makefile.am | 6 + server/tests/meson.build | 1 + server/tests/test-websocket.c | 290 ++ 4 files changed, 298 insertions(+) create mode 100644 server/tests/test-

[Spice-devel] [PATCH spice-server 17/23] websocket: Avoids to write close frame in the middle of data

2019-06-25 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/websocket.c | 75 -- 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index 9fd5fde53..72a4b064b 100644 --- a/server/websocket.c +++ b/server/websocket.c @@

[Spice-devel] [PATCH spice-server 15/23] websocket: Support correctly protocol values

2019-06-25 Thread Frediano Ziglio
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 --- server/websocket.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-

[Spice-devel] [PATCH spice-server 12/23] websocket: Propagate some variable

2019-06-25 Thread Frediano Ziglio
These were introduced moving code around. No more reason to copy, just use directly structure fields. Signed-off-by: Frediano Ziglio --- server/websocket.c | 47 -- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/server/websocket.c b/se

[Spice-devel] [PATCH spice-server 10/23] websocket: Detect and handle some header error

2019-06-25 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/websocket.c | 37 +++-- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index 01bcef82e..9a9400375 100644 --- a/server/websocket.c +++ b/server/websocket.c @@ -46,7 +46

[Spice-devel] [PATCH spice-server 11/23] websocket: Better variable types

2019-06-25 Thread Frediano Ziglio
"type" is just 8 bit. "frame_ready" and "masked" as booleans. Signed-off-by: Frediano Ziglio --- server/websocket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index 9a9400375..38496fb5a 100644 --- a/server/websocket.c +++ b/s

[Spice-devel] [PATCH spice-server 14/23] websocket: Avoid possible server crash using websockets

2019-06-25 Thread Frediano Ziglio
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 --- server/websocket.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/websocket.c b/server/webs

[Spice-devel] [PATCH spice-server 13/23] websocket: Fix updating remaining bytes to write in websocket_write

2019-06-25 Thread Frediano Ziglio
"len" is not always the full remainder (consider the case when we are writing a partial frame). Signed-off-by: Frediano Ziglio --- server/websocket.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index afb7502a1..dda71f768 10064

[Spice-devel] [PATCH spice-server 09/23] websocket: Better encapsulation

2019-06-25 Thread Frediano Ziglio
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 --- server/red-stream.c | 31 ++ server/websocket.c | 64 +

[Spice-devel] [PATCH spice-server 07/23] websocket: Make websocket_ack_close static

2019-06-25 Thread Frediano Ziglio
It's used only in websocket.c. Signed-off-by: Frediano Ziglio --- server/websocket.c | 4 +++- server/websocket.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index b0ea867e6..1b18aa614 100644 --- a/server/websocket.c +++ b/server/

[Spice-devel] [PATCH spice-server 05/23] websocket: Move RedsWebSocket to header

2019-06-25 Thread Frediano Ziglio
Intention is to make private in websockets.c and reduce changes in red-stream.c Signed-off-by: Frediano Ziglio --- server/red-stream.c | 40 server/websocket.c | 39 +++ server/websocket.h | 24 +--

[Spice-devel] [PATCH spice-server 06/23] websocket: Make websocket function more ABI compatibles with RedStream

2019-06-25 Thread Frediano Ziglio
Use same argument types as red_stream_* functions. Signed-off-by: Frediano Ziglio --- server/websocket.c | 8 server/websocket.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index 145d829f4..b0ea867e6 100644 --- a/ser

[Spice-devel] [PATCH spice-server 08/23] websocket: New interface to create RedsWebSocket

2019-06-25 Thread Frediano Ziglio
Less coupling. This is a preparation for next patch. Signed-off-by: Frediano Ziglio --- server/red-stream.c | 31 +++ server/websocket.c | 25 + server/websocket.h | 8 +--- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git

[Spice-devel] [PATCH spice-server 01/23] test-glib-compat: Fix G_PID_FORMAT definition for old systems

2019-06-25 Thread Frediano Ziglio
The G_PID_FORMAT constant is defined only if GLib does not support it. The constant was wrongly defined. Jessie Debian 32 shows this issue (printf format error). Signed-off-by: Frediano Ziglio --- server/tests/test-glib-compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[Spice-devel] [PATCH spice-server 04/23] websocket: Simplify and fix constrain_iov

2019-06-25 Thread Frediano Ziglio
Use g_memdup instead of manual copy. Trim the original iov if necessary. Signed-off-by: Frediano Ziglio --- server/websocket.c | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/server/websocket.c b/server/websocket.c index 58f36da0a..fc1d82c28 100644

[Spice-devel] [PATCH spice-server 00/23] WebSocket support

2019-06-25 Thread Frediano Ziglio
Updated a longstanding patch for WebSocket support. This includes: - style updates: - types (C99 instead of GLib); - memory allocation (GLib instead of SPICE functions); - support for Windows; - different fixes; - automatic tests using Autobahn Testsuite; - some missing features: - PING/PONG

[Spice-devel] [PATCH spice-server 02/23] reds: Fix SSL_CTX_set_ecdh_auto call for some old OpenSSL

2019-06-25 Thread Frediano Ziglio
SSL_CTX_set_ecdh_auto is not defined in some old versions of OpenSSL Signed-off-by: Frediano Ziglio --- configure.ac | 9 + server/reds.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index e12d7e854..49c009d4c 100644 --- a/configure.ac +++ b/config

[Spice-devel] [PATCH spice-server 03/23] Add support for clients connecting with the WebSocket protocol.

2019-06-25 Thread Frediano Ziglio
From: Jeremy White We do this by auto detecting the inbound http(s) 'GET' and probing for a well formulated WebSocket binary connection, such as used by the spice-html5 client. If detected, we implement a set of cover functions that abstract the read/write/writev functions, in a fashion similar

Re: [Spice-devel] [spice v3] utils: Remove the LL suffix from NSEC_PER_SEC

2019-06-25 Thread Frediano Ziglio
> > > Uri Lublin wrote: > > When the variable is 64 bit, you can use a 64bit macro for printing, > > like PRId64. > > Wrong. Spice will fail to produce a 64 bit library if you add this > anywhere: > > uint64_t foo = 1234; > spice_debug("foo=%" PRId64, foo / NSEC_PER_SEC); > > Knowing t

Re: [Spice-devel] [spice v3] utils: Remove the LL suffix from NSEC_PER_SEC

2019-06-25 Thread Francois Gouget
Uri Lublin wrote: > When the variable is 64 bit, you can use a 64bit macro for printing, > like PRId64. Wrong. Spice will fail to produce a 64 bit library if you add this anywhere: uint64_t foo = 1234; spice_debug("foo=%" PRId64, foo / NSEC_PER_SEC); Knowing that the variable is 64 bit

[Spice-devel] [PATCH spice-gtk] channel-main: Fix typo in comment

2019-06-25 Thread Frediano Ziglio
explicitely -> explicitly Signed-off-by: Frediano Ziglio --- src/channel-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/channel-main.c b/src/channel-main.c index 10c31ac4..afdc1cef 100644 --- a/src/channel-main.c +++ b/src/channel-main.c @@ -1755,7 +1755,7 @@ stat

[Spice-devel] [PATCH spice-gtk] coroutine: Fix some indentation

2019-06-25 Thread Frediano Ziglio
These files have different indentation rules (8 spaces tabs instead of 4 spaces). Fix some wrong indentation. Signed-off-by: Frediano Ziglio --- src/continuation.c | 4 ++-- src/coroutine_ucontext.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/continuation.c b

Re: [Spice-devel] [spice v3] utils: Remove the LL suffix from NSEC_PER_SEC

2019-06-25 Thread Uri Lublin
On 6/25/19 7:38 AM, Francois Gouget wrote: On Mon, 17 Jun 2019, Uri Lublin wrote: On 6/15/19 2:59 PM, Frediano Ziglio wrote: This constant fits in a 32 bit signed integer so it does not need the suffix. However some of the derived constants don't so use an uint64_t cast to avoid the long vs l

Re: [Spice-devel] [spice v3] utils: Remove the LL suffix from NSEC_PER_SEC

2019-06-25 Thread Frediano Ziglio
> > On Mon, 17 Jun 2019, Uri Lublin wrote: > > > On 6/15/19 2:59 PM, Frediano Ziglio wrote: > > >> > > >> This constant fits in a 32 bit signed integer so it does not need the > > >> suffix. However some of the derived constants don't so use an uint64_t > > >> cast to avoid the long vs long long