Replace DataSize and DataRate factories with newer versions
This is search and replace change: find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataSize::Bytes<\(.*\)>()/DataSize::Bytes(\1)/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataSize::bytes/DataSize::Bytes/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::BitsPerSec<\(.*\)>()/DataRate::BitsPerSec(\1)/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::BytesPerSec<\(.*\)>()/DataRate::BytesPerSec(\1)/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::KilobitsPerSec<\(.*\)>()/DataRate::KilobitsPerSec(\1)/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::bps/DataRate::BitsPerSec/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::kbps/DataRate::KilobitsPerSec/g" git cl format Bug: webrtc:9709 Change-Id: I65aaca69474ba038c1fe2dd8dc30d3f8e7b94c29 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168647 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30545}
This commit is contained in:
committed by
Commit Bot
parent
701bd172d8
commit
cad3e0e2fa
@ -104,7 +104,7 @@ class CallClient : public EmulatedNetworkReceiverInterface {
|
||||
ColumnPrinter StatsPrinter();
|
||||
Call::Stats GetStats();
|
||||
DataRate send_bandwidth() {
|
||||
return DataRate::bps(GetStats().send_bandwidth_bps);
|
||||
return DataRate::BitsPerSec(GetStats().send_bandwidth_bps);
|
||||
}
|
||||
DataRate target_rate() const;
|
||||
DataRate stable_target_rate() const;
|
||||
|
||||
@ -131,8 +131,8 @@ CallClientPair* Scenario::CreateRoutes(
|
||||
CallClient* second,
|
||||
std::vector<EmulatedNetworkNode*> return_link) {
|
||||
return CreateRoutes(first, send_link,
|
||||
DataSize::bytes(PacketOverhead::kDefault), second,
|
||||
return_link, DataSize::bytes(PacketOverhead::kDefault));
|
||||
DataSize::Bytes(PacketOverhead::kDefault), second,
|
||||
return_link, DataSize::Bytes(PacketOverhead::kDefault));
|
||||
}
|
||||
|
||||
CallClientPair* Scenario::CreateRoutes(
|
||||
@ -151,7 +151,7 @@ CallClientPair* Scenario::CreateRoutes(
|
||||
|
||||
void Scenario::ChangeRoute(std::pair<CallClient*, CallClient*> clients,
|
||||
std::vector<EmulatedNetworkNode*> over_nodes) {
|
||||
ChangeRoute(clients, over_nodes, DataSize::bytes(PacketOverhead::kDefault));
|
||||
ChangeRoute(clients, over_nodes, DataSize::Bytes(PacketOverhead::kDefault));
|
||||
}
|
||||
|
||||
void Scenario::ChangeRoute(std::pair<CallClient*, CallClient*> clients,
|
||||
|
||||
@ -42,9 +42,9 @@ struct TransportControllerConfig {
|
||||
Rates();
|
||||
Rates(const Rates&);
|
||||
~Rates();
|
||||
DataRate min_rate = DataRate::kbps(30);
|
||||
DataRate max_rate = DataRate::kbps(3000);
|
||||
DataRate start_rate = DataRate::kbps(300);
|
||||
DataRate min_rate = DataRate::KilobitsPerSec(30);
|
||||
DataRate max_rate = DataRate::KilobitsPerSec(3000);
|
||||
DataRate start_rate = DataRate::KilobitsPerSec(300);
|
||||
} rates;
|
||||
NetworkControllerFactoryInterface* cc_factory = nullptr;
|
||||
TimeDelta state_log_interval = TimeDelta::Millis(100);
|
||||
@ -61,10 +61,10 @@ struct PacketStreamConfig {
|
||||
~PacketStreamConfig();
|
||||
int frame_rate = 30;
|
||||
DataRate max_data_rate = DataRate::Infinity();
|
||||
DataSize max_packet_size = DataSize::bytes(1400);
|
||||
DataSize min_frame_size = DataSize::bytes(100);
|
||||
DataSize max_packet_size = DataSize::Bytes(1400);
|
||||
DataSize min_frame_size = DataSize::Bytes(100);
|
||||
double keyframe_multiplier = 1;
|
||||
DataSize packet_overhead = DataSize::bytes(PacketOverhead::kDefault);
|
||||
DataSize packet_overhead = DataSize::Bytes(PacketOverhead::kDefault);
|
||||
};
|
||||
|
||||
struct VideoStreamConfig {
|
||||
|
||||
@ -40,7 +40,7 @@ struct CallTestConfig {
|
||||
Scenario()
|
||||
: random_seed("rs", 1),
|
||||
return_traffic("ret"),
|
||||
capacity("bw", DataRate::kbps(300)),
|
||||
capacity("bw", DataRate::KilobitsPerSec(300)),
|
||||
propagation_delay("dl", TimeDelta::Millis(100)),
|
||||
cross_traffic("ct", DataRate::Zero()),
|
||||
delay_noise("dn", TimeDelta::Zero()),
|
||||
@ -60,7 +60,7 @@ struct CallTestConfig {
|
||||
Tuning()
|
||||
: use_bbr("bbr"),
|
||||
bbr_no_target_rate("notr"),
|
||||
bbr_initial_window("iw", DataSize::bytes(8000)),
|
||||
bbr_initial_window("iw", DataSize::Bytes(8000)),
|
||||
bbr_encoder_gain("eg", 0.8) {}
|
||||
void Parse(std::string config_str) {
|
||||
ParseFieldTrial(
|
||||
@ -151,8 +151,8 @@ TEST_P(BbrScenarioTest, ReceivesVideo) {
|
||||
if (conf_.tuning.use_bbr) {
|
||||
call_config.transport.cc_factory = &bbr_factory;
|
||||
}
|
||||
call_config.transport.rates.min_rate = DataRate::kbps(30);
|
||||
call_config.transport.rates.max_rate = DataRate::kbps(1800);
|
||||
call_config.transport.rates.min_rate = DataRate::KilobitsPerSec(30);
|
||||
call_config.transport.rates.max_rate = DataRate::KilobitsPerSec(1800);
|
||||
|
||||
CallClient* alice = s.CreateClient("send", call_config);
|
||||
CallClient* bob = s.CreateClient("return", call_config);
|
||||
@ -168,12 +168,12 @@ TEST_P(BbrScenarioTest, ReceivesVideo) {
|
||||
|
||||
VideoStreamPair* alice_video =
|
||||
s.CreateVideoStream(route->forward(), [&](VideoStreamConfig* c) {
|
||||
c->encoder.fake.max_rate = DataRate::kbps(1800);
|
||||
c->encoder.fake.max_rate = DataRate::KilobitsPerSec(1800);
|
||||
});
|
||||
s.CreateAudioStream(route->forward(), [&](AudioStreamConfig* c) {
|
||||
if (conf_.tuning.use_bbr) {
|
||||
c->stream.in_bandwidth_estimation = true;
|
||||
c->encoder.fixed_rate = DataRate::kbps(31);
|
||||
c->encoder.fixed_rate = DataRate::KilobitsPerSec(31);
|
||||
}
|
||||
});
|
||||
|
||||
@ -181,12 +181,12 @@ TEST_P(BbrScenarioTest, ReceivesVideo) {
|
||||
if (conf_.scenario.return_traffic) {
|
||||
bob_video =
|
||||
s.CreateVideoStream(route->reverse(), [&](VideoStreamConfig* c) {
|
||||
c->encoder.fake.max_rate = DataRate::kbps(1800);
|
||||
c->encoder.fake.max_rate = DataRate::KilobitsPerSec(1800);
|
||||
});
|
||||
s.CreateAudioStream(route->reverse(), [&](AudioStreamConfig* c) {
|
||||
if (conf_.tuning.use_bbr) {
|
||||
c->stream.in_bandwidth_estimation = true;
|
||||
c->encoder.fixed_rate = DataRate::kbps(31);
|
||||
c->encoder.fixed_rate = DataRate::KilobitsPerSec(31);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ TEST(ScenarioTest, StartsAndStopsWithoutErrors) {
|
||||
std::atomic<bool> bitrate_changed(false);
|
||||
Scenario s;
|
||||
CallClientConfig call_client_config;
|
||||
call_client_config.transport.rates.start_rate = DataRate::kbps(300);
|
||||
call_client_config.transport.rates.start_rate = DataRate::KilobitsPerSec(300);
|
||||
auto* alice = s.CreateClient("alice", call_client_config);
|
||||
auto* bob = s.CreateClient("bob", call_client_config);
|
||||
NetworkSimulationConfig network_config;
|
||||
@ -35,8 +35,8 @@ TEST(ScenarioTest, StartsAndStopsWithoutErrors) {
|
||||
s.CreateVideoStream(route->reverse(), video_stream_config);
|
||||
|
||||
AudioStreamConfig audio_stream_config;
|
||||
audio_stream_config.encoder.min_rate = DataRate::kbps(6);
|
||||
audio_stream_config.encoder.max_rate = DataRate::kbps(64);
|
||||
audio_stream_config.encoder.min_rate = DataRate::KilobitsPerSec(6);
|
||||
audio_stream_config.encoder.max_rate = DataRate::KilobitsPerSec(64);
|
||||
audio_stream_config.encoder.allocate_bitrate = true;
|
||||
audio_stream_config.stream.in_bandwidth_estimation = false;
|
||||
s.CreateAudioStream(route->forward(), audio_stream_config);
|
||||
@ -66,7 +66,7 @@ void SetupVideoCall(Scenario& s, VideoQualityAnalyzer* analyzer) {
|
||||
auto* alice = s.CreateClient("alice", call_config);
|
||||
auto* bob = s.CreateClient("bob", call_config);
|
||||
NetworkSimulationConfig network_config;
|
||||
network_config.bandwidth = DataRate::kbps(1000);
|
||||
network_config.bandwidth = DataRate::KilobitsPerSec(1000);
|
||||
network_config.delay = TimeDelta::Millis(50);
|
||||
auto alice_net = s.CreateSimulationNode(network_config);
|
||||
auto bob_net = s.CreateSimulationNode(network_config);
|
||||
|
||||
@ -167,7 +167,7 @@ void VideoSendStatsCollector::AddStats(VideoSendStream::Stats sample,
|
||||
kv.second.rtp_stats.fec.padding_bytes;
|
||||
}
|
||||
if (last_update_.IsFinite()) {
|
||||
auto fec_delta = DataSize::bytes(fec_bytes - last_fec_bytes_);
|
||||
auto fec_delta = DataSize::Bytes(fec_bytes - last_fec_bytes_);
|
||||
auto time_delta = at_time - last_update_;
|
||||
stats_.fec_bitrate.AddSample(fec_delta / time_delta);
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ TEST(ScenarioAnalyzerTest, PsnrIsHighWhenNetworkIsGood) {
|
||||
{
|
||||
Scenario s;
|
||||
NetworkSimulationConfig good_network;
|
||||
good_network.bandwidth = DataRate::kbps(1000);
|
||||
good_network.bandwidth = DataRate::KilobitsPerSec(1000);
|
||||
CreateAnalyzedStream(&s, good_network, &analyzer, &stats);
|
||||
s.RunFor(TimeDelta::Seconds(3));
|
||||
}
|
||||
@ -67,7 +67,7 @@ TEST(ScenarioAnalyzerTest, PsnrIsLowWhenNetworkIsBad) {
|
||||
{
|
||||
Scenario s;
|
||||
NetworkSimulationConfig bad_network;
|
||||
bad_network.bandwidth = DataRate::kbps(100);
|
||||
bad_network.bandwidth = DataRate::KilobitsPerSec(100);
|
||||
bad_network.loss_rate = 0.02;
|
||||
CreateAnalyzedStream(&s, bad_network, &analyzer, &stats);
|
||||
s.RunFor(TimeDelta::Seconds(3));
|
||||
|
||||
@ -256,7 +256,8 @@ VideoEncoderConfig CreateVideoEncoderConfig(VideoStreamConfig config) {
|
||||
|
||||
// TODO(srte): Base this on encoder capabilities.
|
||||
encoder_config.max_bitrate_bps =
|
||||
config.encoder.max_data_rate.value_or(DataRate::kbps(10000)).bps();
|
||||
config.encoder.max_data_rate.value_or(DataRate::KilobitsPerSec(10000))
|
||||
.bps();
|
||||
|
||||
encoder_config.encoder_specific_settings =
|
||||
CreateEncoderSpecificSettings(config);
|
||||
|
||||
Reference in New Issue
Block a user