Closed Bug 870072 Opened 11 years ago Closed 11 years ago

peerconnection: can't add video stream after establishing datachannel connection


(Firefox :: Untriaged, defect)

23 Branch
Windows 7
Not set





(Reporter: fabian, Unassigned)


User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31

Steps to reproduce:

I tried to create a peer connection between two peers (in one script, so without a handshake server), next establish a datachannel connection between the two, and then add a cam stream with gUM to both peers. 

Actual results:

The data channels worked and the cam stream became available on the initiating peer (PC1) but didn't get added to the remote peer.

Expected results:

To me it seems one should be able to add stream and datachannel to a peer connection independently. I came across a chrome bug report that mentioned the same problem in chrome:!topic/discuss-webrtc/3lJREjJRVPE

On this page you can see what I mean:

I have two scenes in this file, see also the comments in the script: 

1. createOffer is called in the initPC1() function. In this case, a datachannel is created but after clicking the 'start cam' button the cam stream isn't added to PC2.

2. createOffer is called when the 'start cam' button is clicked and after the local cam stream is added to PC1. This scene is commented. It does work well, but the drawback is that datachannels and cam streams can't be added independently.

I tried to combine both scenes, which means invoking createOffer at both points. But that doesn't work either.
Summary: webrtc: can't add video stream after establishing datachannel connection → peerconnection: can't add video stream after establishing datachannel connection
With Mozilla Aurora and Nightly (22 and 23), you need to call pc.createDataChannel() before pc.createOffer() in order to get a datachannel.  You can call createDataChannel() later (including in the middle of a call), but you must call it before createOffer().  

Once we support the negotiationneeded event, calling createDataChanne() (or addStream()) after createOffer() (assuming it wasn't called before) will cause negotiationneeded, and an new sequence of createOffer/answer/etc, and that DataChannel will open.

So, until negotiationneeded is in, you have to add all your streams and (if needed) create at least one datachannel before createOffer().  You can create more datachannels later, and close the initial datachannel if you like at any point.

dupping to the renegotiation bug
Closed: 11 years ago
Resolution: --- → DUPLICATE
Ok, thanks for your explanation Randell.
Blocks: 870277
No longer blocks: 870277
You need to log in before you can comment on or make changes to this bug.