[Spice-commits] src/channel-display.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jan 15 16:23:36 UTC 2019
src/channel-display.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
New commits:
commit 8956e4c2cc3ed3cbf22e0d139d629f011026e464
Author: Victor Toso <me at victortoso.com>
Date: Tue Mar 13 10:20:16 2018 +0100
channel-display: add spice_frame_new() helper
As it makes easier to track what is allocated in its own function and
ultimately what needs to be freed later on.
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 3dfd721..2801732 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1545,6 +1545,27 @@ static void display_session_mm_time_reset_cb(SpiceSession *session, gpointer dat
#define STREAM_PLAYBACK_SYNC_DROP_SEQ_LEN_LIMIT 5
+static SpiceFrame *spice_frame_new(display_stream *st,
+ SpiceMsgIn *in,
+ guint32 server_mmtime)
+{
+ SpiceFrame *frame;
+ guint8 *data_ptr;
+ const SpiceRect *dest_rect = stream_get_dest(st, in);
+ guint32 data_size = spice_msg_in_frame_data(in, &data_ptr);
+
+ frame = g_new(SpiceFrame, 1);
+ frame->mm_time = server_mmtime;
+ frame->dest = *dest_rect;
+ frame->data = data_ptr;
+ frame->size = data_size;
+ frame->data_opaque = in;
+ frame->ref_data = (void*)spice_msg_in_ref;
+ frame->unref_data = (void*)spice_msg_in_unref;
+ frame->free = (void*)g_free;
+ return frame;
+}
+
/* coroutine context */
static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
{
@@ -1611,14 +1632,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
* decoding and best decide if/when to drop them when they are late,
* taking into account the impact on later frames.
*/
- frame = g_new(SpiceFrame, 1);
- frame->mm_time = op->multi_media_time;
- frame->dest = *stream_get_dest(st, in);
- frame->size = spice_msg_in_frame_data(in, &frame->data);
- frame->data_opaque = in;
- frame->ref_data = (void*)spice_msg_in_ref;
- frame->unref_data = (void*)spice_msg_in_unref;
- frame->free = (void*)g_free;
+ frame = spice_frame_new(st, in, op->multi_media_time);
if (!st->video_decoder->queue_frame(st->video_decoder, frame, latency)) {
destroy_stream(channel, op->id);
report_invalid_stream(channel, op->id);
More information about the Spice-commits
mailing list