Moved BitrateConfig out of Call::Config.
This prepares for a CL extracting the bitrate configuration logic from the Call class. Also renaming BitrateConfig to BitrateConstraints. Bug: webrtc:8415 Change-Id: I7e472683034c57bdc8093cdf5e78e477d1732480 Reviewed-on: https://webrtc-review.googlesource.com/54400 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22104}
This commit is contained in:
parent
a05ee82c4c
commit
5897fe27ab
@ -42,6 +42,8 @@ rtc_source_set("call_interfaces") {
|
||||
# when interfaces have stabilized. See also TODO for |mock_rtp_interfaces|.
|
||||
rtc_source_set("rtp_interfaces") {
|
||||
sources = [
|
||||
"bitrate_constraints.cc",
|
||||
"bitrate_constraints.h",
|
||||
"rtcp_packet_sink_interface.h",
|
||||
"rtp_config.cc",
|
||||
"rtp_config.h",
|
||||
@ -51,6 +53,7 @@ rtc_source_set("rtp_interfaces") {
|
||||
]
|
||||
deps = [
|
||||
"../api:array_view",
|
||||
"../api:optional",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
]
|
||||
}
|
||||
|
||||
18
call/bitrate_constraints.cc
Normal file
18
call/bitrate_constraints.cc
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "call/bitrate_constraints.h"
|
||||
|
||||
namespace webrtc {
|
||||
BitrateConstraintsMask::BitrateConstraintsMask() = default;
|
||||
BitrateConstraintsMask::~BitrateConstraintsMask() = default;
|
||||
BitrateConstraintsMask::BitrateConstraintsMask(const BitrateConstraintsMask&) =
|
||||
default;
|
||||
} // namespace webrtc
|
||||
53
call/bitrate_constraints.h
Normal file
53
call/bitrate_constraints.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef CALL_BITRATE_CONSTRAINTS_H_
|
||||
#define CALL_BITRATE_CONSTRAINTS_H_
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "api/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
// TODO(srte): BitrateConstraints and BitrateConstraintsMask should be merged.
|
||||
// Both represent the same kind data, but are using different default
|
||||
// initializer and representation of unset values.
|
||||
struct BitrateConstraints {
|
||||
static constexpr int kDefaultStartBitrateBps = 300000;
|
||||
int min_bitrate_bps = 0;
|
||||
int start_bitrate_bps = kDefaultStartBitrateBps;
|
||||
int max_bitrate_bps = -1;
|
||||
};
|
||||
|
||||
// BitrateConstraintsMask is used for the local client's bitrate preferences.
|
||||
// Semantically it carries the same kind of information as BitrateConstraints,
|
||||
// but is used in a slightly different way.
|
||||
struct BitrateConstraintsMask {
|
||||
BitrateConstraintsMask();
|
||||
~BitrateConstraintsMask();
|
||||
BitrateConstraintsMask(const BitrateConstraintsMask&);
|
||||
rtc::Optional<int> min_bitrate_bps;
|
||||
rtc::Optional<int> start_bitrate_bps;
|
||||
rtc::Optional<int> max_bitrate_bps;
|
||||
};
|
||||
|
||||
// Like std::min, but considers non-positive values to be unset.
|
||||
template <typename T>
|
||||
static T MinPositive(T a, T b) {
|
||||
if (a <= 0) {
|
||||
return b;
|
||||
}
|
||||
if (b <= 0) {
|
||||
return a;
|
||||
}
|
||||
return std::min(a, b);
|
||||
}
|
||||
} // namespace webrtc
|
||||
#endif // CALL_BITRATE_CONSTRAINTS_H_
|
||||
18
call/call.cc
18
call/call.cc
@ -213,10 +213,10 @@ class Call : public webrtc::Call,
|
||||
void OnRecoveredPacket(const uint8_t* packet, size_t length) override;
|
||||
|
||||
void SetBitrateConfig(
|
||||
const webrtc::Call::Config::BitrateConfig& bitrate_config) override;
|
||||
const webrtc::BitrateConstraints& bitrate_config) override;
|
||||
|
||||
void SetBitrateConfigMask(
|
||||
const webrtc::Call::Config::BitrateConfigMask& bitrate_config) override;
|
||||
const webrtc::BitrateConstraintsMask& bitrate_config) override;
|
||||
|
||||
void SetBitrateAllocationStrategy(
|
||||
std::unique_ptr<rtc::BitrateAllocationStrategy>
|
||||
@ -261,7 +261,7 @@ class Call : public webrtc::Call,
|
||||
void UpdateHistograms();
|
||||
void UpdateAggregateNetworkState();
|
||||
|
||||
// Applies update to the BitrateConfig cached in |config_|, restarting
|
||||
// Applies update to the BitrateConstraints cached in |config_|, restarting
|
||||
// bandwidth estimation from |new_start| if set.
|
||||
void UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start);
|
||||
|
||||
@ -374,11 +374,11 @@ class Call : public webrtc::Call,
|
||||
|
||||
// The config mask set by SetBitrateConfigMask.
|
||||
// 0 <= min <= start <= max
|
||||
Config::BitrateConfigMask bitrate_config_mask_;
|
||||
BitrateConstraintsMask bitrate_config_mask_;
|
||||
|
||||
// The config set by SetBitrateConfig.
|
||||
// min >= 0, start != 0, max == -1 || max > 0
|
||||
Config::BitrateConfig base_bitrate_config_;
|
||||
BitrateConstraints base_bitrate_config_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(Call);
|
||||
};
|
||||
@ -954,8 +954,7 @@ Call::Stats Call::GetStats() const {
|
||||
return stats;
|
||||
}
|
||||
|
||||
void Call::SetBitrateConfig(
|
||||
const webrtc::Call::Config::BitrateConfig& bitrate_config) {
|
||||
void Call::SetBitrateConfig(const BitrateConstraints& bitrate_config) {
|
||||
TRACE_EVENT0("webrtc", "Call::SetBitrateConfig");
|
||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
|
||||
RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0);
|
||||
@ -978,8 +977,7 @@ void Call::SetBitrateConfig(
|
||||
UpdateCurrentBitrateConfig(new_start);
|
||||
}
|
||||
|
||||
void Call::SetBitrateConfigMask(
|
||||
const webrtc::Call::Config::BitrateConfigMask& mask) {
|
||||
void Call::SetBitrateConfigMask(const BitrateConstraintsMask& mask) {
|
||||
TRACE_EVENT0("webrtc", "Call::SetBitrateConfigMask");
|
||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
|
||||
|
||||
@ -988,7 +986,7 @@ void Call::SetBitrateConfigMask(
|
||||
}
|
||||
|
||||
void Call::UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start) {
|
||||
Config::BitrateConfig updated;
|
||||
BitrateConstraints updated;
|
||||
updated.min_bitrate_bps =
|
||||
std::max(bitrate_config_mask_.min_bitrate_bps.value_or(0),
|
||||
base_bitrate_config_.min_bitrate_bps);
|
||||
|
||||
38
call/call.h
38
call/call.h
@ -20,6 +20,7 @@
|
||||
#include "call/audio_receive_stream.h"
|
||||
#include "call/audio_send_stream.h"
|
||||
#include "call/audio_state.h"
|
||||
#include "call/bitrate_constraints.h"
|
||||
#include "call/flexfec_receive_stream.h"
|
||||
#include "call/rtp_transport_controller_send_interface.h"
|
||||
#include "call/video_receive_stream.h"
|
||||
@ -43,19 +44,6 @@ enum class MediaType {
|
||||
DATA
|
||||
};
|
||||
|
||||
// Like std::min, but considers non-positive values to be unset.
|
||||
// TODO(zstein): Remove once all callers use rtc::Optional.
|
||||
template <typename T>
|
||||
static T MinPositive(T a, T b) {
|
||||
if (a <= 0) {
|
||||
return b;
|
||||
}
|
||||
if (b <= 0) {
|
||||
return a;
|
||||
}
|
||||
return std::min(a, b);
|
||||
}
|
||||
|
||||
class PacketReceiver {
|
||||
public:
|
||||
enum DeliveryStatus {
|
||||
@ -77,26 +65,9 @@ struct CallConfig {
|
||||
RTC_DCHECK(event_log);
|
||||
}
|
||||
|
||||
static constexpr int kDefaultStartBitrateBps = 300000;
|
||||
|
||||
// Bitrate config used until valid bitrate estimates are calculated. Also
|
||||
// used to cap total bitrate used. This comes from the remote connection.
|
||||
struct BitrateConfig {
|
||||
int min_bitrate_bps = 0;
|
||||
int start_bitrate_bps = kDefaultStartBitrateBps;
|
||||
int max_bitrate_bps = -1;
|
||||
} bitrate_config;
|
||||
|
||||
// The local client's bitrate preferences. The actual configuration used
|
||||
// is a combination of this and |bitrate_config|. The combination is
|
||||
// currently more complicated than a simple mask operation (see
|
||||
// SetBitrateConfig and SetBitrateConfigMask). Assumes that 0 <= min <=
|
||||
// start <= max holds for set parameters.
|
||||
struct BitrateConfigMask {
|
||||
rtc::Optional<int> min_bitrate_bps;
|
||||
rtc::Optional<int> start_bitrate_bps;
|
||||
rtc::Optional<int> max_bitrate_bps;
|
||||
};
|
||||
BitrateConstraints bitrate_config;
|
||||
|
||||
// AudioState which is possibly shared between multiple calls.
|
||||
// TODO(solenberg): Change this to a shared_ptr once we can use C++11.
|
||||
@ -184,15 +155,14 @@ class Call {
|
||||
// This is due to how the 'x-google-start-bitrate' flag is currently
|
||||
// implemented. Passing -1 leaves the start bitrate unchanged. Behavior is not
|
||||
// guaranteed for other negative values or 0.
|
||||
virtual void SetBitrateConfig(
|
||||
const Config::BitrateConfig& bitrate_config) = 0;
|
||||
virtual void SetBitrateConfig(const BitrateConstraints& bitrate_config) = 0;
|
||||
|
||||
// The greater min and smaller max set by this and SetBitrateConfig will be
|
||||
// used. The latest non-negative start value form either call will be used.
|
||||
// Specifying a start bitrate will reset the current bitrate estimate.
|
||||
// Assumes 0 <= min <= start <= max holds for set parameters.
|
||||
virtual void SetBitrateConfigMask(
|
||||
const Config::BitrateConfigMask& bitrate_mask) = 0;
|
||||
const BitrateConstraintsMask& bitrate_mask) = 0;
|
||||
|
||||
virtual void SetBitrateAllocationStrategy(
|
||||
std::unique_ptr<rtc::BitrateAllocationStrategy>
|
||||
|
||||
@ -888,7 +888,7 @@ void CallPerfTest::TestMinAudioVideoBitrate(
|
||||
|
||||
void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
|
||||
sender_call_ = sender_call;
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = min_bwe_;
|
||||
bitrate_config.start_bitrate_bps = start_bwe_;
|
||||
bitrate_config.max_bitrate_bps = max_bwe_;
|
||||
|
||||
@ -254,9 +254,9 @@ TEST(CallTest, MultipleFlexfecReceiveStreamsProtectingSingleVideoStream) {
|
||||
|
||||
namespace {
|
||||
struct CallBitrateHelper {
|
||||
CallBitrateHelper() : CallBitrateHelper(Call::Config::BitrateConfig()) {}
|
||||
CallBitrateHelper() : CallBitrateHelper(BitrateConstraints()) {}
|
||||
|
||||
explicit CallBitrateHelper(const Call::Config::BitrateConfig& bitrate_config)
|
||||
explicit CallBitrateHelper(const BitrateConstraints& bitrate_config)
|
||||
: mock_cc_(Clock::GetRealTimeClock(), &event_log_, &pacer_) {
|
||||
Call::Config config(&event_log_);
|
||||
config.bitrate_config = bitrate_config;
|
||||
@ -282,7 +282,7 @@ struct CallBitrateHelper {
|
||||
TEST(CallBitrateTest, SetBitrateConfigWithValidConfigCallsSetBweBitrates) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = 1;
|
||||
bitrate_config.start_bitrate_bps = 2;
|
||||
bitrate_config.max_bitrate_bps = 3;
|
||||
@ -294,7 +294,7 @@ TEST(CallBitrateTest, SetBitrateConfigWithValidConfigCallsSetBweBitrates) {
|
||||
TEST(CallBitrateTest, SetBitrateConfigWithDifferentMinCallsSetBweBitrates) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = 10;
|
||||
bitrate_config.start_bitrate_bps = 20;
|
||||
bitrate_config.max_bitrate_bps = 30;
|
||||
@ -308,7 +308,7 @@ TEST(CallBitrateTest, SetBitrateConfigWithDifferentMinCallsSetBweBitrates) {
|
||||
TEST(CallBitrateTest, SetBitrateConfigWithDifferentStartCallsSetBweBitrates) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = 10;
|
||||
bitrate_config.start_bitrate_bps = 20;
|
||||
bitrate_config.max_bitrate_bps = 30;
|
||||
@ -322,7 +322,7 @@ TEST(CallBitrateTest, SetBitrateConfigWithDifferentStartCallsSetBweBitrates) {
|
||||
TEST(CallBitrateTest, SetBitrateConfigWithDifferentMaxCallsSetBweBitrates) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = 10;
|
||||
bitrate_config.start_bitrate_bps = 20;
|
||||
bitrate_config.max_bitrate_bps = 30;
|
||||
@ -335,7 +335,7 @@ TEST(CallBitrateTest, SetBitrateConfigWithDifferentMaxCallsSetBweBitrates) {
|
||||
|
||||
TEST(CallBitrateTest, SetBitrateConfigWithSameConfigElidesSecondCall) {
|
||||
CallBitrateHelper call;
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = 1;
|
||||
bitrate_config.start_bitrate_bps = 2;
|
||||
bitrate_config.max_bitrate_bps = 3;
|
||||
@ -349,7 +349,7 @@ TEST(CallBitrateTest,
|
||||
SetBitrateConfigWithSameMinMaxAndNegativeStartElidesSecondCall) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = 1;
|
||||
bitrate_config.start_bitrate_bps = 2;
|
||||
bitrate_config.max_bitrate_bps = 3;
|
||||
@ -389,7 +389,7 @@ TEST(CallTest, RecreatingAudioStreamWithSameSsrcReusesRtpState) {
|
||||
|
||||
TEST(CallBitrateTest, BiggerMaskMinUsed) {
|
||||
CallBitrateHelper call;
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.min_bitrate_bps = 1234;
|
||||
|
||||
EXPECT_CALL(call.mock_cc(),
|
||||
@ -399,12 +399,12 @@ TEST(CallBitrateTest, BiggerMaskMinUsed) {
|
||||
|
||||
TEST(CallBitrateTest, BiggerConfigMinUsed) {
|
||||
CallBitrateHelper call;
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.min_bitrate_bps = 1000;
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(1000, testing::_, testing::_));
|
||||
call->SetBitrateConfigMask(mask);
|
||||
|
||||
Call::Config::BitrateConfig config;
|
||||
BitrateConstraints config;
|
||||
config.min_bitrate_bps = 1234;
|
||||
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(1234, testing::_, testing::_));
|
||||
@ -414,14 +414,14 @@ TEST(CallBitrateTest, BiggerConfigMinUsed) {
|
||||
// The last call to set start should be used.
|
||||
TEST(CallBitrateTest, LatestStartMaskPreferred) {
|
||||
CallBitrateHelper call;
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.start_bitrate_bps = 1300;
|
||||
|
||||
EXPECT_CALL(call.mock_cc(),
|
||||
SetBweBitrates(testing::_, *mask.start_bitrate_bps, testing::_));
|
||||
call->SetBitrateConfigMask(mask);
|
||||
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.start_bitrate_bps = 1200;
|
||||
|
||||
EXPECT_CALL(
|
||||
@ -431,11 +431,11 @@ TEST(CallBitrateTest, LatestStartMaskPreferred) {
|
||||
}
|
||||
|
||||
TEST(CallBitrateTest, SmallerMaskMaxUsed) {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.max_bitrate_bps = bitrate_config.start_bitrate_bps + 2000;
|
||||
CallBitrateHelper call(bitrate_config);
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.max_bitrate_bps = bitrate_config.start_bitrate_bps + 1000;
|
||||
|
||||
EXPECT_CALL(call.mock_cc(),
|
||||
@ -444,11 +444,11 @@ TEST(CallBitrateTest, SmallerMaskMaxUsed) {
|
||||
}
|
||||
|
||||
TEST(CallBitrateTest, SmallerConfigMaxUsed) {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.max_bitrate_bps = bitrate_config.start_bitrate_bps + 1000;
|
||||
CallBitrateHelper call(bitrate_config);
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.max_bitrate_bps = bitrate_config.start_bitrate_bps + 2000;
|
||||
|
||||
// Expect no calls because nothing changes
|
||||
@ -459,11 +459,11 @@ TEST(CallBitrateTest, SmallerConfigMaxUsed) {
|
||||
}
|
||||
|
||||
TEST(CallBitrateTest, MaskStartLessThanConfigMinClamped) {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = 2000;
|
||||
CallBitrateHelper call(bitrate_config);
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.start_bitrate_bps = 1000;
|
||||
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(2000, 2000, testing::_));
|
||||
@ -471,11 +471,11 @@ TEST(CallBitrateTest, MaskStartLessThanConfigMinClamped) {
|
||||
}
|
||||
|
||||
TEST(CallBitrateTest, MaskStartGreaterThanConfigMaxClamped) {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.start_bitrate_bps = 2000;
|
||||
CallBitrateHelper call(bitrate_config);
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.max_bitrate_bps = 1000;
|
||||
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(testing::_, -1, 1000));
|
||||
@ -483,11 +483,11 @@ TEST(CallBitrateTest, MaskStartGreaterThanConfigMaxClamped) {
|
||||
}
|
||||
|
||||
TEST(CallBitrateTest, MaskMinGreaterThanConfigMaxClamped) {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.min_bitrate_bps = 2000;
|
||||
CallBitrateHelper call(bitrate_config);
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.max_bitrate_bps = 1000;
|
||||
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(1000, testing::_, 1000));
|
||||
@ -497,7 +497,7 @@ TEST(CallBitrateTest, MaskMinGreaterThanConfigMaxClamped) {
|
||||
TEST(CallBitrateTest, SettingMaskStartForcesUpdate) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.start_bitrate_bps = 1000;
|
||||
|
||||
// SetBweBitrates should be called twice with the same params since
|
||||
@ -511,12 +511,12 @@ TEST(CallBitrateTest, SettingMaskStartForcesUpdate) {
|
||||
TEST(CallBitrateTest, SetBitrateConfigWithNoChangesDoesNotCallSetBweBitrates) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfig config1;
|
||||
BitrateConstraints config1;
|
||||
config1.min_bitrate_bps = 0;
|
||||
config1.start_bitrate_bps = 1000;
|
||||
config1.max_bitrate_bps = -1;
|
||||
|
||||
Call::Config::BitrateConfig config2;
|
||||
BitrateConstraints config2;
|
||||
config2.min_bitrate_bps = 0;
|
||||
config2.start_bitrate_bps = -1;
|
||||
config2.max_bitrate_bps = -1;
|
||||
@ -534,7 +534,7 @@ TEST(CallBitrateTest, SetBitrateConfigWithNoChangesDoesNotCallSetBweBitrates) {
|
||||
TEST(CallBitrateTest, SetBweBitratesNotCalledWhenEffectiveMaxUnchanged) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfig config;
|
||||
BitrateConstraints config;
|
||||
config.min_bitrate_bps = 0;
|
||||
config.start_bitrate_bps = -1;
|
||||
config.max_bitrate_bps = 2000;
|
||||
@ -542,7 +542,7 @@ TEST(CallBitrateTest, SetBweBitratesNotCalledWhenEffectiveMaxUnchanged) {
|
||||
call->SetBitrateConfig(config);
|
||||
|
||||
// Reduce effective max to 1000 with the mask.
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.max_bitrate_bps = 1000;
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(testing::_, testing::_, 1000));
|
||||
call->SetBitrateConfigMask(mask);
|
||||
@ -558,7 +558,7 @@ TEST(CallBitrateTest, SetBweBitratesNotCalledWhenEffectiveMaxUnchanged) {
|
||||
TEST(CallBitrateTest, SetBweBitratesNotCalledWhenStartMaskRemoved) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.start_bitrate_bps = 1000;
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(0, 1000, -1));
|
||||
call->SetBitrateConfigMask(mask);
|
||||
@ -573,12 +573,12 @@ TEST(CallBitrateTest, SetBweBitratesNotCalledWhenStartMaskRemoved) {
|
||||
TEST(CallBitrateTest, SetBitrateConfigAfterSetBitrateConfigMaskWithStart) {
|
||||
CallBitrateHelper call;
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.start_bitrate_bps = 1000;
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(0, 1000, -1));
|
||||
call->SetBitrateConfigMask(mask);
|
||||
|
||||
Call::Config::BitrateConfig config;
|
||||
BitrateConstraints config;
|
||||
config.min_bitrate_bps = 0;
|
||||
config.start_bitrate_bps = -1;
|
||||
config.max_bitrate_bps = 5000;
|
||||
@ -589,13 +589,13 @@ TEST(CallBitrateTest, SetBitrateConfigAfterSetBitrateConfigMaskWithStart) {
|
||||
}
|
||||
|
||||
TEST(CallBitrateTest, SetBweBitratesNotCalledWhenClampedMinUnchanged) {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.start_bitrate_bps = 500;
|
||||
bitrate_config.max_bitrate_bps = 1000;
|
||||
CallBitrateHelper call(bitrate_config);
|
||||
|
||||
// Set min to 2000; it is clamped to the max (1000).
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.min_bitrate_bps = 2000;
|
||||
EXPECT_CALL(call.mock_cc(), SetBweBitrates(1000, -1, 1000));
|
||||
call->SetBitrateConfigMask(mask);
|
||||
|
||||
@ -618,12 +618,12 @@ webrtc::Call::Stats FakeCall::GetStats() const {
|
||||
}
|
||||
|
||||
void FakeCall::SetBitrateConfig(
|
||||
const webrtc::Call::Config::BitrateConfig& bitrate_config) {
|
||||
const webrtc::BitrateConstraints& bitrate_config) {
|
||||
config_.bitrate_config = bitrate_config;
|
||||
}
|
||||
|
||||
void FakeCall::SetBitrateConfigMask(
|
||||
const webrtc::Call::Config::BitrateConfigMask& mask) {
|
||||
const webrtc::BitrateConstraintsMask& mask) {
|
||||
// TODO(zstein): not implemented
|
||||
}
|
||||
|
||||
|
||||
@ -302,9 +302,9 @@ class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver {
|
||||
webrtc::Call::Stats GetStats() const override;
|
||||
|
||||
void SetBitrateConfig(
|
||||
const webrtc::Call::Config::BitrateConfig& bitrate_config) override;
|
||||
const webrtc::BitrateConstraints& bitrate_config) override;
|
||||
void SetBitrateConfigMask(
|
||||
const webrtc::Call::Config::BitrateConfigMask& mask) override;
|
||||
const webrtc::BitrateConstraintsMask& mask) override;
|
||||
void SetBitrateAllocationStrategy(
|
||||
std::unique_ptr<rtc::BitrateAllocationStrategy>
|
||||
bitrate_allocation_strategy) override;
|
||||
|
||||
@ -202,9 +202,8 @@ std::vector<webrtc::RtpExtension> FilterRtpExtensions(
|
||||
return result;
|
||||
}
|
||||
|
||||
webrtc::Call::Config::BitrateConfig GetBitrateConfigForCodec(
|
||||
const Codec& codec) {
|
||||
webrtc::Call::Config::BitrateConfig config;
|
||||
webrtc::BitrateConstraints GetBitrateConfigForCodec(const Codec& codec) {
|
||||
webrtc::BitrateConstraints config;
|
||||
int bitrate_kbps = 0;
|
||||
if (codec.GetParam(kCodecParamMinBitrate, &bitrate_kbps) &&
|
||||
bitrate_kbps > 0) {
|
||||
|
||||
@ -85,8 +85,7 @@ std::vector<webrtc::RtpExtension> FilterRtpExtensions(
|
||||
bool (*supported)(const std::string&),
|
||||
bool filter_redundant_extensions);
|
||||
|
||||
webrtc::Call::Config::BitrateConfig GetBitrateConfigForCodec(
|
||||
const Codec& codec);
|
||||
webrtc::BitrateConstraints GetBitrateConfigForCodec(const Codec& codec);
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
|
||||
@ -771,7 +771,7 @@ bool WebRtcVideoChannel::SetSendParameters(const VideoSendParameters& params) {
|
||||
// codec target bitrate.
|
||||
// TODO(pbos): Figure out whether b=AS means max bitrate for this
|
||||
// WebRtcVideoChannel (in which case we're good), or per sender (SSRC),
|
||||
// in which case this should not set a Call::BitrateConfig but rather
|
||||
// in which case this should not set a BitrateConstraints but rather
|
||||
// reconfigure all senders.
|
||||
bitrate_config_.max_bitrate_bps =
|
||||
params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps;
|
||||
|
||||
@ -501,7 +501,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
||||
// See reason for keeping track of the FlexFEC payload type separately in
|
||||
// comment in WebRtcVideoChannel::ChangedRecvParameters.
|
||||
int recv_flexfec_payload_type_;
|
||||
webrtc::Call::Config::BitrateConfig bitrate_config_;
|
||||
webrtc::BitrateConstraints bitrate_config_;
|
||||
// TODO(deadbeef): Don't duplicate information between
|
||||
// send_params/recv_params, rtp_extensions, options, etc.
|
||||
VideoSendParameters send_params_;
|
||||
|
||||
@ -1591,7 +1591,7 @@ bool WebRtcVoiceMediaChannel::SetSendCodecs(
|
||||
|
||||
// Scan through the list to figure out the codec to use for sending.
|
||||
rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec> send_codec_spec;
|
||||
webrtc::Call::Config::BitrateConfig bitrate_config;
|
||||
webrtc::BitrateConstraints bitrate_config;
|
||||
rtc::Optional<webrtc::AudioCodecInfo> voice_codec_info;
|
||||
for (const AudioCodec& voice_codec : codecs) {
|
||||
if (!(IsCodec(voice_codec, kCnCodecName) ||
|
||||
|
||||
@ -2861,7 +2861,7 @@ RTCError PeerConnection::SetBitrate(const BitrateParameters& bitrate) {
|
||||
}
|
||||
}
|
||||
|
||||
Call::Config::BitrateConfigMask mask;
|
||||
BitrateConstraintsMask mask;
|
||||
mask.min_bitrate_bps = bitrate.min_bitrate_bps;
|
||||
mask.start_bitrate_bps = bitrate.current_bitrate_bps;
|
||||
mask.max_bitrate_bps = bitrate.max_bitrate_bps;
|
||||
|
||||
@ -3724,10 +3724,10 @@ TEST_P(PeerConnectionInterfaceTest,
|
||||
CreatePeerConnection(config, nullptr);
|
||||
}
|
||||
|
||||
// The current bitrate from Call's BitrateConfigMask is currently clamped by
|
||||
// Call's BitrateConfig, which comes from the SDP or a default value. This test
|
||||
// checks that a call to SetBitrate with a current bitrate that will be clamped
|
||||
// succeeds.
|
||||
// The current bitrate from Call's BitrateConstraintsMask is currently clamped
|
||||
// by Call's BitrateConstraints, which comes from the SDP or a default value.
|
||||
// This test checks that a call to SetBitrate with a current bitrate that will
|
||||
// be clamped succeeds.
|
||||
TEST_P(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanImplicitMin) {
|
||||
CreatePeerConnection();
|
||||
PeerConnectionInterface::BitrateParameters bitrate;
|
||||
|
||||
@ -137,7 +137,7 @@ TEST_P(ProbingEndToEndTest, TriggerMidCallProbing) {
|
||||
switch (state_) {
|
||||
case 0:
|
||||
if (stats.send_bandwidth_bps > 5 * 300000) {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.max_bitrate_bps = 100000;
|
||||
task_queue_->SendTask([this, &bitrate_config]() {
|
||||
sender_call_->SetBitrateConfig(bitrate_config);
|
||||
@ -147,7 +147,7 @@ TEST_P(ProbingEndToEndTest, TriggerMidCallProbing) {
|
||||
break;
|
||||
case 1:
|
||||
if (stats.send_bandwidth_bps < 110000) {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.max_bitrate_bps = 2500000;
|
||||
task_queue_->SendTask([this, &bitrate_config]() {
|
||||
sender_call_->SetBitrateConfig(bitrate_config);
|
||||
|
||||
@ -43,7 +43,7 @@ int MinBitrateKbps() {
|
||||
}
|
||||
|
||||
DEFINE_int(start_bitrate,
|
||||
Call::Config::kDefaultStartBitrateBps / 1000,
|
||||
BitrateConstraints::kDefaultStartBitrateBps / 1000,
|
||||
"Call start bitrate in kbps.");
|
||||
int StartBitrateKbps() {
|
||||
return static_cast<int>(FLAG_start_bitrate);
|
||||
@ -267,7 +267,7 @@ void Loopback() {
|
||||
pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs();
|
||||
pipe_config.allow_reordering = flags::FLAG_allow_reordering;
|
||||
|
||||
Call::Config::BitrateConfig call_bitrate_config;
|
||||
BitrateConstraints call_bitrate_config;
|
||||
call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000;
|
||||
call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000;
|
||||
call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000;
|
||||
|
||||
@ -454,7 +454,7 @@ void Loopback() {
|
||||
pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs();
|
||||
pipe_config.allow_reordering = flags::FLAG_allow_reordering;
|
||||
|
||||
Call::Config::BitrateConfig call_bitrate_config;
|
||||
BitrateConstraints call_bitrate_config;
|
||||
call_bitrate_config.min_bitrate_bps =
|
||||
(flags::ScreenshareMinBitrateKbps() + flags::VideoMinBitrateKbps()) *
|
||||
1000;
|
||||
|
||||
@ -264,7 +264,7 @@ void Loopback() {
|
||||
pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs();
|
||||
pipe_config.allow_reordering = flags::FLAG_allow_reordering;
|
||||
|
||||
Call::Config::BitrateConfig call_bitrate_config;
|
||||
BitrateConstraints call_bitrate_config;
|
||||
call_bitrate_config.min_bitrate_bps = flags::MinBitrateKbps() * 1000;
|
||||
call_bitrate_config.start_bitrate_bps = flags::StartBitrateKbps() * 1000;
|
||||
call_bitrate_config.max_bitrate_bps = flags::MaxBitrateKbps() * 1000;
|
||||
|
||||
@ -1093,7 +1093,7 @@ VideoQualityTest::VideoQualityTest(
|
||||
}
|
||||
|
||||
VideoQualityTest::Params::Params()
|
||||
: call({false, Call::Config::BitrateConfig(), 0}),
|
||||
: call({false, BitrateConstraints(), 0}),
|
||||
video{{false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false,
|
||||
false, ""},
|
||||
{false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false,
|
||||
|
||||
@ -33,7 +33,7 @@ class VideoQualityTest : public test::CallTest {
|
||||
~Params();
|
||||
struct CallConfig {
|
||||
bool send_side_bwe;
|
||||
Call::Config::BitrateConfig call_bitrate_config;
|
||||
BitrateConstraints call_bitrate_config;
|
||||
int num_thumbnails;
|
||||
// Indicates if secondary_(video|ss|screenshare) structures are used.
|
||||
bool dual_video;
|
||||
|
||||
@ -1590,7 +1590,7 @@ TEST_F(VideoSendStreamTest, ChangingNetworkRoute) {
|
||||
|
||||
void PerformTest() override {
|
||||
rtc::NetworkRoute new_route(true, 10, 20, -1);
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
|
||||
task_queue_->SendTask([this, &new_route, &bitrate_config]() {
|
||||
call_->OnNetworkRouteChanged("transport", new_route);
|
||||
@ -1955,7 +1955,7 @@ TEST_F(VideoSendStreamTest, CanReconfigureToUseStartBitrateAbovePreviousMax) {
|
||||
test::NullTransport transport;
|
||||
CreateSendConfig(1, 0, 0, &transport);
|
||||
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.start_bitrate_bps = 2 * video_encoder_config_.max_bitrate_bps;
|
||||
sender_call_->SetBitrateConfig(bitrate_config);
|
||||
|
||||
@ -2864,7 +2864,7 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
|
||||
init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeoutMs))
|
||||
<< "Timed out while waiting for encoder to be configured.";
|
||||
WaitForSetRates(kStartBitrateKbps);
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
bitrate_config.start_bitrate_bps = kIncreasedStartBitrateKbps * 1000;
|
||||
bitrate_config.max_bitrate_bps = kIncreasedMaxBitrateKbps * 1000;
|
||||
task_queue_->SendTask([this, &bitrate_config]() {
|
||||
@ -3560,7 +3560,7 @@ TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) {
|
||||
}
|
||||
|
||||
void PerformTest() override {
|
||||
Call::Config::BitrateConfig bitrate_config;
|
||||
BitrateConstraints bitrate_config;
|
||||
constexpr int kStartBitrateBps = 60000;
|
||||
constexpr int kMaxBitrateBps = 60000;
|
||||
constexpr int kMinBitrateBps = 10000;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user