Commit Graph

2611 Commits

Author SHA1 Message Date
Frediano Ziglio
ed2e9d51f8 reds: Remove only assigned 'mcc' field
This field was never actually used, only changed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-05-18 16:30:08 +01:00
Pavel Grunt
073be0ea6d Add "fall through" comments where necessary
Make gcc 7.0.1 happy

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-05-16 13:42:51 +01:00
Frediano Ziglio
1b9cf935b7 spicevmc: Remove useless check
rcc is already deferenced in red_channel_client_get_client so
checking for NULL after that is uselss.

Also this call is generated from red_channel_client_disconnect
which requires the rcc pointer to be valid.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-05-03 12:35:13 +01:00
Jonathon Jongsma
3d84e1559f sound: don't store client in SndChannel
The base RedChannel already keeps a list of channel clients, so there's
no need for the SndChannel to also keep track of the client itself.

Since the SndChannel only supports a single client (whereas other
channels may have some partial support for multiple clients), I've
provided a convenience function for getting the client and warning if
there is more than one.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-05-02 10:10:35 -05:00
Jonathon Jongsma
74c2137b16 sound: Change snd_playback_start/snd_record_start
The content of these functions almost exclusively deals with channel
client functionality except one line where the channel's active state is
set to TRUE.

These functions are called in two different places.

The first place is from the public API spice_server_record_start() and
spice_server_playback_start(). These functions should alter the
channel's active state, and then set the associated channel client to
active.

The second place is when a new channel client is created. In this
case, it is only called if the channel is already active, so it doesn't
make much sense to set the channel's active state inside of the
function.

To simplify things (and enable some future refactoring), this function
now only deals with the SndChannelClient. The functions have also been
renamed to reflect this fact. The SndChannel's active state is now only
modified from the public API functions.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-05-02 10:10:35 -05:00
Jonathon Jongsma
601a5a2746 sound: use GList for global list of sound channels
Instead of putting a 'next' link within the channel structure itself,
just use a generic GList structure to keep a list of active sound
channels.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-05-02 10:10:35 -05:00
Jonathon Jongsma
a2ea1e1536 sound: Remove dead code in client constructors
When a new PlaybackChannelClient or RecordChannelClient is created,
there are several places where we make decisions based on whether the
client is active or not. But these checks are done before the 'active'
flag is ever set, so this code is effectively dead. This has been the
case since commit 6fdcb931 and d351bb35, so this code has not been
executed for approximately 7 years now.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-05-02 10:10:35 -05:00
Jonathon Jongsma
8c88597b48 sound: Remove on_new_record_channel_client()
It is only called from the constructor, so move all of the code into
that function.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-05-02 10:10:35 -05:00
Jonathon Jongsma
f37629996c sound: Remove on_new_playback_channel_client()
This function is only called from the constructor, so move all of that
code into the constructor.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-05-02 10:10:35 -05:00
Frediano Ziglio
ba9656757e red-parse-qxl: s/true/false
Reverse return values of the various bool methods so that 'true' means
success, and 'false' failure rather than the opposite.

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-05-02 11:30:47 +02:00
Christophe Fergeau
7e1ebc87b3 red-parse-qxl: Change int/1/0 to bool/true/false
The red_get_* methods in red-parse-qxl.c return a boolean, even though
their return type is an int, and they return 1/0. This commit changes
this to the more explicit bool/true/false.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-05-02 11:30:43 +02:00
Christophe Fergeau
16f7d71c18 red-parse-qxl: Use true/false rather than TRUE/FALSE
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-05-02 11:30:40 +02:00
Christophe Fergeau
df43483f71 Introduce WriteBufferOrigin enum typedef
This use to be an anonymous enum, used as an int in
RedCharDeviceWriteBufferPrivate::origin.
Introducing a typedef clarifies what kind of value it's holding.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
113b7c8f5e Make RedCharDeviceWriteBuffer::refs private
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
76a06bdef8 Make RedCharDeviceWriteBuffer::token_price private
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
8dc7505ae9 Make RedCharDeviceWriteBuffer::client private
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
3fe4c661ef Make RedCharDeviceWriteBuffer::origin private
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
968f3ab3e8 Add RedCharDeviceWriteBufferPrivate
This is intended to hold the fields that only char-device.c has a use
for, but for now this only adds the boilerplate for it, the next commit
will move the relevant field there.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
ecdef4930b Remove redundant code from red_channel_client_msg_sent()
red_channel_client_clear_sent_item() will clear send_data.blocked, so no
need to do it in red_channel_client_msg_sent() as well.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
2a3b6c2c00 Use red_channel_client_set_blocked() helper
Now that red_channel_client_set_blocked() is no longer changing the
events we are watching for, we can call it from
red_channel_client_push().

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
2eb491cb6b Don't modify watch when network queue is full
Since 5c460d, we need to watch for WATCH_EVENT_WRITE as long as there are
items queued waiting to be sent, this does not need to be done only when
the network queue is full.

