Remove temporary SetConfig method from NetworkSimulatioInterface.

Remove temporary SetConfig method from NetworkSimulatioInterface and
makes minor cleanup.

Bug: webrtc:9630
Change-Id: If472da7c21ffc9c83fe8b80e6665c3d5fb94382b
Reviewed-on: https://webrtc-review.googlesource.com/95644
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24400}
This commit is contained in:
Artem Titov 2018-08-23 10:54:54 +02:00 committed by Commit Bot
parent 398689f581
commit 4ff63cc9a1
3 changed files with 10 additions and 14 deletions

View File

@ -69,11 +69,6 @@ class NetworkSimulationInterface {
// should be removed when all users will be switched on direct usage.
using SimulatedNetworkConfig = DefaultNetworkSimulationConfig;
// DO NOT USE. Method added temporary for further refactoring and will be
// removed soon.
// Sets a new configuration. This won't affect packets already in the pipe.
virtual void SetConfig(const SimulatedNetworkConfig& config) = 0;
virtual bool EnqueuePacket(PacketInFlightInfo packet_info) = 0;
// Retrieves all packets that should be delivered by the given receive time.
virtual std::vector<PacketDeliveryInfo> DequeueDeliverablePackets(

View File

@ -30,7 +30,7 @@ bool ParseConfigParam(std::string exp_name, int* field) {
return (sscanf(group.c_str(), "%d", field) == 1);
}
absl::optional<webrtc::FakeNetworkPipe::Config> ParseDegradationConfig(
absl::optional<webrtc::DefaultNetworkSimulationConfig> ParseDegradationConfig(
bool send) {
std::string exp_prefix = "WebRTCFakeNetwork";
if (send) {
@ -39,7 +39,7 @@ absl::optional<webrtc::FakeNetworkPipe::Config> ParseDegradationConfig(
exp_prefix += "Receive";
}
webrtc::FakeNetworkPipe::Config config;
webrtc::DefaultNetworkSimulationConfig config;
bool configured = false;
configured |=
ParseConfigParam(exp_prefix + "DelayMs", &config.queue_delay_ms);
@ -62,16 +62,17 @@ absl::optional<webrtc::FakeNetworkPipe::Config> ParseDegradationConfig(
}
configured |= ParseConfigParam(exp_prefix + "AvgBurstLossLength",
&config.avg_burst_loss_length);
return configured ? absl::optional<webrtc::FakeNetworkPipe::Config>(config)
: absl::nullopt;
return configured
? absl::optional<webrtc::DefaultNetworkSimulationConfig>(config)
: absl::nullopt;
}
} // namespace
Call* CallFactory::CreateCall(const Call::Config& config) {
absl::optional<webrtc::FakeNetworkPipe::Config> send_degradation_config =
ParseDegradationConfig(true);
absl::optional<webrtc::FakeNetworkPipe::Config> receive_degradation_config =
ParseDegradationConfig(false);
absl::optional<webrtc::DefaultNetworkSimulationConfig>
send_degradation_config = ParseDegradationConfig(true);
absl::optional<webrtc::DefaultNetworkSimulationConfig>
receive_degradation_config = ParseDegradationConfig(false);
if (send_degradation_config || receive_degradation_config) {
return new DegradedCall(std::unique_ptr<Call>(Call::Create(config)),

View File

@ -33,7 +33,7 @@ class SimulatedNetwork : public NetworkSimulationInterface {
~SimulatedNetwork() override;
// Sets a new configuration. This won't affect packets already in the pipe.
void SetConfig(const Config& config) override;
void SetConfig(const Config& config);
void PauseTransmissionUntil(int64_t until_us);
// NetworkSimulationInterface