[Spice-devel] [spice] gstreamer-encoder: Include encoding time in get_min_playback_delay()

Francois Gouget fgouget at codeweavers.com
Wed May 15 23:10:32 UTC 2019


This way all the minimum delay calculation is in one place and this
makes gstreamer's implementation closer to the mjpeg one.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 server/gstreamer-encoder.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/gstreamer-encoder.c b/server/gstreamer-encoder.c
index 6130781da..17d9822c0 100644
--- a/server/gstreamer-encoder.c
+++ b/server/gstreamer-encoder.c
@@ -526,13 +526,13 @@ static uint32_t get_min_playback_delay(SpiceGstEncoder *encoder)
     /* Also factor in the network latency with a margin for jitter. */
     uint32_t net_latency = get_network_latency(encoder) * (1.0 + SPICE_GST_LATENCY_MARGIN);
 
-    return send_time + net_latency;
+    return send_time + net_latency + get_average_encoding_time(encoder) / NSEC_PER_MILLISEC;
 }
 
 static void update_client_playback_delay(SpiceGstEncoder *encoder)
 {
     if (encoder->cbs.update_client_playback_delay) {
-        uint32_t min_delay = get_min_playback_delay(encoder) + get_average_encoding_time(encoder) / NSEC_PER_MILLISEC;
+        uint32_t min_delay = get_min_playback_delay(encoder);
         encoder->cbs.update_client_playback_delay(encoder->cbs.opaque, min_delay);
     }
 }
-- 
2.20.1



More information about the Spice-devel mailing list