Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Unified Diff: webrtc/media/sctp/sctpdataengine.h

Issue 2254003002: Fixing off-by-one error with max SCTP id. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removing unneeded parentheses. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/sctp/sctpdataengine.h
diff --git a/webrtc/media/sctp/sctpdataengine.h b/webrtc/media/sctp/sctpdataengine.h
index f9a3b5a6547e00dacbffafab6b0404311e608eb9..9b98c0a06cd50cf492055982af9778606537b802 100644
--- a/webrtc/media/sctp/sctpdataengine.h
+++ b/webrtc/media/sctp/sctpdataengine.h
@@ -37,9 +37,15 @@ struct sctp_stream_reset_event;
// Defined by <sys/socket.h>
struct socket;
namespace cricket {
-// The highest stream ID (Sid) that SCTP allows, and the number of streams we
-// tell SCTP we're going to use.
-const uint32_t kMaxSctpSid = 1023;
+// The number of outgoing streams that we'll negotiate. Since stream IDs (SIDs)
+// are 0-based, the highest usable SID is 1023.
+//
+// It's recommended to use the maximum of 65535 in:
+// https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-13#section-6.2
+// However, we use 1024 in order to save memory. usrsctp allocates 104 bytes
+// for each pair of incoming/outgoing streams (on a 64-bit system), so 65535
+// streams would waste ~6MB.
+const uint16_t kMaxSctpStreams = 1024;
pthatcher1 2016/08/22 23:09:30 Why not have *both* kMaxSctpStreams and kMaxSctpSi
Taylor Brandstetter 2016/08/23 00:53:14 Ok. I thought "max streams" made it more clear tha
// This is the default SCTP port to use. It is passed along the wire and the
// connectee and connector must be using the same port. It is not related to the

Powered by Google App Engine
This is Rietveld 408576698