Skip to content

Commit

Permalink
rfb: Add method to request key frame
Browse files Browse the repository at this point in the history
  • Loading branch information
any1 committed Jul 8, 2024
1 parent 7fcf9dc commit 1c93b9f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion core/rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export default class RFB extends EventTargetMixin {

// Decoder states
this._decoders = {};
this._keyFrameNeeded = false;

this._FBU = {
rects: 0,
Expand Down Expand Up @@ -804,6 +805,15 @@ export default class RFB extends EventTargetMixin {
size.w + 'x' + size.h);
}

_requestKeyFrame() {
if (this._enabledContinuousUpdates) {
RFB.messages.fbUpdateRequest(this._sock, false, 0, 0,
this._fbWidth, this._fbHeight);
} else {
this._keyFrameNeeded = true;
}
}

// Gets the the size of the available screen
_screenSize() {
let r = this._screen.getBoundingClientRect();
Expand Down Expand Up @@ -2447,7 +2457,9 @@ export default class RFB extends EventTargetMixin {
case 0: // FramebufferUpdate
ret = this._framebufferUpdate();
if (ret && !this._enabledContinuousUpdates) {
RFB.messages.fbUpdateRequest(this._sock, true, 0, 0,
const incremental = !this._keyFrameNeeded;
this._keyFrameNeeded = false;
RFB.messages.fbUpdateRequest(this._sock, incremental, 0, 0,
this._fbWidth, this._fbHeight);
}
return ret;
Expand Down

0 comments on commit 1c93b9f

Please sign in to comment.