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

Side by Side Diff: webrtc/call/call.cc

Issue 2924393002: Move MinPositive to call.h (Closed)
Patch Set: Rebase Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « webrtc/call/call.h ('k') | webrtc/media/base/mediachannel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 942
943 void Call::SetBitrateConfigMask( 943 void Call::SetBitrateConfigMask(
944 const webrtc::Call::Config::BitrateConfigMask& mask) { 944 const webrtc::Call::Config::BitrateConfigMask& mask) {
945 TRACE_EVENT0("webrtc", "Call::SetBitrateConfigMask"); 945 TRACE_EVENT0("webrtc", "Call::SetBitrateConfigMask");
946 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 946 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
947 947
948 bitrate_config_mask_ = mask; 948 bitrate_config_mask_ = mask;
949 UpdateCurrentBitrateConfig(mask.start_bitrate_bps); 949 UpdateCurrentBitrateConfig(mask.start_bitrate_bps);
950 } 950 }
951 951
952 namespace {
953
954 static int MinPositive(int a, int b) {
955 if (a <= 0) {
956 return b;
957 }
958 if (b <= 0) {
959 return a;
960 }
961 return std::min(a, b);
962 }
963
964 } // namespace
965
966 void Call::UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start) { 952 void Call::UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start) {
967 Config::BitrateConfig updated; 953 Config::BitrateConfig updated;
968 updated.min_bitrate_bps = 954 updated.min_bitrate_bps =
969 std::max(bitrate_config_mask_.min_bitrate_bps.value_or(0), 955 std::max(bitrate_config_mask_.min_bitrate_bps.value_or(0),
970 base_bitrate_config_.min_bitrate_bps); 956 base_bitrate_config_.min_bitrate_bps);
971 957
972 updated.max_bitrate_bps = 958 updated.max_bitrate_bps =
973 MinPositive(bitrate_config_mask_.max_bitrate_bps.value_or(-1), 959 MinPositive(bitrate_config_mask_.max_bitrate_bps.value_or(-1),
974 base_bitrate_config_.max_bitrate_bps); 960 base_bitrate_config_.max_bitrate_bps);
975 961
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1377 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1392 receive_side_cc_.OnReceivedPacket( 1378 receive_side_cc_.OnReceivedPacket(
1393 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1379 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1394 header); 1380 header);
1395 } 1381 }
1396 } 1382 }
1397 1383
1398 } // namespace internal 1384 } // namespace internal
1399 1385
1400 } // namespace webrtc 1386 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/call.h ('k') | webrtc/media/base/mediachannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698