我应该通过哪些WebRTC约束和选项来获得Firefox和Google Chrome之间的互操作性

时间:2014-07-31 06:42:27

标签: google-chrome firefox webrtc

我正在为局域网构建聊天应用程序。我使用WebRTC但无法通过Firefox和Google Chrome进行互操作。 我不知道应该传递给RTCPeerConnection createOffer / createAnswer的确切参数。

我在同一台计算机Fedora Linux 20中使用 Firefox 31 Google Chrome 36 进行了以下测试

RTCPeerConnection创建如下:     pc = new RTCPeerConnection(null, RTC_PC_OPTIONS);

答案/优惠的创建方式如下:     pc.createOffer(onsuccess, onfail, CONSTRAINTS);

我的问题是:我应该通过哪些参数(RTC_PC_OPTIONSCONSTRAINTS)来获得两个浏览器之间的互操作性?

测试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

测试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

测试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创建优惠并将其发送至FFx,FFx收到优惠,创建答案并将其发送至Chrome,
  2. chrome收到答案。但onaddstream并没有在firefox中被触发


    1. 在Chrome收到FFx发送的优惠后,它会向控制台记录错误:
    2. Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set data send codecs..


      1. Chrome发送优惠,FFx发送答案,
      2. chrome收到此错误:Failed to parse SessionDescription. m=application 35224 RTP/SAVPF Expects at least 4 fields.

        FFx收到此错误:ICE failed, see about:webrtc for more details

        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收到错误:Uncaught NetworkError: Failed to execute 'send' on 'RTCDataChannel': Could not send data
        2. chrome_2收到错误:

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


          1. 来电者发送要约,被叫方收到错误:
          2. Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set data send codecs.


            1. 喜欢[1]一切正常,但onaddstream未触发

1 个答案:

答案 0 :(得分:5)

所以,有一些事情:

  1. 无论MDN页面是什么建议RTPDataChannels都已过时(让我知道URL)。 Firefox和Chrome现在都支持规范DataChannel。对于DTLSSRTPKeyAgreement我也相信
  2. 确保在createOffer()
  3. 之前调用createDataChannel()
  4. 是视频还是视频+音频?如果我记得没有触发onAddStream,我们最近修复了仅限视频流的错误。这可以解释我认为1和[6]。见bug 1035067,登陆夜间和极光(FF33);我已经要求提升到Beta / 32
  5. "期待4个字段"问题如果我记得是Firefox中的错误 - 你运行的是什么版本?我们确实在30(?)中修复了一个错误,我们在末尾有一个不需要的空间导致chrome拒绝它 - 他们修补它以避免它,我们修复它。
  6. 尝试使用FF Beta和Nightly(http://nightly.mozilla.org/)。当您报告此类内容时,请说明您正在使用的浏览器版本! : - )