When red_channel_client_set_blocked() is called, as a message is being
sent, WATCH_EVENT_WRITE will already be set, so it does not need to set
it again.
red_channel_client_msg_sent() removes WATCH_EVENT_WRITE, but this will
be done later anyway by red_channel_client_push() if needed.

Since it's redundant, we can remove this.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
68a4eaedf1 Remove unneeded red_channel_client_is_blocked() call
red_channel_client_msg_sent() calls red_channel_client_clear_sent_item()
which will clear the rcc->priv->send_data.blocked flag. Later on, it
contains a check for !red_channel_client_is_blocked(), which will always
be true as nothing in between could have set it again. This commit
removes this unneeded check.

This check was already redundant when it was introduced in
9a62a9a809

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
bf7bb4e886 Remove unneeded rcc->priv->latency_monitor.timer checks
Before this commit, red_channel_client_start_ping_timer() and
red_channel_client_cancel_ping_timer() had checks to be no-ops when
rcc->priv->latency_monitor.timer is NULL.

This commit adds a similar check to
red_channel_client_restart_ping_timer(), and removes explicit NULL
checks before calls to red_channel_client_{cancel,restart,start}_ping_timer()

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-04-28 16:59:25 +02:00
Frediano Ziglio
79c6ed0a9f Remove useless check
rcc is just used on the next line so cannot be NULL.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 15:33:29 +01:00
Christophe Fergeau
f9e7454509 Use enum rather than int in MainChannelClientPrivate::net_test_stage
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-04-26 17:44:22 +02:00
Pavel Grunt
5d836f3b70 display-channel: Remove extra 'the' in comment
Fixes `make syntax-check`

https://gitlab.com/spice/spice/builds/14346626

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-04-21 10:35:13 +01:00
Frediano Ziglio
ffff35c689 sound: Use bool type coherently
Many function already used bool as boolean type.
Change last gboolean occurrencies and values.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-04-20 09:11:11 +01:00
Christophe Fergeau
258c2234ba playback: Don't lose client connection after migration
Commit 590acf3c55 introduced a regression after migration:
PlaybackChannel::connection is never set even if a client is connected,
which means the playback channel is non-functional until a client
reconnects as all the snd_channel_set_xxx() method checks for a non-NULL
PlaybackChannel::connection before sending data to the client.

This commit slightly changes the code flow in
on_new_playback_channel_client()/playback_channel_client_constructed()
so that PlaybackChannel::connection is set regardless of what
red_client_during_migrate_at_target() returns. This is what was done
prior to 590acf3c55.

This resolves https://bugs.freedesktop.org/show_bug.cgi?id=100136

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-19 09:53:16 +01:00
Jonathon Jongsma
f23834ccb4 DisplayChannel: document exclude_region() functions
This is a particularly opaque part of the code for managing pending
Drawable operations. This patch adds documentation atempting to explain
these functions.
2017-04-13 11:18:13 -05:00
Jonathon Jongsma
ac6e7a4ebd Add debug output identifying audio codec
It can be useful for debug to know what the codec of the playback and
record channels are, so add a debug-level print statement indicating
this.

Resolves: rhbz#1436251

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-11 10:24:42 -05:00
Christophe Fergeau
c765e9f283 main-channel-client: Remove unused statistics code
Main-channel-client.c has code to send pings when the statistics code is
enabled. This is done through a timer calling a ping_timer_cb callback.
However, this timer is created but never started, so this code is
actually dead-code.

