Closed Bug 1449042 Opened 6 years ago Closed 6 years ago

bytesReceived but no video after adding video in second round of negotiation

Categories

(Core :: WebRTC: Signaling, defect, P2)

59 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox-esr52 --- unaffected
firefox59 --- wontfix
firefox60 + fixed
firefox61 --- fixed

People

(Reporter: mroberts, Assigned: bwc)

References

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Steps to reproduce:

Please try this JSFiddle: https://jsfiddle.net/g00n3qca/

Basically,

1. Two RTCPeerConnections (P1 and P2) connect to each other. P1 and P2 both share two audio MediaStreamTracks each. P2 offers with offerToReceiveVideo set to true. The result is two audio m=sections and one video m=section (BUNDLE group is "sdparta_0 sdparta_1 sdparta_2"). P1's m=video section has a=inactive.
2. P1 adds a video MediaStreamTrack and re-offers (BUNDLE group is still "sdparta_0 sdparta_1 sdparta_2").


Actual results:

P2 receives a video MediaStreamTrack from P1. getStats shows that P2 receives bytes for this track.

However, depending on the delay between Steps 1 and 2, the video may not play back correctly when attached to a video element on the DOM. Initially, I thought this might be a user gesture issue (so I added the "Mute video" checkbox), but I don't think it's related to user gesture.

In the JSFiddle, checking the delay checkbox introduces a delay of 15 s between the first and second rounds of negotiation.

Tested with Firefox 59.0.1 and Firefox 59.0.2. It takes a few times to (maybe 4 or 5) to trigger the failure. When the failure occurs, I can right click the video element and see playback options (like "Pause") in the menu (see screenshot).


Expected results:

P2 receives a video MediaStreamTrack from P1. getStats shows that P2 receives bytes for this track. The received video MediaStreamTrack plays back correctly when attached to a video element on the DOM.
Byron, can you have a look if this is fall out from the Transceivers work?
Rank: 15
Component: Untriaged → WebRTC: Signaling
Flags: needinfo?(docfaraday)
Priority: -- → P2
Product: Firefox → Core
Does delaying the second negotiation tend to cause the failure, or prevent it?
Flags: needinfo?(mroberts)
Ok, so delaying the second negotiation seems to prevent the video stream from being displayed. The bytes received counter goes up, and more notably it _starts_ with a value as if the video stream was being received since the first negotiation took place!

I've experimented with the fiddle, and it seems that we also run into trouble if we create the new video track immediately following the first negotiation. This happens even if I attach the video track to a new stream (to rule out problems caused by A/V sync).

https://jsfiddle.net/fgo865cf/26/

The problem goes away if I remove the {offerToReceiveVideo: true}. The problem also goes away if I use only one audio track in each direction.
Flags: needinfo?(jib)
Flags: needinfo?(apehrson)
> Does delaying the second negotiation tend to cause the failure, or prevent it?

Yes, AFAICT, delaying the second negotiation tends to cause the failure, as you noticed in #3.

> The problem goes away if I remove the {offerToReceiveVideo: true}.

This is effectively convenience for adding a video transceiver, so we shouldn't expect a difference in behavior if `addTransceiver('video')` is used instead?

> The problem also goes away if I use only one audio track in each direction.

I also noticed this.
Flags: needinfo?(mroberts)
Looking at the logging, something is getting very confused about updating SSRCs (I see a VideoConduit updating the receive SSRC to the SSRC negotiated for an audio track!). I wonder if this is related to bug 1394602?
Assignee: nobody → docfaraday
Flags: needinfo?(docfaraday)
I don't think I can be of assistance here, but I'll follow along.
Flags: needinfo?(apehrson)
Comment on attachment 8963272 [details]
Bug 1449042: Negotiate tracks even when they're not active.

https://reviewboard.mozilla.org/r/232168/#review237686

LGTM
Attachment #8963272 - Flags: review?(drno) → review+
Pushed by bcampen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a9c4bf921486
Negotiate tracks even when they're not active. r=drno
https://hg.mozilla.org/mozilla-central/rev/a9c4bf921486
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
This was reported in 59, and works in 58 for me, so I'm marking this as a regression. As such we should try getting it into 60, unless someone disagrees.

[Tracking Requested - why for this release]: A bit of an edge-case perhaps, but video failing to appear in a WebRTC call is bad.
Flags: needinfo?(jib)
Keywords: regression
Sounds like this needs a Beta approval request given comment 13.
Flags: needinfo?(docfaraday)
Blocks: 1290948
Flags: needinfo?(docfaraday)
Comment on attachment 8963272 [details]
Bug 1449042: Negotiate tracks even when they're not active.

Approval Request Comment
[Feature/Bug causing the regression]:

   Bug 1290948

[User impact if declined]:

   Some webrtc mute scenarios will not work properly.

[Is this code covered by automated tests?]:

   Not really.

[Has the fix been verified in Nightly?]:

   Yes.

[Needs manual test from QE? If yes, steps to reproduce]: 

   No.

[List of other uplifts needed for the feature/fix]:

   None.

[Is the change risky?]:

   Not very.

[Why is the change risky/not risky?]:

   We're just invoking the most common code path in an additional case.

[String changes made/needed]:

   None.
Attachment #8963272 - Flags: approval-mozilla-beta?
Comment on attachment 8963272 [details]
Bug 1449042: Negotiate tracks even when they're not active.

webrtc regression fix, approved for 60.0b10
Attachment #8963272 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: