From a09a75e8f2e6333fe2a65631682c01fb5a78ff30 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Sat, 10 Mar 2012 19:56:19 -0600 Subject: [PATCH] Stats: count pixels instead of just FBU.rects. With last_rect, the rects count can be high until a last_rect pseudo-encoding is received which messes with the timing stats. So count up the number of pixels rendered and show timing after the pixel count reaches the width*height of the screen. --- include/rfb.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/include/rfb.js b/include/rfb.js index c1c121a2..c6bea111 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -117,7 +117,8 @@ var that = {}, // Public API methods fbu_rt_start : 0, fbu_rt_total : 0, - fbu_rt_cnt : 0 + fbu_rt_cnt : 0, + pixels : 0 }, test_mode = false, @@ -995,11 +996,6 @@ framebufferUpdate = function() { 'encoding': FBU.encoding, 'encodingName': encNames[FBU.encoding]}); - if (encNames[FBU.encoding] == 'last_rect') { - FBU.rects = 0; - break; - } - if (encNames[FBU.encoding]) { // Debug: /* @@ -1028,9 +1024,10 @@ framebufferUpdate = function() { if (ret) { encStats[FBU.encoding][0] += 1; encStats[FBU.encoding][1] += 1; + timing.pixels += FBU.width * FBU.height; } - if (FBU.rects === 0) { + if (FBU.rects === 0 || (timing.pixels >= (fb_width * fb_height))) { if (((FBU.width === fb_width) && (FBU.height === fb_height)) || (timing.fbu_rt_start > 0)) { @@ -1636,6 +1633,13 @@ scan_tight_imgQ = function() { } }; +encHandlers.last_rect = function last_rect() { + Util.Debug(">> set_desktopsize"); + FBU.rects = 0; + Util.Debug("<< set_desktopsize"); + return true; +}; + encHandlers.DesktopSize = function set_desktopsize() { Util.Debug(">> set_desktopsize"); fb_width = FBU.width;