Index: talk/app/webrtc/webrtcsdp.cc |
diff --git a/talk/app/webrtc/webrtcsdp.cc b/talk/app/webrtc/webrtcsdp.cc |
index aaf9d71940b2670f70c99db638c6d96c69c8747c..434ea5ef7c1749cd8e85cb9dc08eb435e5c62bc0 100644 |
--- a/talk/app/webrtc/webrtcsdp.cc |
+++ b/talk/app/webrtc/webrtcsdp.cc |
@@ -1274,16 +1274,7 @@ void BuildMediaDescription(const ContentInfo* content_info, |
// RFC 4566 |
// b=AS:<bandwidth> |
- // We should always use the default bandwidth for RTP-based data |
- // channels. Don't allow SDP to set the bandwidth, because that |
- // would give JS the opportunity to "break the Internet". |
- // TODO(pthatcher): But we need to temporarily allow the SDP to control |
- // this for backwards-compatibility. Once we don't need that any |
- // more, remove this. |
- bool support_dc_sdp_bandwidth_temporarily = true; |
- if (media_desc->bandwidth() >= 1000 && |
- (media_type != cricket::MEDIA_TYPE_DATA || |
- support_dc_sdp_bandwidth_temporarily)) { |
+ if (media_desc->bandwidth() >= 1000) { |
InitLine(kLineTypeSessionBandwidth, kApplicationSpecificMaximum, &os); |
os << kSdpDelimiterColon << (media_desc->bandwidth() / 1000); |
AddLine(os.str(), message); |
@@ -2249,17 +2240,6 @@ bool ParseMediaDescription(const std::string& message, |
if (!AddSctpDataCodec(data_desc, p)) |
return false; |
} |
- |
- // We should always use the default bandwidth for RTP-based data |
- // channels. Don't allow SDP to set the bandwidth, because that |
- // would give JS the opportunity to "break the Internet". |
- // TODO(pthatcher): But we need to temporarily allow the SDP to control |
- // this for backwards-compatibility. Once we don't need that any |
- // more, remove this. |
- bool support_dc_sdp_bandwidth_temporarily = true; |
- if (content.get() && !support_dc_sdp_bandwidth_temporarily) { |
- content->set_bandwidth(cricket::kAutoBandwidth); |
- } |
} else { |
LOG(LS_WARNING) << "Unsupported media type: " << line; |
continue; |
@@ -2517,6 +2497,16 @@ bool ParseContent(const std::string& message, |
if (!GetValueFromString(line, bandwidth, &b, error)) { |
return false; |
} |
+ // We should never use more than the default bandwidth for RTP-based |
+ // data channels. Don't allow SDP to set the bandwidth, because |
+ // that would give JS the opportunity to "break the Internet". |
pthatcher1
2015/06/24 20:01:56
Please reference the bug URL here.
Just say "See
Taylor Brandstetter
2015/06/24 21:41:24
Done.
|
+ if (media_type == cricket::MEDIA_TYPE_DATA && |
+ b > cricket::kDataMaxBandwidth / 1000) { |
pthatcher1
2015/06/24 20:01:56
&& IsRtp(media_desc->protocol())
Taylor Brandstetter
2015/06/24 21:41:24
Done.
|
+ std::ostringstream description; |
+ description << "SDP data bandwidth must not exceed " |
pthatcher1
2015/06/24 20:01:57
A more accurate message would be "RTP-based data c
Taylor Brandstetter
2015/06/24 21:41:24
Done.
|
+ << cricket::kDataMaxBandwidth / 1000 << "kbps."; |
+ return ParseFailed(line, description.str(), error); |
+ } |
media_desc->set_bandwidth(b * 1000); |
} |
} |