GUACAMOLE-896: Leverage Blobs for storage of recording keyframes.

This commit is contained in:
Michael Jumper
2022-02-14 09:21:22 -08:00
parent e2af997967
commit d0257122bb

View File

@@ -548,7 +548,7 @@ Guacamole.SessionRecording = function SessionRecording(source) {
// Store client state if frame is flagged as a keyframe // Store client state if frame is flagged as a keyframe
if (frame.keyframe && !frame.clientState) { if (frame.keyframe && !frame.clientState) {
playbackClient.exportState(function storeClientState(state) { playbackClient.exportState(function storeClientState(state) {
frame.clientState = state; frame.clientState = new Blob([JSON.stringify(state)]);
}); });
} }
@@ -606,8 +606,10 @@ Guacamole.SessionRecording = function SessionRecording(source) {
// If frame has associated absolute state, make that frame the // If frame has associated absolute state, make that frame the
// current state // current state
if (frame.clientState) { if (frame.clientState) {
playbackClient.importState(frame.clientState); frame.clientState.text().then(function textReady(text) {
currentFrame = index; playbackClient.importState(JSON.parse(text));
currentFrame = index;
});
break; break;
} }
@@ -1058,10 +1060,12 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, start, end) {
/** /**
* A snapshot of client state after this frame was rendered, as returned by * A snapshot of client state after this frame was rendered, as returned by
* a call to exportState(). If no such snapshot has been taken, this will * a call to exportState(), serialized as JSON, and stored within a Blob.
* be null. * Use of Blobs here is required to ensure the browser can make use of
* larger disk-backed storage if the size of the recording is large. If no
* such snapshot has been taken, this will be null.
* *
* @type {object} * @type {Blob}
* @default null * @default null
*/ */
this.clientState = null; this.clientState = null;