Issue with updating/updateend

The usual code is something like:

if (!source.updating) {
     source.appendBuffer(append_buffer.shift());
}
if (first_chunk) {
     source.addEventListener('updateend',function() {
         if (append_buffer.length) {
             source.appendBuffer(append_buffer.shift());
         };
     });
};

The use case is: chunks of 498 B and bandwidth rate of 1 Mbps, and this 
does not work at all, at least with Chrome, it might be a Chrome issue 
and/or a spec issue.

Because between two 'updateend' events, the 'updating' property can 
become false, therefore you can append a chunk at the wrong place, if 
your remove the first part of the code (or replace it by if 
(first_chunk) {source.append...}) then the buffer chaining can stop if 
for some reasons the chunks are delayed.

With streams the problem will disappear, without streams there is a 
workaround, but as I mentionned in a previous post I don't find this 
behavior normal.

Regards

Aymeric

-- 
Peersm : http://www.peersm.com
node-Tor : https://www.github.com/Ayms/node-Tor
GitHub : https://www.github.com/Ayms

Received on Wednesday, 2 April 2014 20:47:40 UTC