[Spice-devel] [client] gstreamer: Initialize last_mm_time to avoid an overflow

Francois Gouget fgouget at codeweavers.com
Mon Jun 10 08:49:29 UTC 2019


The mm_time is an unsigned 32 bit int but spice_mmtime_diff() returns a
signed 32 bit int. That's reasonable because we normally substract
frame times which should be at most seconds apart.
But last_mm_time was zero on stream startup, resulting in an overflow
and an uncalled for warning for the first frame in
spice_gst_decoder_queue_frame() if the uptime was greater than about
25 days.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 src/channel-display-gst.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 88918f10..858e8aeb 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -740,6 +740,7 @@ VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream)
         decoder->base.queue_frame = spice_gst_decoder_queue_frame;
         decoder->base.codec_type = codec_type;
         decoder->base.stream = stream;
+        decoder->last_mm_time = stream_get_time(stream);
         g_mutex_init(&decoder->queues_mutex);
         decoder->decoding_queue = g_queue_new();
 
-- 
2.20.1


More information about the Spice-devel mailing list