OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |