[Spice-devel] [PATCH spice-server 13/15] Rename StreamAgent to VideoStreamAgent

Jonathon Jongsma jjongsma at redhat.com
Fri Oct 20 21:13:18 UTC 2017


Just to avoid confusion between different uses of the word Stream (e.g.
RedStream) clarify that it's related to video streams

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 server/dcc-private.h  |  2 +-
 server/dcc-send.c     | 14 ++++++++------
 server/dcc.c          | 42 +++++++++++++++++++++---------------------
 server/dcc.h          | 16 ++++++++--------
 server/video-stream.c | 10 +++++-----
 server/video-stream.h |  8 ++++----
 6 files changed, 47 insertions(+), 45 deletions(-)

diff --git a/server/dcc-private.h b/server/dcc-private.h
index 76e194fe3..848d42702 100644
--- a/server/dcc-private.h
+++ b/server/dcc-private.h
@@ -61,7 +61,7 @@ struct DisplayChannelClientPrivate
     uint8_t surface_client_created[NUM_SURFACES];
     QRegion surface_client_lossy_region[NUM_SURFACES];
 
-    StreamAgent stream_agents[NUM_STREAMS];
+    VideoStreamAgent stream_agents[NUM_STREAMS];
     uint32_t streams_max_latency;
     uint64_t streams_max_bit_rate;
     bool gl_draw_ongoing;
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 86de5aff3..c6487be7f 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1708,7 +1708,7 @@ static bool red_marshall_stream_data(RedChannelClient *rcc,
         return FALSE;
     }
 
-    StreamAgent *agent = &dcc->priv->stream_agents[display_channel_get_stream_id(display, stream)];
+    VideoStreamAgent *agent = &dcc->priv->stream_agents[display_channel_get_stream_id(display, stream)];
     VideoBuffer *outbuf;
     /* workaround for vga streams */
     frame_mm_time =  drawable->red_drawable->mm_time ?
@@ -2150,7 +2150,8 @@ static void marshall_qxl_drawable(RedChannelClient *rcc,
 }
 
 static void marshall_stream_start(RedChannelClient *rcc,
-                                  SpiceMarshaller *base_marshaller, StreamAgent *agent)
+                                  SpiceMarshaller *base_marshaller,
+                                  VideoStreamAgent *agent)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     VideoStream *stream = agent->stream;
@@ -2194,7 +2195,7 @@ static void marshall_stream_clip(RedChannelClient *rcc,
                                  RedStreamClipItem *item)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
-    StreamAgent *agent = item->stream_agent;
+    VideoStreamAgent *agent = item->stream_agent;
 
     spice_return_if_fail(agent->stream);
 
@@ -2209,14 +2210,15 @@ static void marshall_stream_clip(RedChannelClient *rcc,
 }
 
 static void marshall_stream_end(RedChannelClient *rcc,
-                                SpiceMarshaller *base_marshaller, StreamAgent* agent)
+                                SpiceMarshaller *base_marshaller,
+                                VideoStreamAgent* agent)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     SpiceMsgDisplayStreamDestroy destroy;
 
     red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DESTROY);
     destroy.id = display_channel_get_stream_id(DCC_TO_DC(dcc), agent->stream);
-    stream_agent_stop(agent);
+    video_stream_agent_stop(agent);
     spice_marshall_msg_display_stream_destroy(base_marshaller, &destroy);
 }
 
@@ -2307,7 +2309,7 @@ static void marshall_stream_activate_report(RedChannelClient *rcc,
                                             uint32_t stream_id)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
-    StreamAgent *agent = &dcc->priv->stream_agents[stream_id];
+    VideoStreamAgent *agent = &dcc->priv->stream_agents[stream_id];
     SpiceMsgDisplayStreamActivateReport msg;
 
     red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT);
diff --git a/server/dcc.c b/server/dcc.c
index ce6a9bcdc..60cb005db 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -47,12 +47,12 @@ static void red_stream_clip_item_free(RedPipeItem *base)
 
     g_return_if_fail(item->base.refcount == 0);
 
-    stream_agent_unref(item->stream_agent);
+    video_stream_agent_unref(item->stream_agent);
     g_free(item->rects);
     g_free(item);
 }
 
