Chrome Version : 64.0.3274.0
OS Version: 10150.0.0
What steps will reproduce the problem?
1. Go to https://beaufortfrancois.github.io/sandbox/media/web-worker/
2. Open DevTools
What is the expected result?
I should see only one line:
1. Append shared array buffer...
What happens instead of that?
I see 3 lines:
1. Append shared array buffer...
2. Append view on shared array buffer...
3. Append a clone of the view on shared array buffer...
That's because sourceBuffer.appendBuffer doesn't handle shared array buffers and typed arrays on shared array buffers:
const worker = new Worker('worker.js');
const sharedBuffer = new SharedArrayBuffer(812);
const view = new Uint8Array(sharedBuffer);
worker.addEventListener('message', event => {
const sourceBuffer = mediaSource.sourceBuffers[0];
try {
console.log('1. Append shared array buffer...');
sourceBuffer.appendBuffer(sharedBuffer);
return;
} catch(e) {}
try {
console.log('2. Append view on shared array buffer...');
sourceBuffer.appendBuffer(view);
return;
} catch(e) {}
try {
console.log('3. Append a clone of the view on shared array buffer...');
sourceBuffer.appendBuffer(view.slice(0));
return;
} catch(e) {}
});
It would be nice to handle those s that we could use web workers to offload fetch events instead of polluting UI thread with these calls.
Comment 1 by yini...@chromium.org
, Dec 6 2017Owner: wolenetz@chromium.org
Status: Assigned (was: Unconfirmed)