Since this code does not seem to be doing much apart from sending the
pings (which can be achieved by simply setting monitor-latency to TRUE
in main_channel_client_create()), this commit removes it.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-11 10:21:30 +02:00
Christophe Fergeau
cf3657d2e4 Use red_channel_client_is_blocked
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-11 10:21:30 +02:00
Christophe Fergeau
24020ab931 Use bool in RedChannelClientLatencyMonitor
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-11 10:21:30 +02:00
Christophe Fergeau
6ccd8721a4 Use enum rather than int in RedChannelClient{Latency,Connectivity}Monitor
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-11 10:21:30 +02:00
Christophe Fergeau
54146811b2 Use bool in ConnectivityMonitor
Their uint32_t value is never used, all that matters is whether we
received data or not.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-11 10:21:30 +02:00
Christophe Fergeau
9770428c0d Remove one more unused "monitor_latency" arguments
This was missed in commit db9dcd9.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-11 10:21:30 +02:00
Jonathon Jongsma
72d5a6bd8f Test client caps separately
in main_channel_push_agent_connected(), it used the convenience function
red_channel_test_remote_cap() to determine whether to send the
AGENT_CONNECTED_TOKENS message, or the AGENT_CONNECTED message. However,
this function returns false if *any* one client doesn't support the
capability. We should instead check each individual client separately to
see if they support the capability.
2017-04-07 15:08:43 -05:00
Jonathon Jongsma
1b18fd76d1 Remove unused red_channel_test_remote_common_cap()
This was a convenience function around
red_channel_client_test_remote_common_cap() that simply iterated over
each client (currently we only really support a single client anyway)
and returned TRUE only if all clients supported the capability. But
nobody ever called this wrapper function.
2017-04-07 15:08:43 -05:00
Jonathon Jongsma
a5c15dfadf Remove extra space between "!" and variable name 2017-04-07 15:08:43 -05:00
Jonathon Jongsma
9d49c6bb03 snd_desired_audio_mode: change arguments to bool
client_can_celt and client_can_opus are true/false values, so use
'bool' type instead of 'int.
2017-04-07 15:08:43 -05:00
Jonathon Jongsma
9b0824bae4 red_channel_client_test_remote_cap() returns bool
Both _test_remote_cap() and _test_remote_common_cap() are used as
boolean values, so change the return type from int to bool to follow our
coding standard.
2017-04-07 15:08:43 -05:00
Jonathon Jongsma
332ad52143 Change playback_compression to bool type
This is a setting for determining whether to compress the audio playback
channel or not. It is variously typed as int or uint32_t. Convert it to
a 'bool' to make it more clear that it is a true/false value rather than
an enumeration or something like that.
2017-04-07 15:08:43 -05:00
Frediano Ziglio
dfe9fe9ebe test: Add vp9 support to GStreamer test
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-07 16:45:54 +01:00
Frediano Ziglio
e9035e5239 Attempt to create bitmap debug directory
The DUMP_BITMAP compile option enable some debugging code to
output image bitmaps in a subdirectory of /tmp.
However if this directory does not exists the server will crash
as not able to create a file in it.
Try to create directory before creating the file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-07 16:45:54 +01:00
Frediano Ziglio
4725ec03b1 gstreamer: Remove some leaks if pipeline cannot be created
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-04-07 16:45:49 +01:00
Christophe Fergeau
78c3dd4c18 Make various functions static
- glz_enc_dictionary_reset
- monitors_config_new
- red_channel_any_blocked
- red_channel_no_item_being_sent
- red_client_get_channel

are only used in the file where they are defined, so they can as well be
static.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-04-05 12:39:20 +02:00
Christophe Fergeau
27a9450d07 build-sys: Add configure check for TCP_KEEPIDLE
This is only available in newer FreeBSD releases (9.1 and later), and
will cause build errors or older versions

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=99213

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-31 12:22:52 +02:00
Christophe Fergeau
eb9f69ed9a reds-stream: Introduce reds_stream_get_no_delay() helper
This new function removes one place outside of RedsStream which needs to
access RedsStream::socket

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-31 12:22:52 +02:00
Christophe Fergeau
5ca3d6ca50 net: Introduce red_socket_set_keepalive() helper
This allows to move some low-level code out of reds.c

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-31 12:22:52 +02:00
Christophe Fergeau
b85ca4b8a9 net: Introduce red_socket_set_non_blocking() helper
This allows to move some low-level code out of reds.c

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-31 12:22:52 +02:00