Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compress SDP messages #148

Closed
feross opened this issue Oct 12, 2014 · 15 comments
Closed

Compress SDP messages #148

feross opened this issue Oct 12, 2014 · 15 comments

Comments

@feross
Copy link
Member

@feross feross commented Oct 12, 2014

SDP message compression can significantly lighten the load on the webtorrent tracker and dht by making the signaling messages much smaller. This could be done by giving each peer a common dictionary of frequently-occurring strings that can be referenced to compose a complete SDP message.

@feross feross added the enhancement label Oct 12, 2014
@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Oct 12, 2014

Update: Wow! There's actually an RFC for this already https://www.rfc-editor.org/rfc/rfc3485.txt And it appears there's some mechanism for updating the dictionary that two peers share based on real-world data. This might be overkill since peers only exchange two signaling messages in webtorrent.

Also, this feature would help the webtorrent tracker server scale a lot better by making the messages it has to pass around a lot smaller. Relevant for #145

@piranna

This comment has been minimized.

Copy link

@piranna piranna commented Oct 12, 2014

Update: Wow! There's actually an RFC for this already
https://www.rfc-editor.org/rfc/rfc3485.txt And it appears there's some
mechanism for updating the dictionary that two peers share based on
real-world data.

This should be build in an independent package, so other projects could be
able to use it, too.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Oct 12, 2014

Yep, of course. 👍

@feross feross added the meta label Oct 25, 2014
@feross feross added the area/browser label Nov 26, 2014
@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Nov 26, 2014

In addition to implementing some sort of SDP compression, we should first eliminate the audio lines that are currently being unnecessarily included.

Current example:

v=0
o=- 5292042953471465513 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio data
a=msid-semantic: WMS
m=audio 56990 RTP/SAVPF 111 103 104 0 8 106 105 13 126
c=IN IP4 172.56.6.183
a=rtcp:56990 IN IP4 172.56.6.183
a=candidate:328666875 1 udp 2122260223 172.20.10.2 63412 typ host generation 0
a=candidate:328666875 2 udp 2122260223 172.20.10.2 63412 typ host generation 0
a=candidate:1561653771 1 tcp 1518280447 172.20.10.2 0 typ host tcptype active generation 0
a=candidate:1561653771 2 tcp 1518280447 172.20.10.2 0 typ host tcptype active generation 0
a=candidate:3133702446 1 udp 1686052607 172.56.6.183 56990 typ srflx raddr 172.20.10.2 rport 63412 generation 0
a=candidate:3133702446 2 udp 1686052607 172.56.6.183 56990 typ srflx raddr 172.20.10.2 rport 63412 generation 0
a=ice-ufrag:RKPpHpp/HtlVDiwY
a=ice-pwd:P9OLI9JiBmOYHwmTIhMLXJBW
a=ice-options:google-ice
a=fingerprint:sha-256 86:2A:46:8E:5B:1E:C6:CD:27:FD:11:FF:6F:6A:74:9E:A9:12:9A:D0:36:90:64:D1:F6:D9:1D:E7:2E:8F:58:BF
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=recvonly
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:126 telephone-event/8000
a=maxptime:60
m=application 56990 DTLS/SCTP 5000
c=IN IP4 172.56.6.183
a=candidate:328666875 1 udp 2122260223 172.20.10.2 63412 typ host generation 0
a=candidate:1561653771 1 tcp 1518280447 172.20.10.2 0 typ host tcptype active generation 0
a=candidate:3133702446 1 udp 1686052607 172.56.6.183 56990 typ srflx raddr 172.20.10.2 rport 63412 generation 0
a=ice-ufrag:RKPpHpp/HtlVDiwY
a=ice-pwd:P9OLI9JiBmOYHwmTIhMLXJBW
a=ice-options:google-ice
a=fingerprint:sha-256 86:2A:46:8E:5B:1E:C6:CD:27:FD:11:FF:6F:6A:74:9E:A9:12:9A:D0:36:90:64:D1:F6:D9:1D:E7:2E:8F:58:BF
a=setup:actpass
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024

Should look something like:

v=0
o=- 5292042953471465513 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE data
a=msid-semantic: WMS
m=application 56990 DTLS/SCTP 5000
c=IN IP4 172.56.6.183
a=candidate:328666875 1 udp 2122260223 172.20.10.2 63412 typ host generation 0
a=candidate:1561653771 1 tcp 1518280447 172.20.10.2 0 typ host tcptype active generation 0
a=candidate:3133702446 1 udp 1686052607 172.56.6.183 56990 typ srflx raddr 172.20.10.2 rport 63412 generation 0
a=ice-ufrag:RKPpHpp/HtlVDiwY
a=ice-pwd:P9OLI9JiBmOYHwmTIhMLXJBW
a=ice-options:google-ice
a=fingerprint:sha-256 86:2A:46:8E:5B:1E:C6:CD:27:FD:11:FF:6F:6A:74:9E:A9:12:9A:D0:36:90:64:D1:F6:D9:1D:E7:2E:8F:58:BF
a=setup:actpass
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024
@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Jan 4, 2015

The unnecessary audio lines have been eliminated from the SDP.

Regarding SDP compression, after some investigation, I decided to punt on SDP compression. It's actually quite tricky to get right with all the variations of SDP and the evolving spec. It's also premature optimization. I'll re-open this when/if the webtorrent tracker starts to experience significant load.

@feross feross closed this Jan 4, 2015
@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Mar 26, 2015

@fippo

This comment has been minimized.

Copy link

@fippo fippo commented Mar 26, 2015

note that delivering the answer in near-realtime (<10s) is pretty critical. Updated version soon probably, found a couple of issues.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Mar 26, 2015

Why is it necessary to deliver the answer in near-realtime?

On Thu, Mar 26, 2015 at 5:44 PM Philipp Hancke notifications@github.com
wrote:

note that delivering the answer in near-realtime (<10s) is pretty
critical. Updated version soon probably, found a couple of issues.


Reply to this email directly or view it on GitHub
#148 (comment).

@fippo

This comment has been minimized.

Copy link

@fippo fippo commented Mar 26, 2015

for crazy complicated annoying reasons :-)

there is a 30s timeout on ice checks from the answerer. And since TURN is involved, there are additional complications and round-trips involved. Still debating whether there is a bug, too...

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Apr 1, 2015

@substack

This comment has been minimized.

Copy link
Contributor

@substack substack commented Jun 4, 2015

and soon: an npm package fippo/minimal-webrtc#2

@gauravsaini

This comment has been minimized.

Copy link

@gauravsaini gauravsaini commented Jun 4, 2015

This is exciting 👍

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Jun 6, 2015

Published as sdp-minimizer https://www.npmjs.com/package/sdp-minimizer

@piranna

This comment has been minimized.

Copy link

@piranna piranna commented Jun 6, 2015

Awesome! :-D

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Jun 12, 2015

Now that there's a nice module for this, let's try using it for WebTorrent.

@feross feross reopened this Jun 12, 2015
@feross feross closed this Jul 7, 2015
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.