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

Unified Diff: webrtc/media/engine/webrtcvoiceengine.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: 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/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index ae2518b73af9d74feed8a847d51c4f2f9b60ab9e..4ca83570c4eb71ba809567df5d3f696421c5074e 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -28,6 +28,7 @@
#include "webrtc/base/common.h"
#include "webrtc/base/helpers.h"
#include "webrtc/base/logging.h"
+#include "webrtc/base/optional_ios.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/base/trace_event.h"
@@ -1422,7 +1423,7 @@ bool WebRtcVoiceMediaChannel::SetSendParameters(
}
}
- if (!SetMaxSendBandwidth(params.max_bandwidth_bps)) {
+ if (!SetMaxSendBitrate(params.max_bitrate_bps)) {
return false;
}
return SetOptions(params.options);
@@ -1746,7 +1747,7 @@ bool WebRtcVoiceMediaChannel::SetSendCodecs(int channel) {
}
}
- if (send_bitrate_setting_) {
+ if (send_bitrate_bps_) {
SetSendBitrateInternal(send_bitrate_bps_);
}
@@ -2368,17 +2369,14 @@ bool WebRtcVoiceMediaChannel::MuteStream(uint32_t ssrc, bool muted) {
return true;
}
-// TODO(minyue): SetMaxSendBandwidth() is subject to be renamed to
-// SetMaxSendBitrate() in future.
-bool WebRtcVoiceMediaChannel::SetMaxSendBandwidth(int bps) {
+bool WebRtcVoiceMediaChannel::SetMaxSendBitrate(rtc::Optional<int> bps) {
LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetMaxSendBandwidth.";
return SetSendBitrateInternal(bps);
}
-bool WebRtcVoiceMediaChannel::SetSendBitrateInternal(int bps) {
+bool WebRtcVoiceMediaChannel::SetSendBitrateInternal(rtc::Optional<int> bps) {
LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendBitrateInternal.";
- send_bitrate_setting_ = true;
send_bitrate_bps_ = bps;
if (!HasSendCodec()) {
@@ -2390,7 +2388,7 @@ bool WebRtcVoiceMediaChannel::SetSendBitrateInternal(int bps) {
// Bitrate is auto by default.
// TODO(bemasc): Fix this so that if SetMaxSendBandwidth(50) is followed by
// SetMaxSendBandwith(0), the second call removes the previous limit.
- if (bps <= 0)
+ if (!bps)
return true;
webrtc::CodecInst codec = send_codec_spec_.codec_inst;
@@ -2398,7 +2396,7 @@ bool WebRtcVoiceMediaChannel::SetSendBitrateInternal(int bps) {
if (is_multi_rate) {
// If codec is multi-rate then just set the bitrate.
- codec.rate = bps;
+ codec.rate = *bps;
for (const auto& ch : send_streams_) {
if (!SetSendCodec(ch.second->channel(), codec)) {
LOG(LS_INFO) << "Failed to set codec " << codec.plname
@@ -2411,7 +2409,7 @@ bool WebRtcVoiceMediaChannel::SetSendBitrateInternal(int bps) {
// If codec is not multi-rate and |bps| is less than the fixed bitrate
// then fail. If codec is not multi-rate and |bps| exceeds or equal the
// fixed bitrate then ignore.
- if (bps < codec.rate) {
+ if (*bps < codec.rate) {
LOG(LS_INFO) << "Failed to set codec " << codec.plname
<< " to bitrate " << bps << " bps"
<< ", requires at least " << codec.rate << " bps.";

Powered by Google App Engine
This is Rietveld 408576698