Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What WebRTC constraints and options should i pass to get interoperability between Firefox and Google chrome

I'm building a chat application for a LAN. I use WebRTC but can't get Firefox and Google chrome to interoperate. I don't know the exact parameters i should pass to RTCPeerConnection createOffer/createAnswer.

I made the tests below with Firefox 31 and Google Chrome 36 in the same computer Fedora Linux 20

RTCPeerConnection is created like: pc = new RTCPeerConnection(null, RTC_PC_OPTIONS);

answers/offers are created like: pc.createOffer(onsuccess, onfail, CONSTRAINTS);

My question is: which parameters (RTC_PC_OPTIONS and CONSTRAINTS) should i pass to get interoperability between the two browsers?

Test 1

RTC_PC_OPTIONS = undefined
CONSTRAINTS = undefined

                        FFx2FFx     FFx2Chrome      Chrome2FFx      Chrome2Chrome
                        -------     ----------      ----------      -------------
dataChannel setup       ok          ok              ok              ok
dataChannel send/recv   ok          ok              ok              ok
Video stream            ok          ok              err [1]         ok

Test 2

MDN recomands this value for RTC_PC_OPTIONS

RTC_PC_OPTIONS = {
    optional: [
        {DtlsSrtpKeyAgreement: true},
        {RtpDataChannels: true}
    ]
};
CONSTRAINTS = undefined

                        FFx2FFx     FFx2Chrome      Chrome2FFx      Chrome2Chrome
                        -------     ----------      ----------      -------------
dataChannel setup       ok          err [2]         err [3]         ok
dataChannel send/recv   ok          -               -               ok
Video stream            ok          -               -               err [4]
                                    ^~~~~~~~~~~~~~~~^ 
                                            ^
                   i used datachannel to do signaling for the video TRCPeerConnection,
                   that is why these were not tested

Test 3

RTC_PC_OPTIONS = undefined
CONSTRAINTS = { 'mandatory': { 'OfferToReceiveAudio': true, 'OfferToReceiveVideo': true } }

                        FFx2FFx     FFx2Chrome      Chrome2FFx      Chrome2Chrome
                        -------     ----------      ----------      -------------
dataChannel setup       ok          ok              ok              err [5]
dataChannel send/recv   ok          ok              ok              -
Video stream            err [6]     ok              err [6]         -

  1. Chrome creates offer and sends it to FFx, FFx receives offer, creates answer and sends it to chrome,

chrome receives the answer. But onaddstream is not triggred in firefox


  1. After chrome receives the offer sent by FFx, it logs an error to the console:

Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set data send codecs..


  1. Chrome sends the offer, FFx sends the answer,

chrome gets this error: Failed to parse SessionDescription. m=application 35224 RTP/SAVPF Expects at least 4 fields.

FFx gets this error: ICE failed, see about:webrtc for more details

In about:webrtc:

Local candidate Remote candidate ICE State Priority Nominated Selected a.b.c.d:35224/udp(host) a.b.c.d:45895/udp(host) frozen 9115005270282354000


  1. Chrome_1 gets the error: Uncaught NetworkError: Failed to execute 'send' on 'RTCDataChannel': Could not send data

chrome_2 gets the error:

Uncaught SyntaxError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added.


  1. The caller sends the offer, the callee gets an error:

Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set data send codecs.


  1. Like [1] everything ok but onaddstream not triggered
like image 676
nawfel bgh Avatar asked Jul 31 '14 06:07

nawfel bgh


1 Answers

So, a few things:

  1. Whatever MDN page suggests RTPDataChannels is very outdated (let me know the URL). Both Firefox and Chrome support spec DataChannels now. Same for DTLSSRTPKeyAgreement I believe
  2. Make sure you call createDataChannel() before createOffer()
  3. Is it video-only, or video+audio? We fixed a bug with video-only streams recently if I recall not triggering onAddStream. That would explain 1 and [6] I think. See bug 1035067, which is landed in Nightly and Aurora (FF33); I've asked for uplift to Beta/32
  4. The "expects 4 fields" issue if I recall was bug in Firefox - what versions are you running? We did have a bug fixed in 30(?) where we had an unneeded space on the end which caused chrome to reject it - they patched to avoid it, and we fixed it.

Try it with FF Beta, and Nightly (http://nightly.mozilla.org/). And when you report things like this, please indicate what versions of browser you're using! :-)

like image 65
jesup Avatar answered Nov 16 '22 03:11

jesup