[Spice-commits] 3 commits - src/channel-display.c src/channel-display-gst.c src/channel-display-priv.h
Victor Toso de Carvalho
victortoso at kemper.freedesktop.org
Thu Apr 5 09:45:42 UTC 2018
src/channel-display-gst.c | 5 ++---
src/channel-display-priv.h | 2 +-
src/channel-display.c | 40 +++++++++++-----------------------------
3 files changed, 14 insertions(+), 33 deletions(-)
New commits:
commit cf5e5e3e53e74f495478f2cb7bf3a731bbcd7117
Author: Victor Toso <me at victortoso.com>
Date: Fri Mar 2 11:24:39 2018 +0100
channel-display: remove unneeded function
The get_stream_id_by_stream() was introduced in 141c2d82 to debug
GStreamer's pipeline. But with previous patch, we are moving the ID to
the display_stream structure and can be accessible directly.
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index c6280d3..8b23036 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -293,9 +293,8 @@ static gboolean handle_pipeline_message(GstBus *bus, GstMessage *msg, gpointer v
break;
}
case GST_MESSAGE_STREAM_START: {
- gchar *filename = g_strdup_printf("spice-gtk-gst-pipeline-debug-%" G_GINT64_FORMAT "-%s",
- get_stream_id_by_stream(decoder->base.stream->channel,
- decoder->base.stream),
+ gchar *filename = g_strdup_printf("spice-gtk-gst-pipeline-debug-%" G_GUINT32_FORMAT "-%s",
+ decoder->base.stream->id,
gst_opts[decoder->base.codec_type].name);
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(decoder->pipeline),
GST_DEBUG_GRAPH_SHOW_ALL
diff --git a/src/channel-display-priv.h b/src/channel-display-priv.h
index 94c9913..6a90a78 100644
--- a/src/channel-display-priv.h
+++ b/src/channel-display-priv.h
@@ -195,7 +195,6 @@ guint32 stream_get_time(display_stream *st);
void stream_dropped_frame_on_playback(display_stream *st);
#define SPICE_UNKNOWN_STRIDE 0
void stream_display_frame(display_stream *st, SpiceFrame *frame, uint32_t width, uint32_t height, int stride, uint8_t* data);
-gint64 get_stream_id_by_stream(SpiceChannel *channel, display_stream *st);
G_END_DECLS
diff --git a/src/channel-display.c b/src/channel-display.c
index 1a79a8b..2ea0922 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1218,23 +1218,6 @@ static display_stream *get_stream_by_id(SpiceChannel *channel, uint32_t id)
return NULL;
}
-G_GNUC_INTERNAL
-gint64 get_stream_id_by_stream(SpiceChannel *channel, display_stream *st)
-{
- SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv;
- guint i;
-
- g_return_val_if_fail(c->streams != NULL, -1);
- g_return_val_if_fail(c->nstreams > 0, -1);
-
- for (i = 0; i < c->nstreams; i++) {
- if (c->streams[i] == st)
- return i;
- }
-
- return -1;
-}
-
/* coroutine context */
static display_stream *display_stream_create(SpiceChannel *channel,
uint32_t id, uint32_t surface_id,
commit d2790c0aef8085511e501643c69490c11c9d19bc
Author: Victor Toso <me at victortoso.com>
Date: Tue Mar 13 09:49:37 2018 +0100
channel-display: rename display_stream_destroy()
This patch renames destroy_display_stream() to
display_stream_destroy() to keep compatibility with
display_stream_create()
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/src/channel-display.c b/src/channel-display.c
index de40798..1a79a8b 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -106,7 +106,7 @@ static display_surface *find_surface(SpiceDisplayChannelPrivate *c, guint32 surf
static void spice_display_channel_reset(SpiceChannel *channel, gboolean migrating);
static void spice_display_channel_reset_capabilities(SpiceChannel *channel);
static void destroy_canvas(display_surface *surface);
-static void destroy_display_stream(gpointer st);
+static void display_stream_destroy(gpointer st);
static void display_session_mm_time_reset_cb(SpiceSession *session, gpointer data);
static SpiceGlScanout* spice_gl_scanout_copy(const SpiceGlScanout *scanout);
@@ -1269,7 +1269,7 @@ static display_stream *display_stream_create(SpiceChannel *channel,
}
if (st->video_decoder == NULL) {
spice_printerr("could not create a video decoder for codec %u", codec_type);
- g_clear_pointer(&st, destroy_display_stream);
+ g_clear_pointer(&st, display_stream_destroy);
}
return st;
}
@@ -1282,7 +1282,7 @@ static void destroy_stream(SpiceChannel *channel, int id)
g_return_if_fail(c->streams != NULL);
g_return_if_fail(c->nstreams > id);
- g_clear_pointer(&c->streams[id], destroy_display_stream);
+ g_clear_pointer(&c->streams[id], display_stream_destroy);
}
static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
@@ -1596,7 +1596,7 @@ static void display_handle_stream_clip(SpiceChannel *channel, SpiceMsgIn *in)
display_update_stream_region(st);
}
-static void destroy_display_stream(gpointer st_pointer)
+static void display_stream_destroy(gpointer st_pointer)
{
int i;
display_stream *st = st_pointer;
commit bdd36be801288e669ce4c7012991522c208d70a5
Author: Victor Toso <me at victortoso.com>
Date: Thu Mar 1 14:23:30 2018 +0100
channel-display: remove id parameter from helper function
Instead of passing the id parameter for destroy_display_stream() which
is only used for debug, let's store the id when creating the stream at
display_stream_create().
With the removal of Id parameter, we are using a gpointer for
display_stream struct to comply with GDestroyNotify type and use this,
for instance in g_clear_pointer() without warnings.
Benefits of this patch:
* We can drop a helper function in a follow up patch;
* Function is now a GDestroyNotify type;
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/src/channel-display-priv.h b/src/channel-display-priv.h
index 1389868..94c9913 100644
--- a/src/channel-display-priv.h
+++ b/src/channel-display-priv.h
@@ -115,6 +115,7 @@ typedef struct drops_sequence_stats {
struct display_stream {
/* from messages */
+ uint32_t id;
uint32_t flags;
SpiceRect dest;
display_surface *surface;
diff --git a/src/channel-display.c b/src/channel-display.c
index 45fe38c..de40798 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -106,7 +106,7 @@ static display_surface *find_surface(SpiceDisplayChannelPrivate *c, guint32 surf
static void spice_display_channel_reset(SpiceChannel *channel, gboolean migrating);
static void spice_display_channel_reset_capabilities(SpiceChannel *channel);
static void destroy_canvas(display_surface *surface);
-static void destroy_display_stream(display_stream *st, int id);
+static void destroy_display_stream(gpointer st);
static void display_session_mm_time_reset_cb(SpiceSession *session, gpointer data);
static SpiceGlScanout* spice_gl_scanout_copy(const SpiceGlScanout *scanout);
@@ -1236,13 +1236,15 @@ gint64 get_stream_id_by_stream(SpiceChannel *channel, display_stream *st)
}
/* coroutine context */
-static display_stream *display_stream_create(SpiceChannel *channel, uint32_t surface_id,
+static display_stream *display_stream_create(SpiceChannel *channel,
+ uint32_t id, uint32_t surface_id,
uint32_t flags, uint32_t codec_type,
const SpiceRect *dest, const SpiceClip *clip)
{
SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv;
display_stream *st = g_new0(display_stream, 1);
+ st->id = id;
st->flags = flags;
st->dest = *dest;
st->clip = *clip;
@@ -1267,8 +1269,7 @@ static display_stream *display_stream_create(SpiceChannel *channel, uint32_t sur
}
if (st->video_decoder == NULL) {
spice_printerr("could not create a video decoder for codec %u", codec_type);
- destroy_display_stream(st, 0);
- st = NULL;
+ g_clear_pointer(&st, destroy_display_stream);
}
return st;
}
@@ -1281,10 +1282,7 @@ static void destroy_stream(SpiceChannel *channel, int id)
g_return_if_fail(c->streams != NULL);
g_return_if_fail(c->nstreams > id);
- if (c->streams[id]) {
- destroy_display_stream(c->streams[id], id);
- c->streams[id] = NULL;
- }
+ g_clear_pointer(&c->streams[id], destroy_display_stream);
}
static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
@@ -1307,7 +1305,7 @@ static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
}
g_return_if_fail(c->streams[op->id] == NULL);
- c->streams[op->id] = display_stream_create(channel, op->surface_id,
+ c->streams[op->id] = display_stream_create(channel, op->id, op->surface_id,
op->flags, op->codec_type,
&op->dest, &op->clip);
if (c->streams[op->id] == NULL) {
@@ -1598,17 +1596,18 @@ static void display_handle_stream_clip(SpiceChannel *channel, SpiceMsgIn *in)
display_update_stream_region(st);
}
-static void destroy_display_stream(display_stream *st, int id)
+static void destroy_display_stream(gpointer st_pointer)
{
int i;
+ display_stream *st = st_pointer;
if (st->num_input_frames > 0) {
guint64 drops_duration_total = 0;
guint32 num_out_frames = st->num_input_frames - st->arrive_late_count - st->num_drops_on_playback;
- CHANNEL_DEBUG(st->channel, "%s: id=%d #in-frames=%u out/in=%.2f "
+ CHANNEL_DEBUG(st->channel, "%s: id=%u #in-frames=%u out/in=%.2f "
"#drops-on-receive=%u avg-late-time(ms)=%.2f "
"#drops-on-playback=%u", __FUNCTION__,
- id,
+ st->id,
st->num_input_frames,
num_out_frames / (double)st->num_input_frames,
st->arrive_late_count,
More information about the Spice-commits
mailing list