New issue
Advanced search Search tips

Issue 787765 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Feature



Sign in to add a comment

sourceBuffer.appendBuffer should handle SharedArrayBuffer

Project Member Reported by fbeaufort@chromium.org, Nov 22 2017

Issue description

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.
 
Cc: -wolenetz@chromium.org
Owner: wolenetz@chromium.org
Status: Assigned (was: Unconfirmed)

Sign in to add a comment