Skip to content

Commit

Permalink
#20 send_back may be called asynchronously too
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Aug 18, 2021
1 parent b880f0e commit a9833ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion html5/js/DecodeWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ function decode_draw_packet(packet) {
height = packet[5],
coding = packet[6],
packet_sequence = packet[8];
let wid_hold = on_hold.get(wid);
//console.log("packet to decode:", data.packet);
function send_back(raw_buffers) {
//console.log("send_back: wid_hold=", wid_hold);
const wid_hold = on_hold.get(wid);
if (wid_hold) {
//find the highest sequence number which is still lower than this packet
let seq_holding = 0;
Expand Down Expand Up @@ -157,6 +157,7 @@ function decode_draw_packet(packet) {
else if (coding=="png" || coding=="jpeg" || coding=="webp") {
const data = packet[7];
const blob = new Blob([data.buffer]);
let wid_hold = on_hold.get(wid);
//we're loading asynchronously
//so ensure that any packet sequence arriving after this one will be put on hold
//until we have finished decoding this one:
Expand Down

0 comments on commit a9833ef

Please sign in to comment.