Closed Bug 1636772 Opened 6 years ago Closed 6 years ago

addSourceBuffer() does not happen instantly as it should.

Categories

(Core :: Audio/Video: Playback, defect)

76 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: john.atwell.moody, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36 OPR/68.0.3618.63

Steps to reproduce:

I am doing 2 way video streaming using MediaRecorder and SourceBuffers http://spectrograph/exp/index.html?name (you can replace 'name' with any other username you invent, and the website functions like ZOOM).

The javascript command that is being executed is buffers[i].appendBuffer(x) where buffers[i] is created as mediaSource.addSourceBuffer('video/webm;codecs="opus,vp8"'). It works correctly on all other browsers.

Actual results:

There is a one second delay before the video begins to be processed and displayed, and a two-second delay before the audio is processed. In two-way streaming this is a total of four seconds of latency. None of the settings in about:config have the effect of reducing this delay.

As an incidental comment, the variable getSelfFromLocal in the script can be used to shortcut the internet and stream directly from the user's webcam to the browser, and the delay is there in Firefox when it is set to be true, but there is no delay in any other browser. During the delay, the video element readyState is equal to 1 even though the data is available.

Expected results:

The streaming should start instantly as soon as the first appendBuffer command is issued.

(In reply to john.atwell.moody from comment #0)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36 OPR/68.0.3618.63

Steps to reproduce:

I am doing 2 way video streaming using MediaRecorder and SourceBuffers http://spectrograph.uk/exp/index.html?name (you can replace 'name' with any other username you invent, and the website functions like ZOOM).

The javascript command that is being executed is buffers[i].appendBuffer(x) where buffers[i] is created as mediaSource.addSourceBuffer('video/webm;codecs="opus,vp8"'). It works correctly on all other browsers.

Actual results:

There is a one second delay before the video begins to be processed and displayed, and a two-second delay before the audio is processed. In two-way streaming this is a total of four seconds of latency. None of the settings in about:config have the effect of reducing this delay.

As an incidental comment, the variable getSelfFromLocal in the script can be used to shortcut the internet and stream directly from the user's webcam to the browser, and the delay is there in Firefox when it is set to be true, but there is no delay in any other browser. During the delay, the video element readyState is equal to 1 even though the data is available.

Expected results:

The streaming should start instantly as soon as the first appendBuffer command is issued.

Sorry, I made the second comment because I mis-typed the URL in the first one, it is http://spectrograph.uk/exp/index.html?name as in the second comment. The mediaRecorder is stopped and restarted every 17 seconds, this is intentional,it is my attempt to use removeBuffer to clear the latency caused by the initial one or two second delay, but each time the appendBuffer(x) command is issued for the data from the newly started MediaRecorder, the video element just sits and waits again.

Note that the bug report is slightly mis-titled, the delay is in processing the first appendBuffer command -- and note that the audio delay is much longer than the video delay even though both are streamed together.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

You know what? I'm going to delete this bug for now and see if the delay is just down to acceptable variation in how different browsers interpret the MediaRecorder events. Let me sort this on my own and if I really am sure it is a Firefox bug, I'll come back.

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.