[PATCH spice-server 2/2] Rename StreamAgent to VideoStreamAgent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 server/dcc-private.h     |  2 +-
 server/dcc-send.c        | 14 +++++++------
 server/dcc.c             | 10 ++++-----
 server/dcc.h             |  8 +++----
 server/display-channel.c |  6 +++---
 server/video-stream.c    | 54 +++++++++++++++++++++++++-----------------------
 server/video-stream.h    | 16 +++++++-------
 7 files changed, 57 insertions(+), 53 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 271c97801..6d57767b3 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_video_stream_id(display, stream)];
+    VideoStreamAgent *agent = &dcc->priv->stream_agents[display_channel_get_video_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_video_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 951d1e9f5..628b33edb 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -487,7 +487,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_video_stream(display, i);
         region_init(&agent->vis_region);
         region_init(&agent->clip);
@@ -601,7 +601,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) {
@@ -627,7 +627,7 @@ static void dcc_stop(DisplayChannelClient *dcc)
     }
 }
 
-void dcc_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent)
+void dcc_video_stream_agent_clip(DisplayChannelClient* dcc, VideoStreamAgent *agent)
 {
     RedStreamClipItem *item = red_stream_clip_item_new(agent);
     int n_rects;
@@ -1041,7 +1041,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",
@@ -1383,7 +1383,7 @@ bool dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mes
     return TRUE;
 }
 
-StreamAgent* dcc_get_stream_agent(DisplayChannelClient *dcc, int stream_id)
+VideoStreamAgent* dcc_get_video_stream_agent(DisplayChannelClient *dcc, int stream_id)
 {
     return &dcc->priv->stream_agents[stream_id];
 }
diff --git a/server/dcc.h b/server/dcc.h
index 8ee0bd78a..ec7dc3ca9 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;
@@ -146,8 +146,8 @@ bool                       dcc_handle_migrate_data                   (DisplayCha
 void                       dcc_push_monitors_config                  (DisplayChannelClient *dcc);
 void                       dcc_destroy_surface                       (DisplayChannelClient *dcc,
                                                                       uint32_t surface_id);
-void                       dcc_stream_agent_clip                     (DisplayChannelClient* dcc,
-                                                                      StreamAgent *agent);
+void                       dcc_video_stream_agent_clip               (DisplayChannelClient* dcc,
+                                                                      VideoStreamAgent *agent);
 void                       dcc_create_stream                         (DisplayChannelClient *dcc,
                                                                       VideoStream *stream);
 void                       dcc_create_surface                        (DisplayChannelClient *dcc,
@@ -189,7 +189,7 @@ int                        dcc_compress_image                        (DisplayCha
                                                                       int can_lossy,
                                                                       compress_send_data_t* o_comp_data);
 
-StreamAgent *              dcc_get_stream_agent                      (DisplayChannelClient *dcc, int stream_id);
+VideoStreamAgent *         dcc_get_video_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);
diff --git a/server/display-channel.c b/server/display-channel.c
index edb1bbd0f..1caec7ea5 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -341,7 +341,7 @@ static void streams_update_visible_region(DisplayChannel *display, Drawable *dra
 
     while (item) {
         VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
-        StreamAgent *agent;
+        VideoStreamAgent *agent;
 
         item = ring_next(ring, item);
 
@@ -350,12 +350,12 @@ static void streams_update_visible_region(DisplayChannel *display, Drawable *dra
         }
 
         FOREACH_DCC(display, dcc) {
-            agent = dcc_get_stream_agent(dcc, display_channel_get_video_stream_id(display, stream));
+            agent = dcc_get_video_stream_agent(dcc, display_channel_get_video_stream_id(display, stream));
 
             if (region_intersects(&agent->vis_region, &drawable->tree_item.base.rgn)) {
                 region_exclude(&agent->vis_region, &drawable->tree_item.base.rgn);
                 region_exclude(&agent->clip, &drawable->tree_item.base.rgn);
-                dcc_stream_agent_clip(dcc, agent);
+                dcc_video_stream_agent_clip(dcc, agent);
             }
         }
     }
diff --git a/server/video-stream.c b/server/video-stream.c
index 85dcd5dfb..a16ecb9f6 100644
--- a/server/video-stream.c
+++ b/server/video-stream.c
@@ -27,7 +27,7 @@
 #define FOREACH_STREAMS(display, item)                  \
     RING_FOREACH(item, &(display)->priv->streams)
 
-static void stream_agent_stats_print(StreamAgent *agent)
+static void video_stream_agent_stats_print(VideoStreamAgent *agent)
 {
 #ifdef STREAM_STATS
     StreamStats *stats = &agent->stats;
@@ -67,11 +67,12 @@ static void video_stream_create_destroy_item_release(RedPipeItem *base)
 {
     StreamCreateDestroyItem *item = SPICE_UPCAST(StreamCreateDestroyItem, base);
     DisplayChannel *display = DCC_TO_DC(item->agent->dcc);
-    stream_agent_unref(display, item->agent);
+    video_stream_agent_unref(display, item->agent);
     g_free(item);
 }
 
-static RedPipeItem *video_stream_create_destroy_item_new(StreamAgent *agent, gint type)
+static RedPipeItem *video_stream_create_destroy_item_new(VideoStreamAgent *agent,
+                                                         gint type)
 {
     StreamCreateDestroyItem *item = g_new0(StreamCreateDestroyItem, 1);
 
@@ -82,12 +83,12 @@ static RedPipeItem *video_stream_create_destroy_item_new(StreamAgent *agent, gin
     return &item->base;
 }
 
-static RedPipeItem *video_stream_create_item_new(StreamAgent *agent)
+static RedPipeItem *video_stream_create_item_new(VideoStreamAgent *agent)
 {
     return video_stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_CREATE);
 }
 
-static RedPipeItem *video_stream_destroy_item_new(StreamAgent *agent)
+static RedPipeItem *video_stream_destroy_item_new(VideoStreamAgent *agent)
 {
     return video_stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
 }
@@ -102,9 +103,9 @@ void video_stream_stop(DisplayChannel *display, VideoStream *stream)
 
     spice_debug("stream %d", display_channel_get_video_stream_id(display, stream));
     FOREACH_DCC(display, dcc) {
-        StreamAgent *stream_agent;
+        VideoStreamAgent *stream_agent;
 
-        stream_agent = dcc_get_stream_agent(dcc, display_channel_get_video_stream_id(display, stream));
+        stream_agent = dcc_get_video_stream_agent(dcc, display_channel_get_video_stream_id(display, stream));
         region_clear(&stream_agent->vis_region);
         region_clear(&stream_agent->clip);
         if (stream_agent->video_encoder) {
@@ -118,7 +119,7 @@ void video_stream_stop(DisplayChannel *display, VideoStream *stream)
             }
         }
         red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), video_stream_destroy_item_new(stream_agent));
-        stream_agent_stats_print(stream_agent);
+        video_stream_agent_stats_print(stream_agent);
     }
     display->priv->streams_size_total -= stream->width * stream->height;
     ring_remove(&stream->link);