-static RedStreamClipItem *red_stream_clip_item_new(StreamAgent *agent)
+static RedStreamClipItem *red_stream_clip_item_new(VideoStreamAgent *agent)
 {
     RedStreamClipItem *item = g_new(RedStreamClipItem, 1);
     red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_STREAM_CLIP,
@@ -510,7 +510,7 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
     DisplayChannel *display = DCC_TO_DC(dcc);
 
     for (i = 0; i < NUM_STREAMS; i++) {
-        StreamAgent *agent = &dcc->priv->stream_agents[i];
+        VideoStreamAgent *agent = &dcc->priv->stream_agents[i];
         agent->stream = display_channel_get_nth_stream(display, i);
         region_init(&agent->vis_region);
         region_init(&agent->clip);
@@ -624,7 +624,7 @@ static void dcc_destroy_stream_agents(DisplayChannelClient *dcc)
     int i;
 
     for (i = 0; i < NUM_STREAMS; i++) {
-        StreamAgent *agent = &dcc->priv->stream_agents[i];
+        VideoStreamAgent *agent = &dcc->priv->stream_agents[i];
         region_destroy(&agent->vis_region);
         region_destroy(&agent->clip);
         if (agent->video_encoder) {
@@ -650,7 +650,7 @@ static void dcc_stop(DisplayChannelClient *dcc)
     }
 }
 
-void dcc_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent)
+void dcc_stream_agent_clip(DisplayChannelClient* dcc, VideoStreamAgent *agent)
 {
     RedStreamClipItem *item = red_stream_clip_item_new(agent);
     int n_rects;
@@ -1064,7 +1064,7 @@ static bool dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *ini
 static bool dcc_handle_stream_report(DisplayChannelClient *dcc,
                                      SpiceMsgcDisplayStreamReport *report)
 {
-    StreamAgent *agent;
+    VideoStreamAgent *agent;
 
     if (report->stream_id >= NUM_STREAMS) {
         spice_warning("stream_report: invalid stream id %u",
@@ -1409,7 +1409,7 @@ bool dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mes
 void dcc_update_stream_visible_region(DisplayChannelClient *dcc, int stream_id,
                                       QRegion *region)
 {
-    StreamAgent *agent = dcc_get_stream_agent(dcc, stream_id);
+    VideoStreamAgent *agent = dcc_get_stream_agent(dcc, stream_id);
 
     if (region_intersects(&agent->vis_region, region)) {
         region_exclude(&agent->vis_region, region);
@@ -1418,7 +1418,7 @@ void dcc_update_stream_visible_region(DisplayChannelClient *dcc, int stream_id,
     }
 }
 
-StreamAgent* dcc_get_stream_agent(DisplayChannelClient *dcc, int stream_id)
+VideoStreamAgent* dcc_get_stream_agent(DisplayChannelClient *dcc, int stream_id)
 {
     return &dcc->priv->stream_agents[stream_id];
 }
@@ -1493,7 +1493,7 @@ gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc)
     return dcc->is_low_bandwidth;
 }
 
-void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remove_agent)
+void dcc_update_streams_max_latency(DisplayChannelClient *dcc, VideoStreamAgent *remove_agent)
 {
     uint32_t new_max_latency = 0;
     int i;
@@ -1507,7 +1507,7 @@ void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remo
         return;
     }
     for (i = 0; i < NUM_STREAMS; i++) {
-        StreamAgent *other_agent = dcc_get_stream_agent(dcc, i);
+        VideoStreamAgent *other_agent = dcc_get_stream_agent(dcc, i);
         if (other_agent == remove_agent || !other_agent->video_encoder) {
             continue;
         }
@@ -1521,11 +1521,11 @@ void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remo
 static void stream_create_destroy_item_release(RedPipeItem *base)
 {
     StreamCreateDestroyItem *item = SPICE_UPCAST(StreamCreateDestroyItem, base);
-    stream_agent_unref(item->agent);
+    video_stream_agent_unref(item->agent);
     g_free(item);
 }
 
-static RedPipeItem *stream_create_destroy_item_new(StreamAgent *agent, gint type)
+static RedPipeItem *stream_create_destroy_item_new(VideoStreamAgent *agent, gint type)
 {
     StreamCreateDestroyItem *item = g_new0(StreamCreateDestroyItem, 1);
 
@@ -1536,12 +1536,12 @@ static RedPipeItem *stream_create_destroy_item_new(StreamAgent *agent, gint type
     return &item->base;
 }
 
-RedPipeItem *stream_create_item_new(StreamAgent *agent)
+RedPipeItem *stream_create_item_new(VideoStreamAgent *agent)
 {
     return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_CREATE);
 }
 
-RedPipeItem *stream_destroy_item_new(StreamAgent *agent)
+RedPipeItem *stream_destroy_item_new(VideoStreamAgent *agent)
 {
     return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
 }
@@ -1595,7 +1595,7 @@ static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, VideoStream *str
 
 static uint32_t get_roundtrip_ms(void *opaque)
 {
-    StreamAgent *agent = opaque;
+    VideoStreamAgent *agent = opaque;
     int roundtrip;
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(agent->dcc);
 
@@ -1616,14 +1616,14 @@ static uint32_t get_roundtrip_ms(void *opaque)
 
 static uint32_t get_source_fps(void *opaque)
 {
-    StreamAgent *agent = opaque;
+    VideoStreamAgent *agent = opaque;
 
     return agent->stream->input_fps;
 }
 
 static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
 {
-    StreamAgent *agent = opaque;
+    VideoStreamAgent *agent = opaque;
     DisplayChannelClient *dcc = agent->dcc;
     RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(dcc));
     RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(dcc));
@@ -1694,7 +1694,7 @@ static VideoEncoder* dcc_create_video_encoder(DisplayChannelClient *dcc,
 
 void dcc_create_stream(DisplayChannelClient *dcc, VideoStream *stream)
 {
-    StreamAgent *agent = dcc_get_stream_agent(dcc, display_channel_get_stream_id(DCC_TO_DC(dcc), stream));
+    VideoStreamAgent *agent = dcc_get_stream_agent(dcc, display_channel_get_stream_id(DCC_TO_DC(dcc), stream));
 
     spice_return_if_fail(region_is_empty(&agent->vis_region));
 
@@ -1732,7 +1732,7 @@ void dcc_create_stream(DisplayChannelClient *dcc, VideoStream *stream)
 #endif
 }
 
-static void stream_agent_stats_print(StreamAgent *agent)
+static void stream_agent_stats_print(VideoStreamAgent *agent)
 {
 #ifdef STREAM_STATS
     StreamStats *stats = &agent->stats;
@@ -1770,7 +1770,7 @@ static void stream_agent_stats_print(StreamAgent *agent)
 
 void dcc_stream_stop(DisplayChannelClient *dcc, int stream_id)
 {
-    StreamAgent *stream_agent = dcc_get_stream_agent(dcc, stream_id);
+    VideoStreamAgent *stream_agent = dcc_get_stream_agent(dcc, stream_id);
     region_clear(&stream_agent->vis_region);
     region_clear(&stream_agent->clip);
     if (stream_agent->video_encoder) {
@@ -1789,7 +1789,7 @@ void dcc_stream_stop(DisplayChannelClient *dcc, int stream_id)
 
 void dcc_attach_stream(DisplayChannelClient *dcc, Drawable *drawable, int stream_id)
 {
-    StreamAgent *agent;
+    VideoStreamAgent *agent;
     QRegion clip_in_draw_dest;
 
     agent = dcc_get_stream_agent(dcc, stream_id);
diff --git a/server/dcc.h b/server/dcc.h
index 68b816ec4..f9c6052a2 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -79,7 +79,7 @@ GType display_channel_client_get_type(void) G_GNUC_CONST;
 
 typedef struct DisplayChannel DisplayChannel;
 typedef struct VideoStream VideoStream;
-typedef struct StreamAgent StreamAgent;
+typedef struct VideoStreamAgent VideoStreamAgent;
 
 typedef struct WaitForChannels {
     SpiceMsgWaitForChannels header;
@@ -147,7 +147,7 @@ void                       dcc_push_monitors_config                  (DisplayCha
 void                       dcc_destroy_surface                       (DisplayChannelClient *dcc,
                                                                       uint32_t surface_id);
 void                       dcc_stream_agent_clip                     (DisplayChannelClient* dcc,
-                                                                      StreamAgent *agent);
+                                                                      VideoStreamAgent *agent);
 void                       dcc_create_stream                         (DisplayChannelClient *dcc,
                                                                       VideoStream *stream);
 void                       dcc_create_surface                        (DisplayChannelClient *dcc,
@@ -192,7 +192,7 @@ int                        dcc_compress_image                        (DisplayCha
 void                       dcc_update_stream_visible_region          (DisplayChannelClient *dcc,
                                                                       int stream_id,
                                                                       QRegion *region);
-StreamAgent *              dcc_get_stream_agent                      (DisplayChannelClient *dcc, int stream_id);
+VideoStreamAgent *         dcc_get_stream_agent                      (DisplayChannelClient *dcc, int stream_id);
 ImageEncoders *dcc_get_encoders(DisplayChannelClient *dcc);
 spice_wan_compression_t    dcc_get_jpeg_state                        (DisplayChannelClient *dcc);
 spice_wan_compression_t    dcc_get_zlib_glz_state                    (DisplayChannelClient *dcc);
@@ -202,24 +202,24 @@ uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc);
 void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate);
 gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc);
 GArray *dcc_get_preferred_video_codecs_for_encoding(DisplayChannelClient *dcc);
-void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remove_agent);
+void dcc_update_streams_max_latency(DisplayChannelClient *dcc, VideoStreamAgent *remove_agent);
 void dcc_stream_stop(DisplayChannelClient *dcc, int stream_id);
 void dcc_attach_stream(DisplayChannelClient *dcc, Drawable *drawable, int stream_id);
 
 typedef struct RedStreamClipItem {
     RedPipeItem base;
-    StreamAgent *stream_agent;
+    VideoStreamAgent *stream_agent;
     int clip_type;
     SpiceClipRects *rects;
 } RedStreamClipItem;
 
 typedef struct StreamCreateDestroyItem {
     RedPipeItem base;
-    StreamAgent *agent;
+    VideoStreamAgent *agent;
 } StreamCreateDestroyItem;
 
-RedPipeItem *stream_create_item_new(StreamAgent *agent);
-RedPipeItem *stream_destroy_item_new(StreamAgent *agent);
+RedPipeItem *stream_create_item_new(VideoStreamAgent *agent);
+RedPipeItem *stream_destroy_item_new(VideoStreamAgent *agent);
 G_END_DECLS
 
 #endif /* DCC_H_ */
diff --git a/server/video-stream.c b/server/video-stream.c
index fae51550e..757497950 100644
--- a/server/video-stream.c
+++ b/server/video-stream.c
@@ -81,7 +81,7 @@ void video_stream_unref(VideoStream *stream)
     video_stream_free(stream);
 }
 
-void stream_agent_unref(StreamAgent *agent)
+void video_stream_agent_unref(VideoStreamAgent *agent)
 {
     video_stream_unref(agent->stream);
 }
@@ -216,7 +216,7 @@ static void before_reattach_stream(DisplayChannel *display,
 {
     DisplayChannelClient *dcc;
     int index;
-    StreamAgent *agent;
+    VideoStreamAgent *agent;
     GList *dpi_link, *dpi_next;
 
     spice_return_if_fail(stream->current);
@@ -431,7 +431,7 @@ void video_stream_maintenance(DisplayChannel *display,
     }
 }
 
-void stream_agent_stop(StreamAgent *agent)
+void video_stream_agent_stop(VideoStreamAgent *agent)
 {
     DisplayChannelClient *dcc = agent->dcc;
 
@@ -465,7 +465,7 @@ static void dcc_detach_video_stream_gracefully(DisplayChannelClient *dcc,
 {
     DisplayChannel *display = DCC_TO_DC(dcc);
     int stream_id = display_channel_get_stream_id(display, stream);
-    StreamAgent *agent = dcc_get_stream_agent(dcc, stream_id);
+    VideoStreamAgent *agent = dcc_get_stream_agent(dcc, stream_id);
 
     /* stopping the client from playing older frames at once*/
     region_clear(&agent->clip);
@@ -561,7 +561,7 @@ void video_stream_detach_behind(DisplayChannel *display, QRegion *region,
         item = ring_next(ring, item);
 
         FOREACH_DCC(display, dcc) {
-            StreamAgent *agent = dcc_get_stream_agent(dcc, display_channel_get_stream_id(display, stream));
+            VideoStreamAgent *agent = dcc_get_stream_agent(dcc, display_channel_get_stream_id(display, stream));
 
             if (region_intersects(&agent->vis_region, region)) {
                 dcc_detach_video_stream_gracefully(dcc, stream, drawable);
diff --git a/server/video-stream.h b/server/video-stream.h
index 40c3a4f7c..f818c8c5d 100644
--- a/server/video-stream.h
+++ b/server/video-stream.h
@@ -63,7 +63,7 @@ typedef struct StreamStats {
 } StreamStats;
 #endif
 
-typedef struct StreamAgent {
+typedef struct VideoStreamAgent {
     QRegion vis_region; /* the part of the surface area that is currently occupied by video
                            fragments */
     QRegion clip;       /* the current video clipping. It can be different from vis_region:
@@ -84,7 +84,7 @@ typedef struct StreamAgent {
 #ifdef STREAM_STATS
     StreamStats stats;
 #endif
-} StreamAgent;
+} VideoStreamAgent;
 
 typedef struct ItemTrace {
     red_time_t time;
@@ -131,8 +131,8 @@ void                  video_stream_detach_behind                    (DisplayChan
                                                                      QRegion *region,
                                                                      Drawable *drawable);
 
-void                  stream_agent_unref                            (StreamAgent *agent);
-void                  stream_agent_stop                             (StreamAgent *agent);
+void                  video_stream_agent_unref                      (VideoStreamAgent *agent);
+void                  video_stream_agent_stop                       (VideoStreamAgent *agent);
 
 void video_stream_detach_drawable(VideoStream *stream);
 
-- 
2.13.6



More information about the Spice-devel mailing list