GUACAMOLE-377: Add JavaScript API support for tracking display render statistics.

This commit is contained in:
Michael Jumper
2021-09-03 00:25:27 -07:00
parent 93d97e8c97
commit e5dccc8657
2 changed files with 267 additions and 8 deletions

View File

@@ -840,6 +840,12 @@ Guacamole.Client = function(tunnel) {
* @event
* @param {!number} timestamp
* The timestamp associated with the sync instruction.
*
* @param {!number} frames
* The number of frames that were considered or combined to produce the
* frame associated with this sync instruction, or zero if this value
* is not known or the remote desktop server provides no concept of
* frames.
*/
this.onsync = null;
@@ -1530,6 +1536,7 @@ Guacamole.Client = function(tunnel) {
"sync": function(parameters) {
var timestamp = parseInt(parameters[0]);
var frames = parameters[1] ? parseInt(parameters[1]) : 0;
// Flush display, send sync when done
display.flush(function displaySyncComplete() {
@@ -1547,7 +1554,7 @@ Guacamole.Client = function(tunnel) {
currentTimestamp = timestamp;
}
});
}, timestamp, frames);
// If received first update, no longer waiting.
if (currentState === STATE_WAITING)
@@ -1555,7 +1562,7 @@ Guacamole.Client = function(tunnel) {
// Call sync handler if defined
if (guac_client.onsync)
guac_client.onsync(timestamp);
guac_client.onsync(timestamp, frames);
},