@@ -155,7 +156,7 @@ void video_stream_unref(DisplayChannel *display, VideoStream *stream)
     display->priv->stream_count--;
 }
 
-void stream_agent_unref(DisplayChannel *display, StreamAgent *agent)
+void video_stream_agent_unref(DisplayChannel *display, VideoStreamAgent *agent)
 {
     video_stream_unref(display, agent->stream);
 }
@@ -168,12 +169,12 @@ static void red_stream_clip_item_free(RedPipeItem *base)
 
     g_return_if_fail(item->base.refcount == 0);
 
-    stream_agent_unref(display, item->stream_agent);
+    video_stream_agent_unref(display, item->stream_agent);
     g_free(item->rects);
     g_free(item);
 }
 
-RedStreamClipItem *red_stream_clip_item_new(StreamAgent *agent)
+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,
@@ -297,10 +298,10 @@ static void attach_stream(DisplayChannel *display, Drawable *drawable, VideoStre
     }
 
     FOREACH_DCC(display, dcc) {
-        StreamAgent *agent;
+        VideoStreamAgent *agent;
         QRegion clip_in_draw_dest;
 
-        agent = dcc_get_stream_agent(dcc, display_channel_get_video_stream_id(display, stream));
+        agent = dcc_get_video_stream_agent(dcc, display_channel_get_video_stream_id(display, stream));
         region_or(&agent->vis_region, &drawable->tree_item.base.rgn);
 
         region_init(&clip_in_draw_dest);
@@ -310,7 +311,7 @@ static void attach_stream(DisplayChannel *display, Drawable *drawable, VideoStre
         if (!region_is_equal(&clip_in_draw_dest, &drawable->tree_item.base.rgn)) {
             region_remove(&agent->clip, &drawable->red_drawable->bbox);
             region_or(&agent->clip, &drawable->tree_item.base.rgn);
-            dcc_stream_agent_clip(dcc, agent);
+            dcc_video_stream_agent_clip(dcc, agent);
         }
         region_destroy(&clip_in_draw_dest);
 #ifdef STREAM_STATS
@@ -332,7 +333,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);
@@ -351,7 +352,7 @@ static void before_reattach_stream(DisplayChannel *display,
         RedDrawablePipeItem *dpi = dpi_link->data;
         dpi_next = dpi_link->next;
         dcc = dpi->dcc;
-        agent = dcc_get_stream_agent(dcc, index);
+        agent = dcc_get_video_stream_agent(dcc, index);
 
         if (red_channel_client_pipe_item_is_linked(RED_CHANNEL_CLIENT(dcc),
                                                    &dpi->dpi_pipe_item)) {
@@ -546,7 +547,8 @@ void video_stream_maintenance(DisplayChannel *display,
     }
 }
 
-static void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remove_agent)
+static void dcc_update_streams_max_latency(DisplayChannelClient *dcc,
+                                           VideoStreamAgent *remove_agent)
 {
     uint32_t new_max_latency = 0;
     int i;
@@ -560,7 +562,7 @@ static void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgen
         return;
     }
     for (i = 0; i < NUM_STREAMS; i++) {
-        StreamAgent *other_agent = dcc_get_stream_agent(dcc, i);
+        VideoStreamAgent *other_agent = dcc_get_video_stream_agent(dcc, i);
         if (other_agent == remove_agent || !other_agent->video_encoder) {
             continue;
         }
@@ -620,7 +622,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);
 
@@ -641,14 +643,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));
@@ -719,7 +721,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_video_stream_id(DCC_TO_DC(dcc), stream));
+    VideoStreamAgent *agent = dcc_get_video_stream_agent(dcc, display_channel_get_video_stream_id(DCC_TO_DC(dcc), stream));
 
     spice_return_if_fail(region_is_empty(&agent->vis_region));
 
