Skip to content

Commit

Permalink
example SDP sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Feb 19, 2013
1 parent f051f25 commit 3aac684
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 91 deletions.
61 changes: 25 additions & 36 deletions examples/holla.js
Original file line number Diff line number Diff line change
Expand Up @@ -3696,7 +3696,7 @@ require.register("holla/dist/Call.js", function(exports, require, module){
require.register("holla/dist/RTC.js", function(exports, require, module){
// Generated by CoffeeScript 1.4.0
(function() {
var IceCandidate, MediaStream, PeerConnection, SessionDescription, URL, attachStream, browser, extract, getUserMedia, mediaConstraints, mergeConstraints, processSDPIn, processSDPOut, removeCN, replaceCodec, shim, supported, useOPUS;
var IceCandidate, MediaStream, PeerConnection, SessionDescription, URL, attachStream, browser, extract, getUserMedia, processSDPIn, processSDPOut, removeCN, replaceCodec, shim, supported, useOPUS;

PeerConnection = window.mozRTCPeerConnection || window.PeerConnection || window.webkitPeerConnection00 || window.webkitRTCPeerConnection;

Expand All @@ -3714,19 +3714,6 @@ require.register("holla/dist/RTC.js", function(exports, require, module){

supported = (PeerConnection != null) && (getUserMedia != null);

mediaConstraints = {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true,
MozDontOfferDataChannel: true
},
optional: [
{
DtlsSrtpKeyAgreement: true
}
]
};

getUserMedia = getUserMedia.bind(navigator);

extract = function(str, reg) {
Expand Down Expand Up @@ -3851,29 +3838,8 @@ require.register("holla/dist/RTC.js", function(exports, require, module){
return el;
};

mergeConstraints = function(a, b) {
var k, nu, v, _ref, _ref1;
nu = {
mandatory: {},
optional: []
};
_ref = a.mandatory;
for (k in _ref) {
v = _ref[k];
nu.mandatory[k] = v;
}
_ref1 = b.mandatory;
for (k in _ref1) {
v = _ref1[k];
nu.mandatory[k] = v;
}
nu = nu.optional.concat(a.optional);
nu = nu.optional.concat(b.optional);
return nu;
};

shim = function() {
var PeerConnConfig, out;
var PeerConnConfig, mediaConstraints, out;
if (!supported) {
return;
}
Expand All @@ -3885,6 +3851,18 @@ require.register("holla/dist/RTC.js", function(exports, require, module){
}
]
};
mediaConstraints = {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true,
MozDontOfferDataChannel: true
},
optional: [
{
DtlsSrtpKeyAgreement: true
}
]
};
MediaStream.prototype.getVideoTracks = function() {
return [];
};
Expand All @@ -3899,6 +3877,17 @@ require.register("holla/dist/RTC.js", function(exports, require, module){
}
]
};
mediaConstraints = {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true
},
optional: [
{
DtlsSrtpKeyAgreement: true
}
]
};
if (!MediaStream.prototype.getVideoTracks) {
MediaStream.prototype.getVideoTracks = function() {
return this.videoTracks;
Expand Down
61 changes: 25 additions & 36 deletions holla.js
Original file line number Diff line number Diff line change
Expand Up @@ -3696,7 +3696,7 @@ require.register("holla/dist/Call.js", function(exports, require, module){
require.register("holla/dist/RTC.js", function(exports, require, module){
// Generated by CoffeeScript 1.4.0
(function() {
var IceCandidate, MediaStream, PeerConnection, SessionDescription, URL, attachStream, browser, extract, getUserMedia, mediaConstraints, mergeConstraints, processSDPIn, processSDPOut, removeCN, replaceCodec, shim, supported, useOPUS;
var IceCandidate, MediaStream, PeerConnection, SessionDescription, URL, attachStream, browser, extract, getUserMedia, processSDPIn, processSDPOut, removeCN, replaceCodec, shim, supported, useOPUS;

PeerConnection = window.mozRTCPeerConnection || window.PeerConnection || window.webkitPeerConnection00 || window.webkitRTCPeerConnection;

Expand All @@ -3714,19 +3714,6 @@ require.register("holla/dist/RTC.js", function(exports, require, module){

supported = (PeerConnection != null) && (getUserMedia != null);

mediaConstraints = {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true,
MozDontOfferDataChannel: true
},
optional: [
{
DtlsSrtpKeyAgreement: true
}
]
};

getUserMedia = getUserMedia.bind(navigator);

extract = function(str, reg) {
Expand Down Expand Up @@ -3851,29 +3838,8 @@ require.register("holla/dist/RTC.js", function(exports, require, module){
return el;
};

mergeConstraints = function(a, b) {
var k, nu, v, _ref, _ref1;
nu = {
mandatory: {},
optional: []
};
_ref = a.mandatory;
for (k in _ref) {
v = _ref[k];
nu.mandatory[k] = v;
}
_ref1 = b.mandatory;
for (k in _ref1) {
v = _ref1[k];
nu.mandatory[k] = v;
}
nu = nu.optional.concat(a.optional);
nu = nu.optional.concat(b.optional);
return nu;
};

shim = function() {
var PeerConnConfig, out;
var PeerConnConfig, mediaConstraints, out;
if (!supported) {
return;
}
Expand All @@ -3885,6 +3851,18 @@ require.register("holla/dist/RTC.js", function(exports, require, module){
}
]
};
mediaConstraints = {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true,
MozDontOfferDataChannel: true
},
optional: [
{
DtlsSrtpKeyAgreement: true
}
]
};
MediaStream.prototype.getVideoTracks = function() {
return [];
};
Expand All @@ -3899,6 +3877,17 @@ require.register("holla/dist/RTC.js", function(exports, require, module){
}
]
};
mediaConstraints = {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true
},
optional: [
{
DtlsSrtpKeyAgreement: true
}
]
};
if (!MediaStream.prototype.getVideoTracks) {
MediaStream.prototype.getVideoTracks = function() {
return this.videoTracks;
Expand Down
2 changes: 1 addition & 1 deletion holla.min.js

Large diffs are not rendered by default.

34 changes: 16 additions & 18 deletions lib/RTC.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ URL = window.URL or window.webkitURL or window.msURL or window.oURL

browser = (if navigator.mozGetUserMedia then 'firefox' else 'chrome')
supported = (PeerConnection? and getUserMedia?)
mediaConstraints =
mandatory:
OfferToReceiveAudio: true
OfferToReceiveVideo: true
MozDontOfferDataChannel: true
optional: [
DtlsSrtpKeyAgreement: true
]

# scope bind hax
getUserMedia = getUserMedia.bind navigator
Expand Down Expand Up @@ -88,16 +80,6 @@ attachStream = (uri, el) ->
el.play()
return el

mergeConstraints = (a,b) ->
nu =
mandatory: {}
optional: []
nu.mandatory[k]=v for k,v of a.mandatory
nu.mandatory[k]=v for k,v of b.mandatory
nu = nu.optional.concat a.optional
nu = nu.optional.concat b.optional
return nu

shim = ->
return unless supported # no need to shim
if browser is 'firefox'
Expand All @@ -106,13 +88,29 @@ shim = ->
url: "stun:23.21.150.121"
]

mediaConstraints =
mandatory:
OfferToReceiveAudio: true
OfferToReceiveVideo: true
MozDontOfferDataChannel: true
optional: [
DtlsSrtpKeyAgreement: true
]

MediaStream::getVideoTracks = -> []
MediaStream::getAudioTracks = -> []
else
PeerConnConfig =
iceServers: [
url: "stun:stun.l.google.com:19302"
]
mediaConstraints =
mandatory:
OfferToReceiveAudio: true
OfferToReceiveVideo: true
optional: [
DtlsSrtpKeyAgreement: true
]
unless MediaStream::getVideoTracks
MediaStream::getVideoTracks = -> @videoTracks
MediaStream::getAudioTracks = -> @audioTracks
Expand Down
100 changes: 100 additions & 0 deletions lib/sequence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Offer from Chrome

```
v=0
o=- 1196243851 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS ZiNUtAFWWumqt0tovX6AWjSj540TU2dTxoVT
m=audio 1 RTP/SAVPF 111 104 0 8 106 13 126
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=ice-ufrag:oWdWJcVO8aIJAiqu
a=ice-pwd:qETFnPXhDkDbiLPAwtEHuh8q
a=fingerprint:sha-256 89:EB:6B:92:D6:9A:64:4F:CC:78:B1:BA:99:A6:4B:3E:DB:B1:6F:0C:FE:5E:10:4D:2F:95:6D:C6:74:7C:80:DB
a=sendrecv
a=mid:audio
a=rtcp-mux
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:OgW6XsC5w75ftvs2bDHB2IM2sj5o03q0QHPYMrpE
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:111 opus/48000/2
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:13 CN/8000
a=rtpmap:126 telephone-event/8000
a=ssrc:1216895321 cname:lGlprdoJnf8ppmQc
a=ssrc:1216895321 msid:ZiNUtAFWWumqt0tovX6AWjSj540TU2dTxoVT a0
a=ssrc:1216895321 mslabel:ZiNUtAFWWumqt0tovX6AWjSj540TU2dTxoVT
a=ssrc:1216895321 label:ZiNUtAFWWumqt0tovX6AWjSj540TU2dTxoVTa0
m=video 1 RTP/SAVPF 100 116 117
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=ice-ufrag:oWdWJcVO8aIJAiqu
a=ice-pwd:qETFnPXhDkDbiLPAwtEHuh8q
a=fingerprint:sha-256 89:EB:6B:92:D6:9A:64:4F:CC:78:B1:BA:99:A6:4B:3E:DB:B1:6F:0C:FE:5E:10:4D:2F:95:6D:C6:74:7C:80:DB
a=sendrecv
a=mid:video
a=rtcp-mux
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:OgW6XsC5w75ftvs2bDHB2IM2sj5o03q0QHPYMrpE
a=rtpmap:100 VP8/90000
a=rtpmap:116 red/90000
a=rtpmap:117 ulpfec/90000
a=ssrc:1989440299 cname:lGlprdoJnf8ppmQc
a=ssrc:1989440299 msid:ZiNUtAFWWumqt0tovX6AWjSj540TU2dTxoVT v0
a=ssrc:1989440299 mslabel:ZiNUtAFWWumqt0tovX6AWjSj540TU2dTxoVT
a=ssrc:1989440299 label:ZiNUtAFWWumqt0tovX6AWjSj540TU2dTxoVTv0
```


# Offer from FF

```
v=0
o=Mozilla-SIPUA 13019 0 IN IP4 0.0.0.0
s=SIP Call
t=0 0
a=ice-ufrag:08ea3118
a=ice-pwd:9461ee1123a4a0378624117018042460
a=fingerprint:sha-256 D2:3F:8A:AB:B5:A1:CE:DC:E5:64:95:BD:9B:C3:23:CF:5F:6D:BD:13:FA:24:61:58:2C:64:53:9A:10:26:D4:F5
m=audio 63274 RTP/SAVPF 109 0 8 101
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:BAADBAADBAADBAADBAADBAADBAADBAADBAADBAAD
c=IN IP4 38.104.206.46
a=rtpmap:109 opus/48000/2
a=ptime:20
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=candidate:0 1 UDP 2113667327 192.168.23.176 64731 typ host
a=candidate:1 1 UDP 1694264319 38.104.206.46 63274 typ srflx raddr 192.168.23.176 rport 64731
a=candidate:2 1 UDP 2113339647 10.199.16.117 63268 typ host
a=candidate:0 2 UDP 2113667326 192.168.23.176 63625 typ host
a=candidate:1 2 UDP 1694264318 38.104.206.46 1088 typ srflx raddr 192.168.23.176 rport 63625
a=candidate:2 2 UDP 2113339646 10.199.16.117 60279 typ host
m=video 28074 RTP/SAVPF 120
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:BAADBAADBAADBAADBAADBAADBAADBAADBAADBAAD
c=IN IP4 38.104.206.46
a=rtpmap:120 VP8/90000
a=sendrecv
a=candidate:0 1 UDP 2113667327 192.168.23.176 52585 typ host
a=candidate:1 1 UDP 1694264319 38.104.206.46 28074 typ srflx raddr 192.168.23.176 rport 52585
a=candidate:2 1 UDP 2113339647 10.199.16.117 60568 typ host
a=candidate:0 2 UDP 2113667326 192.168.23.176 52095 typ host
a=candidate:1 2 UDP 1694264318 38.104.206.46 10636 typ srflx raddr 192.168.23.176 rport 52095
a=candidate:2 2 UDP 2113339646 10.199.16.117 54253 typ host
m=application 3085 SCTP/DTLS 5000
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:BAADBAADBAADBAADBAADBAADBAADBAADBAADBAAD
c=IN IP4 38.104.206.46
a=fmtp:5000 protocol=webrtc-datachannel;streams=16
a=sendrecv
a=candidate:0 1 UDP 2113667327 192.168.23.176 63476 typ host
a=candidate:1 1 UDP 1694264319 38.104.206.46 3085 typ srflx raddr 192.168.23.176 rport 63476
a=candidate:2 1 UDP 2113339647 10.199.16.117 56979 typ host
a=candidate:0 2 UDP 2113667326 192.168.23.176 62303 typ host
a=candidate:1 2 UDP 1694264318 38.104.206.46 9813 typ srflx raddr 192.168.23.176 rport 62303
a=candidate:2 2 UDP 2113339646 10.199.16.117 54226 typ host
```

0 comments on commit 3aac684

Please sign in to comment.