Firefox中的WebRTC直播流(H264)错误,无法生成有效的SDP答案

时间:2018-01-09 10:01:31

标签: firefox webrtc turn janus-gateway

我正在尝试使用Janus WebRTC Gateway在Web浏览器中运行H264编码的实时流。使用Chrome进行测试时,流工作正常但firefox显示ICE failed, add a TURN server and see about:webrtc for more details

以下是我的about:webrtc日志for firefox。

[ 6442450983 ] http://192.168.2.194:5000/ 15:18:19 GMT+0530 (IST)
PeerConnection ID: 1515491295667117 (id=6442450983 url=http://192.168.2.194:5000/)
ICE Stats
Local Candidate Remote Candidate    ICE State   Priority    Nominated   Selected    Bytes sent  Bytes received
ICE restarts:
ICE rollbacks:
SDP
Local SDP

v=0

o=mozilla...THIS_IS_SDPARTA-57.0.4 3500649212029345392 0 IN IP4 0.0.0.0

s=-

t=0 0

a=sendrecv

a=fingerprint:sha-256 11:44:F1:BD:D1:69:8E:17:E0:9A:AA:89:8E:76:9F:4E:09:E1:94:D0:37:34:EE:FE:DF:5E:FC:77:B0:4D:F7:53

a=ice-options:trickle

a=msid-semantic:WMS *

m=video 0 RTP/SAVPF 120

c=IN IP4 0.0.0.0

a=inactive

a=end-of-candidates

a=mid:video

a=rtpmap:120 VP8/90000

Remote SDP

v=0

o=- 1515491295396595 1515491295396595 IN IP4 106.51.68.195

s=-

t=0 0

a=sendrecv

a=group:BUNDLE video

a=msid-semantic:WMS janus

m=video 9 RTP/SAVPF 126

c=IN IP4 106.51.68.195

a=candidate:1 1 udp 2013266431 192.168.2.194 45887 typ host

a=candidate:2 1 udp 1677722111 106.51.68.195 45887 typ srflx raddr 192.168.2.194 rport 45887

a=sendonly

a=end-of-candidates

a=fingerprint:sha-256 D2:B9:31:8F:DF:24:D8:0E:ED:D2:EF:25:9E:AF:6F:B8:34:AE:53:9C:E6:F3:8F:F2:64:15:FA:E8:7F:53:2D:38

a=ice-options:trickle

a=ice-pwd:KsS99rsAZXj9lFd7psCT61

a=ice-ufrag:3tcw

a=mid:video

a=rtcp-fb:126 nack

a=rtcp-fb:126 goog-remb

a=rtcp-mux

a=rtpmap:126 H264/90000

a=setup:actpass

a=ssrc:3973486276 cname:janusvideo

a=ssrc:3973486276 msid:janus janusv0

a=ssrc:3973486276 mslabel:janus

a=ssrc:3973486276 label:janusv0

RTP Stats

我甚至尝试添加以下TURN服务器

{urls: "turn:numb.viagenie.ca",
 username: "l1787875@mvrht.com",
 credential: "test"}

但控制台错误更改为ICE failed, your TURN server appears to be broken, see about:webrtc for more details,保持about:webrtc日志与以前相同。

我发现Firefox无法生成Janus生成的SDP优惠的有效答案。 Firefox创建的答案具有属性rtpmap: 120 VP8/90000,而Janus提供的SDP提议具有属性rtpmap: 127 H264/90000,这阻止了Firefox与Janus建立SDP会话。 Chrome可以使用rtpmap: 127 H264/90000生成有效答案,以便它可以完美地显示流。

我正在使用Mozilla firefox-57.0.4。 有没有办法,我可以从Janus获得/生成有效的SDP answer传入SDP offer

1 个答案:

答案 0 :(得分:-1)

此解决方案适合我(最后一条黄色信息): https://groups.google.com/forum/#!topic/meetecho-janus/jKg5u9421kM

我正在使用Janus,我在Firefox中遇到了同样的错误。 问题是关于SDP profile-level-id。 我只需要替换它:

            // Create offer/answer now
             if(jsep === null || jsep === undefined) {
                     createOffer(handleId, media, callbacks);
             } else {
                     if(adapter.browserDetails.browser === "edge") {
                             // This is Edge, add an a=end-of-candidates at the end
                             jsep.sdp += "a=end-of-candidates\r\n";
                     }
                     var oldsdp = jsep["sdp"];
                     var pattern=/420029/gi;
                     var newsdp = oldsdp.replace(pattern,"42e01f");
                     Janus.log(newsdp);
                     jsep["sdp"]=newsdp;
                     config.pc.setRemoteDescription(
                                     new RTCSessionDescription(jsep),
                                     function() {
                                             Janus.log("Remote description accepted!");
                                             createAnswer(handleId, media, callbacks);
                                     }, callbacks.error);
             }
     }