@@ -757,7 +759,7 @@ void dcc_create_stream(DisplayChannelClient *dcc, VideoStream *stream)
 #endif
 }
 
-void stream_agent_stop(StreamAgent *agent)
+void video_stream_agent_stop(VideoStreamAgent *agent)
 {
     DisplayChannelClient *dcc = agent->dcc;
 
@@ -791,11 +793,11 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
 {
     DisplayChannel *display = DCC_TO_DC(dcc);
     int stream_id = display_channel_get_video_stream_id(display, stream);
-    StreamAgent *agent = dcc_get_stream_agent(dcc, stream_id);
+    VideoStreamAgent *agent = dcc_get_video_stream_agent(dcc, stream_id);
 
     /* stopping the client from playing older frames at once*/
     region_clear(&agent->clip);
-    dcc_stream_agent_clip(dcc, agent);
+    dcc_video_stream_agent_clip(dcc, agent);
 
     if (region_is_empty(&agent->vis_region)) {
         spice_debug("stream %d: vis region empty", stream_id);
@@ -886,7 +888,7 @@ void video_stream_detach_behind(DisplayChannel *display, QRegion *region, Drawab
         item = ring_next(ring, item);
 
         FOREACH_DCC(display, dcc) {
-            StreamAgent *agent = dcc_get_stream_agent(dcc, display_channel_get_video_stream_id(display, stream));
+            VideoStreamAgent *agent = dcc_get_video_stream_agent(dcc, display_channel_get_video_stream_id(display, stream));
 
             if (region_intersects(&agent->vis_region, region)) {
                 dcc_detach_stream_gracefully(dcc, stream, drawable);
diff --git a/server/video-stream.h b/server/video-stream.h
index 48f13f52b..15ab7ecc9 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,20 +84,20 @@ typedef struct StreamAgent {
 #ifdef STREAM_STATS
     StreamStats stats;
 #endif
-} StreamAgent;
+} VideoStreamAgent;
 
 typedef struct RedStreamClipItem {
     RedPipeItem base;
-    StreamAgent *stream_agent;
+    VideoStreamAgent *stream_agent;
     int clip_type;
     SpiceClipRects *rects;
 } RedStreamClipItem;
 
-RedStreamClipItem *   red_stream_clip_item_new                      (StreamAgent *agent);
+RedStreamClipItem *   red_stream_clip_item_new                      (VideoStreamAgent *agent);
 
 typedef struct StreamCreateDestroyItem {
     RedPipeItem base;
-    StreamAgent *agent;
+    VideoStreamAgent *agent;
 } StreamCreateDestroyItem;
 
 typedef struct ItemTrace {
@@ -145,9 +145,9 @@ void                  video_stream_detach_behind                    (DisplayChan
                                                                      QRegion *region,
                                                                      Drawable *drawable);
 
-void                  stream_agent_unref                            (DisplayChannel *display,
-                                                                     StreamAgent *agent);
-void                  stream_agent_stop                             (StreamAgent *agent);
+void                  video_stream_agent_unref                      (DisplayChannel *display,
+                                                                     VideoStreamAgent *agent);
+void                  video_stream_agent_stop                       (VideoStreamAgent *agent);
 
 void video_stream_detach_drawable(VideoStream *stream);
 
-- 
2.13.6

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]