[Spice-commits] 2 commits - server/main-channel.c server/mjpeg-encoder.c

Jonathon Jongsma jjongsma at kemper.freedesktop.org
Tue Dec 8 13:09:34 PST 2015


 server/main-channel.c  |    8 ++------
 server/mjpeg-encoder.c |    4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 9956270358809d8e06102e4946df5f80f72ca664
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Sat Dec 5 13:07:50 2015 +0100

    server: Use g_get_monotonic_time() to get the time in microseconds
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
    Acked-by: Fabiano FidĂȘncio <fidencio at redhat.com>

diff --git a/server/main-channel.c b/server/main-channel.c
index 25e3868..75fea82 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -372,14 +372,12 @@ static void main_channel_marshall_ping(RedChannelClient *rcc,
                                        PingPipeItem *item)
 {
     MainChannelClient *mcc = SPICE_CONTAINEROF(rcc, MainChannelClient, base);
-    struct timespec time_space;
     SpiceMsgPing ping;
     int size_left = item->size;
 
     red_channel_client_init_send_data(rcc, SPICE_MSG_PING, &item->base);
     ping.id = ++(mcc->ping_id);
-    clock_gettime(CLOCK_MONOTONIC, &time_space);
-    ping.timestamp = time_space.tv_sec * 1000000LL + time_space.tv_nsec / 1000LL;
+    ping.timestamp = g_get_monotonic_time();
     spice_marshall_msg_ping(m, &ping);
 
     while (size_left > 0) {
@@ -934,10 +932,8 @@ static int main_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, uint
     case SPICE_MSGC_PONG: {
         SpiceMsgPing *ping = (SpiceMsgPing *)message;
         uint64_t roundtrip;
-        struct timespec ts;
 
-        clock_gettime(CLOCK_MONOTONIC, &ts);
-        roundtrip = ts.tv_sec * 1000000LL + ts.tv_nsec / 1000LL - ping->timestamp;
+        roundtrip = g_get_monotonic_time() - ping->timestamp;
 
         if (ping->id == mcc->net_test_id) {
             switch (mcc->net_test_stage) {
commit c8d5120ff06747d17f13dcb98cd7a3aea3671eba
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Sat Dec 5 13:06:08 2015 +0100

    server: Define the MJPEG encoder warmup time in nanoseconds
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
    Acked-by: Fabiano FidĂȘncio <fidencio at redhat.com>

diff --git a/server/mjpeg-encoder.c b/server/mjpeg-encoder.c
index 3f54112..08af1eb 100644
--- a/server/mjpeg-encoder.c
+++ b/server/mjpeg-encoder.c
@@ -68,7 +68,7 @@ static const int mjpeg_quality_samples[MJPEG_QUALITY_SAMPLE_NUM] = {20, 30, 40,
  * are not necessarily related to mis-estimation of the bit rate, and we would
  * like to wait till the stream stabilizes.
  */
-#define MJPEG_WARMUP_TIME 3000LL // 3 sec
+#define MJPEG_WARMUP_TIME 3000000000LL // 3 sec
 
 enum {
     MJPEG_QUALITY_EVAL_TYPE_SET,
@@ -996,7 +996,7 @@ static void mjpeg_encoder_decrease_bit_rate(MJpegEncoder *encoder)
         uint64_t now;
 
         now = red_get_monotonic_time();
-        if (now - rate_control->warmup_start_time < MJPEG_WARMUP_TIME*1000*1000) {
+        if (now - rate_control->warmup_start_time < MJPEG_WARMUP_TIME) {
             spice_debug("during warmup. ignoring");
             return;
         } else {


More information about the Spice-commits mailing list