summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2017-12-08 11:03:15 +0000
committerFrediano Ziglio <freddy77@gmail.com>2024-05-28 22:20:11 +0100
commit21066b2df029bf3d5fe6f519c5e7994588a5eeda (patch)
treebe5c08b05fed13bf69cef366d47f9e82d323c6f6
parente4a34804a148886fab763d4662d3af926af3b49f (diff)
avoid access to internal DisplayChannel structure
provide display_channel_stream_detach_and_stop and display_channel_stream_timeout also these function are more coherent having "display_channel_" prefix and accepting DisplayChannel*
-rw-r--r--server/dcc.cpp2
-rw-r--r--server/display-channel.cpp14
-rw-r--r--server/display-channel.h3
-rw-r--r--server/red-worker.cpp2
-rw-r--r--server/video-stream.cpp6
-rw-r--r--server/video-stream.h4
6 files changed, 21 insertions, 10 deletions
diff --git a/server/dcc.cpp b/server/dcc.cpp
index 8736a6d6..37432369 100644
--- a/server/dcc.cpp
+++ b/server/dcc.cpp
@@ -869,7 +869,7 @@ static int dcc_handle_preferred_video_codec_type(DisplayChannelClient *dcc,
/* New client preference */
dcc_update_preferred_video_codecs(dcc);
- video_stream_detach_and_stop(DCC_TO_DC(dcc));
+ video_stream_detach_and_stop(&DCC_TO_DC(dcc)->priv->streams_);
return TRUE;
}
diff --git a/server/display-channel.cpp b/server/display-channel.cpp
index 01c13b1c..943da6f3 100644
--- a/server/display-channel.cpp
+++ b/server/display-channel.cpp
@@ -134,6 +134,16 @@ int display_channel_get_streams_timeout(DisplayChannel *display)
return video_streams_get_timeout(&display->priv->streams_);
}
+void display_channel_stream_detach_and_stop(DisplayChannel *display)
+{
+ video_stream_detach_and_stop(&display->priv->streams_);
+}
+
+void display_channel_stream_timeout(DisplayChannel *display)
+{
+ video_stream_timeout(&display->priv->streams_);
+}
+
void display_channel_set_stream_video(DisplayChannel *display, int stream_video)
{
spice_return_if_fail(display);
@@ -153,7 +163,7 @@ void display_channel_set_video_codecs(DisplayChannel *display, GArray *video_cod
dcc_video_codecs_update(dcc);
}
- video_stream_detach_and_stop(display);
+ video_stream_detach_and_stop(&display->priv->streams_);
}
GArray *display_channel_get_video_codecs(DisplayChannel *display)
@@ -2415,7 +2425,7 @@ void DisplayChannelClient::migrate()
* Notice that detach_and_stop_streams won't lead to any dev ram changes, since
* handle_dev_stop already took care of releasing all the dev ram resources.
*/
- video_stream_detach_and_stop(display);
+ display_channel_stream_detach_and_stop(display);
if (is_connected()) {
RedChannelClient::migrate();
}
diff --git a/server/display-channel.h b/server/display-channel.h
index b82c0105..72002e08 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -154,6 +154,9 @@ void display_channel_update_qxl_running(DisplayChannel *display, bool running);
void display_channel_set_image_compression(DisplayChannel *display,
SpiceImageCompression image_compression);
+void display_channel_stream_detach_and_stop(DisplayChannel *display);
+void display_channel_stream_timeout(DisplayChannel *display);
+
#include "pop-visibility.h"
#endif /* DISPLAY_CHANNEL_H_ */
diff --git a/server/red-worker.cpp b/server/red-worker.cpp
index 912b7d55..8f5b3b54 100644
--- a/server/red-worker.cpp
+++ b/server/red-worker.cpp
@@ -916,7 +916,7 @@ static gboolean worker_source_dispatch(GSource *source, GSourceFunc callback,
display_channel_free_glz_drawables_to_free(display);
/* TODO: could use its own source */
- video_stream_timeout(display);
+ display_channel_stream_timeout(display);
worker->event_timeout = INF_EVENT_WAIT;
worker->was_blocked = FALSE;
diff --git a/server/video-stream.cpp b/server/video-stream.cpp
index 610fd238..bbf989e5 100644
--- a/server/video-stream.cpp
+++ b/server/video-stream.cpp
@@ -987,9 +987,8 @@ void video_streams_detach_behind(VideoStreams *streams,
}
}
-void video_stream_detach_and_stop(DisplayChannel *display)
+void video_stream_detach_and_stop(VideoStreams *streams)
{
- VideoStreams *streams = &display->priv->streams_;
RingItem *stream_item;
spice_debug("trace");
@@ -1001,9 +1000,8 @@ void video_stream_detach_and_stop(DisplayChannel *display)
}
}
-void video_stream_timeout(DisplayChannel *display)
+void video_stream_timeout(VideoStreams *streams)
{
- VideoStreams *streams = &display->priv->streams_;
Ring *ring = &streams->streams;
RingItem *item;
diff --git a/server/video-stream.h b/server/video-stream.h
index 563e9a6e..bac0e3c1 100644
--- a/server/video-stream.h
+++ b/server/video-stream.h
@@ -191,8 +191,8 @@ void video_streams_update_visible_region(VideoStreams *streams, Drawable *drawab
void video_streams_trace_update(VideoStreams *streams, Drawable *drawable);
void video_streams_maintenance(VideoStreams *streams, Drawable *candidate,
Drawable *prev);
-void video_stream_timeout(DisplayChannel *display);
-void video_stream_detach_and_stop(DisplayChannel *display);
+void video_stream_timeout(VideoStreams *streams);
+void video_stream_detach_and_stop(VideoStreams *streams);
void video_streams_trace_add_drawable(VideoStreams *streams, Drawable *item);
void video_streams_detach_behind(VideoStreams *streams, QRegion *region,
Drawable *drawable);