[Spice-devel] [PATCH spice-gtk v3 3/6] channel-display: No need to rechedule on mmtime offset changes
Frediano Ziglio
fziglio at redhat.com
Fri Jul 26 09:52:10 UTC 2019
From: Francois Gouget <fgouget at codeweavers.com>
The frame display time is no longer based on the mmtime clock and thus
is not impacted by mmtime offset changes.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
src/channel-display-gst.c | 21 -------------
src/channel-display-mjpeg.c | 13 --------
src/channel-display-priv.h | 3 --
src/channel-display.c | 59 -------------------------------------
4 files changed, 96 deletions(-)
diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 7ad6009b..11d78afc 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -583,26 +583,6 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
/* ---------- VideoDecoder's public API ---------- */
-static void spice_gst_decoder_reschedule(VideoDecoder *video_decoder)
-{
- SpiceGstDecoder *decoder = (SpiceGstDecoder*)video_decoder;
-
- if (!decoder->appsink) {
- return;
- }
- guint timer_id;
-
- g_mutex_lock(&decoder->queues_mutex);
- timer_id = decoder->timer_id;
- decoder->timer_id = 0;
- g_mutex_unlock(&decoder->queues_mutex);
-
- if (timer_id != 0) {
- g_source_remove(timer_id);
- }
- schedule_frame(decoder);
-}
-
/* main context */
static void spice_gst_decoder_destroy(VideoDecoder *video_decoder)
{
@@ -774,7 +754,6 @@ VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream)
if (gstvideo_init()) {
decoder = g_new0(SpiceGstDecoder, 1);
decoder->base.destroy = spice_gst_decoder_destroy;
- decoder->base.reschedule = spice_gst_decoder_reschedule;
decoder->base.queue_frame = spice_gst_decoder_queue_frame;
decoder->base.codec_type = codec_type;
decoder->base.stream = stream;
diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
index d3ab77c8..b058424e 100644
--- a/src/channel-display-mjpeg.c
+++ b/src/channel-display-mjpeg.c
@@ -250,18 +250,6 @@ static gboolean mjpeg_decoder_queue_frame(VideoDecoder *video_decoder,
return TRUE;
}
-static void mjpeg_decoder_reschedule(VideoDecoder *video_decoder)
-{
- MJpegDecoder *decoder = (MJpegDecoder*)video_decoder;
-
- SPICE_DEBUG("%s", __FUNCTION__);
- if (decoder->timer_id != 0) {
- g_source_remove(decoder->timer_id);
- decoder->timer_id = 0;
- }
- mjpeg_decoder_schedule(decoder);
-}
-
static void mjpeg_decoder_destroy(VideoDecoder* video_decoder)
{
MJpegDecoder *decoder = (MJpegDecoder*)video_decoder;
@@ -281,7 +269,6 @@ VideoDecoder* create_mjpeg_decoder(int codec_type, display_stream *stream)
MJpegDecoder *decoder = g_new0(MJpegDecoder, 1);
decoder->base.destroy = mjpeg_decoder_destroy;
- decoder->base.reschedule = mjpeg_decoder_reschedule;
decoder->base.queue_frame = mjpeg_decoder_queue_frame;
decoder->base.codec_type = codec_type;
decoder->base.stream = stream;
diff --git a/src/channel-display-priv.h b/src/channel-display-priv.h
index a8994655..a1ad3224 100644
--- a/src/channel-display-priv.h
+++ b/src/channel-display-priv.h
@@ -59,9 +59,6 @@ struct VideoDecoder {
/* Releases the video decoder's resources */
void (*destroy)(VideoDecoder *decoder);
- /* Notifies the decoder that the mm-time clock changed. */
- void (*reschedule)(VideoDecoder *decoder);
-
/* Takes ownership of the specified frame, decompresses it,
* and displays it at the right time.
*
diff --git a/src/channel-display.c b/src/channel-display.c
index acc66dd1..f57691cd 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -108,7 +108,6 @@ static void spice_display_channel_reset(SpiceChannel *channel, gboolean migratin
static void spice_display_channel_set_capabilities(SpiceChannel *channel);
static void destroy_canvas(display_surface *surface);
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);
G_DEFINE_BOXED_TYPE(SpiceGlScanout, spice_gl_scanout,
@@ -190,9 +189,6 @@ static void spice_display_channel_constructed(GObject *object)
g_return_if_fail(c->palettes != NULL);
c->monitors = g_array_new(FALSE, TRUE, sizeof(SpiceDisplayMonitorConfig));
- spice_g_signal_connect_object(s, "mm-time-reset",
- G_CALLBACK(display_session_mm_time_reset_cb),
- SPICE_CHANNEL(object), 0);
spice_display_channel_set_capabilities(SPICE_CHANNEL(object));
@@ -1539,61 +1535,6 @@ static void display_update_stream_report(SpiceDisplayChannel *channel, uint32_t
}
}
-/*
- * Migration can occur between 2 spice-servers with different mm-times.
- * Then, the following cases can happen after migration completes:
- * (We refer to src/dst-time as the mm-times on the src/dst servers):
- *
- * (case 1) Frames with time ~= dst-time arrive to the client before the
- * playback-channel updates the session's mm-time (i.e., the mm_time
- * of the session is still based on the src-time).
- * (a) If src-time < dst-time:
- * display_stream_schedule schedules the next rendering to
- * ~(dst-time - src-time) milliseconds from now.
- * Since we assume monotonic mm_time, display_stream_schedule,
- * returns immediately when a rendering timeout
- * has already been set, and doesn't update the timeout,
- * even after the mm_time is updated.
- * When src-time << dst-time, a significant video frames loss will occur.
- * (b) If src-time > dst-time
- * Frames will be dropped till the mm-time will be updated.
- * (case 2) mm-time is synced with dst-time, but frames that were in the command
- * ring during migration still arrive (such frames hold src-time).
- * (a) If src-time < dst-time
- * The frames that hold src-time will be dropped, since their
- * mm_time < session-mm_time. But all the new frames that are generated in
- * the driver after migration, will be rendered appropriately.
- * (b) If src-time > dst-time
- * Similar consequences as in 1 (a)
- * case 2 is less likely, since at takes at least 20 frames till the dst-server re-identifies
- * the video stream and starts sending stream data
- *
- * display_session_mm_time_reset_cb handles case 1.a by notifying the
- * video decoders through their reschedule() method, and case 2.b is handled
- * directly by the video decoders in their queue_frame() method
- */
-
-/* main context */
-static void display_session_mm_time_reset_cb(SpiceSession *session, gpointer data)
-{
- SpiceChannel *channel = data;
- SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv;
- guint i;
-
- CHANNEL_DEBUG(channel, "%s", __FUNCTION__);
-
- for (i = 0; i < c->nstreams; i++) {
- display_stream *st;
-
- if (c->streams[i] == NULL) {
- continue;
- }
- SPICE_DEBUG("%s: stream-id %u", __FUNCTION__, i);
- st = c->streams[i];
- st->video_decoder->reschedule(st->video_decoder);
- }
-}
-
#define STREAM_PLAYBACK_SYNC_DROP_SEQ_LEN_LIMIT 5
static void display_stream_stats_debug(display_stream *st)
--
2.20.1
More information about the Spice-devel
mailing list