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

Unified Diff: webrtc/api/webrtcsdp.cc

Issue 1813763005: Updated structures and functions for setting the max bitrate limit to take rtc::Optional<int> Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Code review feedback Created 4 years, 9 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/api/webrtcsdp.cc
diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc
index 4a296d9ce2e28a274377e3ca79e727f45c5b6e91..ff68bda46e5026d98b6e58d86c15fdb8e23829b4 100644
--- a/webrtc/api/webrtcsdp.cc
+++ b/webrtc/api/webrtcsdp.cc
@@ -1291,9 +1291,9 @@ void BuildMediaDescription(const ContentInfo* content_info,
// RFC 4566
// b=AS:<bandwidth>
- if (media_desc->bandwidth() >= 1000) {
+ if (media_desc->bandwidth() && (*media_desc->bandwidth() >= 1000)) {
InitLine(kLineTypeSessionBandwidth, kApplicationSpecificMaximum, &os);
- os << kSdpDelimiterColon << (media_desc->bandwidth() / 1000);
+ os << kSdpDelimiterColon << (*media_desc->bandwidth() / 1000);
AddLine(os.str(), message);
}
@@ -2553,6 +2553,12 @@ bool ParseContent(const std::string& message,
if (!GetValueFromString(line, bandwidth, &b, error)) {
return false;
}
+ if (b < 0) {
+ std::ostringstream description;
+ description << "The bandwidth value must not be negative";
+ return ParseFailed(line, description.str(), error);
+ }
+
// 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".
@@ -2564,7 +2570,7 @@ bool ParseContent(const std::string& message,
<< cricket::kDataMaxBandwidth / 1000 << "kbps.";
return ParseFailed(line, description.str(), error);
}
- media_desc->set_bandwidth(b * 1000);
+ media_desc->set_bandwidth(rtc::Optional<int>(b * 1000));
}
}
continue;

Powered by Google App Engine
This is Rietveld 408576698