whereby.com results in audio video drift if you update the settings
Categories
(Core :: WebRTC: Audio/Video, defect, P2)
Tracking
()
People
(Reporter: achronop, Assigned: pehrsons)
References
Details
Attachments
(4 files)
47 bytes,
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
|
Details | Review |
47 bytes,
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
|
Details | Review |
47 bytes,
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
|
Details | Review |
47 bytes,
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
|
Details | Review |
STR:
Connect to a room in the new whereby.com (mozilla.whereby.com).
Press the settings.
Change the microphone (assuming you have more than one)
Press "Apply Changes"
On the new gUM prompt press "Allow"
The remote party reports A/V delay, between 1 and 2 seconds.
I am testing on Linux but I don't know if that affects
Assignee | ||
Comment 1•5 years ago
|
||
Does the remote party report audio delay or video delay?
Assignee | ||
Comment 2•5 years ago
|
||
I have a hypothesis on what's happening, and if it holds it means that there is a video delay, and that this delay is roughly proportional to the time the user takes to approve the new gUM prompt.
Assignee | ||
Comment 3•5 years ago
|
||
We've observed both audio delays and video delays. Unclear exactly how this happens. But it smells to me like all tracks are stopped, new tracks get acquired through gUM (after user approval, can take a loooong time!), then tracks get replaced with sender.replaceTrack() and sending continues.
After this has finished it looks like the remote side's jitter buffers are very confused.
Could it be because we keep sending a video frame every second whereas we don't send audio at all, while blocked on the gUM prompt?
Byron, do you know how we handle/should handle A/V sync when something like this happens?
Reporter | ||
Comment 4•5 years ago
|
||
I have been experimenting with this fiddle. It reproduces the error, which is sporadic. Also, the delay varies between tries.
The time to approve the second gUM affects but in an odd way. If the approve happens fast the problem occurs. If the approve happens after some time (10 secs) there is no error, the receiving stream is fine and A/V is in sync.
Comment 5•5 years ago
|
||
No, that stuff all happens down in the webrtc.org code.
Reporter | ||
Updated•5 years ago
|
Comment 6•5 years ago
|
||
Sorry, I'm a bit behind. I'll have a look at this later today or early next week.
Assignee | ||
Comment 7•5 years ago
|
||
I'm not entirely clear how Whereby do their switches yet, but assuming that they replaceTrack() an ended track with a live track I think I can fix this.
We can make each active RTCRtpSender hold a ForwardedInputTrack that doesn't end until the sender goes away for sure. Thus if the input track ends the ForwardedInputTrack is still producing silence for the peer connection's rtp stream.
Same concept as we did for DecodedStream in bug 1172394, and similar to bug 1586370 in that we run the graph even though no audio is being processed by it.
I have some WIP patches that seem to result in a massive improvement. Just as the new devices start flowing to the remote side, there's some video glitches visible there, but they recover fast. This is probably an artifact of the video jitter buffer, since we didn't send anything between stopping the old and acquiring the new camera. If whereby wouldn't stop the old camera until they acquire the new, this shouldn't be an issue.
Assignee | ||
Comment 8•5 years ago
|
||
I forked Alex' fiddle for a corner case I found. If we just stop and replace audio, without touching video, that seems to result in silence on Nightly. I've fixed this.
Assignee | ||
Comment 9•5 years ago
|
||
Before this patch, if a send audio MediaStreamTrack ended, we ended up not
sending anything over the network. If replaceTrack() at that point replaced the
ended track with a live one, we'd start sending data again, but the rtp stream
would continue from where the previous track ended.
Having a gap in audio like that would confuse a receiver's video jitter
buffer, because it's trying to sync to an audio track that just had a massive
amount of "jitter" (it can't tell the difference).
This patch fixes this by adding a track layer in MediaPipelineTransmit that
remains active for as long as the MediaPipeline is active. Thus if the send
audio MediaStreamTrack ends, we continue sending silence over the network, which
the receiver can understand. If later replaced, the receiver sees real audio
instead of silence and continues gracefully.
Assignee | ||
Comment 10•5 years ago
|
||
Depends on D56619
Assignee | ||
Comment 11•5 years ago
|
||
I'm also testing with this fiddle that does sender.replaceTrack(null)
. Seems to reproduce in release 71 as well.
Comment 12•5 years ago
|
||
Comment 13•5 years ago
|
||
Backed out 2 changesets (bug 1601034) for causing gtest mediapipeline_unittest.cpp failures
backout: https://hg.mozilla.org/integration/autoland/rev/454e0c260c29fe241f5bbabf4e5e0b4a55e56890
Assignee | ||
Comment 14•5 years ago
|
||
Depends on D56620
Assignee | ||
Comment 15•5 years ago
|
||
The STS thread dispatches SyncRunnables to main thread. There are two cases of
blocking affected here:
- SyncRunnables from main to STS:
Can cause a deadlock. - PR_Sleep on the main thread:
Effectively sleeps STS too, if STS dispatches a SyncRunnable to main during
main's sleep.
This patch gets rid of both of these.
Depends on D57001
Assignee | ||
Updated•5 years ago
|
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/98212026404b
https://hg.mozilla.org/mozilla-central/rev/902cf0de82c3
https://hg.mozilla.org/mozilla-central/rev/715477743439
https://hg.mozilla.org/mozilla-central/rev/313e96351327
Assignee | ||
Comment 18•5 years ago
•
|
||
Comment on attachment 9114985 [details]
Bug 1601034 - Add a ProcessedMediaTrack layer in MediaPipelineTransmit to handle replaceTrack of ended tracks. r?dminor!,padenot!
Beta/Release Uplift Approval Request
- User impact if declined: Users using webrtc services may appear with video a few seconds behind audio, on the other participants' screen.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: See comment 0. Any whereby room should work now as they've rolled the new interface out everywhere (no mozilla subdomain needed).
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): This mainly shuffles some things on main thread around. The biggest risk is missing some event on the newly introduced MediaTrack that was only signaled on the old one, but I can't think of any more than the one (enabled/disabled) fixed in this patch.
- String changes made/needed:
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 19•5 years ago
|
||
Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0
I can't confirm the fix on my end - on Ubuntu 18.04 and Nightly 73.0a1 (20191216214733). I see a delay (audio and video), right after the microphone setting is done, but with no noticeable difference between Firefox 72 beta 7 and the latest Nightly 73.0a1 (also, after a short period of time video and audio get in sync)
Alex, please can you confirm whether this issue is still reproducible on the latest Nightly 73.0a1?
Comment 20•5 years ago
|
||
Comment on attachment 9114985 [details]
Bug 1601034 - Add a ProcessedMediaTrack layer in MediaPipelineTransmit to handle replaceTrack of ended tracks. r?dminor!,padenot!
webrtc fix, approved for 72.0b8
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 21•5 years ago
|
||
Ok I just did some testing myself and I think bug 1586370 is playing some tricks on us (same symptoms, and it kicks in with the STR here).
Try this STR instead, it should rule out bug 1586370 by keeping the mic we are changing to on when the switch happens:
- Pick a whereby room to use, from here on called "the room"
- Make sure you have two microphones on your system, from here on called Mic A and Mic B
- Join the room with a separate machine, (or another browser instance on the same machine) -- mute camera and mic
- Go to https://mozilla.github.io/webrtc-landing/gum_test.html, click "Microphone", choose Mic A, mute the audio element
- Go to the room, make sure to select Mic B and any camera
- Continue the original STR:
Press the settings.
Change the microphone (assuming you have more than one)
Press "Apply Changes"
On the new gUM prompt press "Allow"
The remote party reports A/V delay, between 1 and 2 seconds.
Expected: Audio and video stays in sync, even after waiting for some time
Comment 22•5 years ago
|
||
bugherder uplift |
Comment 23•5 years ago
|
||
Thanks Andreas! With the provided steps, I was able to reproduce the initial issue. I can now confirm that audio and video stay in sync on the latest Nightly 73.0a1 and on Firefox 72 beta 8 - verified as fixed on Windows 10 x64 and Ubuntu 18.04.
Reporter | ||
Comment 24•5 years ago
|
||
This is now verified. Also, I have verified the fiddle from comment 4. I am clearing the NI.
Description
•