mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Eliminate methods SetConfig() from DirectTransport and FakeNetworkPipe
Bug: webrtc:9630 Change-Id: If67d7dc79436614beb17b97c0f69814093e4fbb8 Reviewed-on: https://webrtc-review.googlesource.com/95140 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Sebastian Jansson <srte@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24386}
This commit is contained in:
parent
3df1d5d2fb
commit
631cafafcc
9 changed files with 38 additions and 53 deletions
|
@ -854,24 +854,26 @@ void CallPerfTest::TestMinAudioVideoBitrate(
|
|||
test::PacketTransport* CreateSendTransport(
|
||||
test::SingleThreadedTaskQueueForTesting* task_queue,
|
||||
Call* sender_call) override {
|
||||
return send_transport_ = new test::PacketTransport(
|
||||
task_queue, sender_call, this, test::PacketTransport::kSender,
|
||||
test::CallTest::payload_type_map_,
|
||||
absl::make_unique<FakeNetworkPipe>(
|
||||
Clock::GetRealTimeClock(),
|
||||
absl::make_unique<SimulatedNetwork>(
|
||||
GetFakeNetworkPipeConfig())));
|
||||
auto network =
|
||||
absl::make_unique<SimulatedNetwork>(GetFakeNetworkPipeConfig());
|
||||
send_simulated_network_ = network.get();
|
||||
return new test::PacketTransport(
|
||||
task_queue, sender_call, this, test::PacketTransport::kSender,
|
||||
test::CallTest::payload_type_map_,
|
||||
absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
|
||||
std::move(network)));
|
||||
}
|
||||
|
||||
test::PacketTransport* CreateReceiveTransport(
|
||||
test::SingleThreadedTaskQueueForTesting* task_queue) override {
|
||||
return receive_transport_ = new test::PacketTransport(
|
||||
task_queue, nullptr, this, test::PacketTransport::kReceiver,
|
||||
test::CallTest::payload_type_map_,
|
||||
absl::make_unique<FakeNetworkPipe>(
|
||||
Clock::GetRealTimeClock(),
|
||||
absl::make_unique<SimulatedNetwork>(
|
||||
GetFakeNetworkPipeConfig())));
|
||||
auto network =
|
||||
absl::make_unique<SimulatedNetwork>(GetFakeNetworkPipeConfig());
|
||||
receive_simulated_network_ = network.get();
|
||||
return new test::PacketTransport(
|
||||
task_queue, nullptr, this, test::PacketTransport::kReceiver,
|
||||
test::CallTest::payload_type_map_,
|
||||
absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
|
||||
std::move(network)));
|
||||
}
|
||||
|
||||
void PerformTest() override {
|
||||
|
@ -883,8 +885,8 @@ void CallPerfTest::TestMinAudioVideoBitrate(
|
|||
test_bitrate += test_bitrate_step_) {
|
||||
DefaultNetworkSimulationConfig pipe_config;
|
||||
pipe_config.link_capacity_kbps = test_bitrate;
|
||||
send_transport_->SetConfig(pipe_config);
|
||||
receive_transport_->SetConfig(pipe_config);
|
||||
send_simulated_network_->SetConfig(pipe_config);
|
||||
receive_simulated_network_->SetConfig(pipe_config);
|
||||
|
||||
rtc::ThreadManager::Instance()->CurrentThread()->SleepMs(
|
||||
kBitrateStabilizationMs);
|
||||
|
@ -952,8 +954,8 @@ void CallPerfTest::TestMinAudioVideoBitrate(
|
|||
const int min_bwe_;
|
||||
const int start_bwe_;
|
||||
const int max_bwe_;
|
||||
test::PacketTransport* send_transport_;
|
||||
test::PacketTransport* receive_transport_;
|
||||
SimulatedNetwork* send_simulated_network_;
|
||||
SimulatedNetwork* receive_simulated_network_;
|
||||
Call* sender_call_;
|
||||
} test(use_bitrate_allocation_strategy, test_bitrate_from, test_bitrate_to,
|
||||
test_bitrate_step, min_bwe, start_bwe, max_bwe);
|
||||
|
|
|
@ -185,11 +185,6 @@ void FakeNetworkPipe::SetClockOffset(int64_t offset_ms) {
|
|||
clock_offset_ms_ = offset_ms;
|
||||
}
|
||||
|
||||
void FakeNetworkPipe::SetConfig(const FakeNetworkPipe::Config& config) {
|
||||
network_simulation_->SetConfig(config);
|
||||
}
|
||||
|
||||
|
||||
FakeNetworkPipe::StoredPacket::StoredPacket(NetworkPacket&& packet)
|
||||
: packet(std::move(packet)) {}
|
||||
|
||||
|
|
|
@ -138,11 +138,6 @@ class FakeNetworkPipe : public webrtc::SimulatedPacketReceiverInterface,
|
|||
|
||||
void SetClockOffset(int64_t offset_ms);
|
||||
|
||||
// Deprecated. DO NOT USE. Hold direct reference on NetworkSimulationInterface
|
||||
// instead and call SetConfig on that object directly. Will be removed soon.
|
||||
// Sets a new configuration. This won't affect packets already in the pipe.
|
||||
void SetConfig(const DefaultNetworkSimulationConfig& config) override;
|
||||
|
||||
// Must not be called in parallel with DeliverPacket or Process.
|
||||
void SetReceiver(PacketReceiver* receiver) override;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "call/rampup_tests.h"
|
||||
|
||||
#include "call/fake_network_pipe.h"
|
||||
#include "call/simulated_network.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/platform_thread.h"
|
||||
|
@ -60,6 +59,7 @@ RampUpTester::RampUpTester(size_t num_video_streams,
|
|||
sender_call_(nullptr),
|
||||
send_stream_(nullptr),
|
||||
send_transport_(nullptr),
|
||||
send_simulated_network_(nullptr),
|
||||
start_bitrate_bps_(start_bitrate_bps),
|
||||
min_run_time_ms_(min_run_time_ms),
|
||||
expected_bitrate_bps_(0),
|
||||
|
@ -95,12 +95,13 @@ void RampUpTester::OnVideoStreamsCreated(
|
|||
test::PacketTransport* RampUpTester::CreateSendTransport(
|
||||
test::SingleThreadedTaskQueueForTesting* task_queue,
|
||||
Call* sender_call) {
|
||||
auto network = absl::make_unique<SimulatedNetwork>(forward_transport_config_);
|
||||
send_simulated_network_ = network.get();
|
||||
send_transport_ = new test::PacketTransport(
|
||||
task_queue, sender_call, this, test::PacketTransport::kSender,
|
||||
test::CallTest::payload_type_map_,
|
||||
absl::make_unique<FakeNetworkPipe>(
|
||||
Clock::GetRealTimeClock(),
|
||||
absl::make_unique<SimulatedNetwork>(forward_transport_config_)));
|
||||
absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
|
||||
std::move(network)));
|
||||
return send_transport_;
|
||||
}
|
||||
|
||||
|
@ -551,7 +552,7 @@ void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
|
|||
state_start_ms_ = now;
|
||||
interval_start_ms_ = now;
|
||||
sent_bytes_ = 0;
|
||||
send_transport_->SetConfig(forward_transport_config_);
|
||||
send_simulated_network_->SetConfig(forward_transport_config_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -13,10 +13,12 @@
|
|||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/test/simulated_network.h"
|
||||
#include "call/call.h"
|
||||
#include "call/simulated_network.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "rtc_base/event.h"
|
||||
#include "test/call_test.h"
|
||||
|
@ -75,6 +77,7 @@ class RampUpTester : public test::EndToEndTest {
|
|||
Call* sender_call_;
|
||||
VideoSendStream* send_stream_;
|
||||
test::PacketTransport* send_transport_;
|
||||
SimulatedNetwork* send_simulated_network_;
|
||||
|
||||
private:
|
||||
typedef std::map<uint32_t, uint32_t> SsrcMap;
|
||||
|
|
|
@ -27,11 +27,6 @@ class SimulatedPacketReceiverInterface : public PacketReceiver, public Module {
|
|||
|
||||
// Reports average packet delay.
|
||||
virtual int AverageDelay() = 0;
|
||||
|
||||
// Deprecated. DO NOT USE. Temporary added to be able to introduce
|
||||
// SimulatedPacketReceiverInterface into DirectTransport instead of
|
||||
// FakeNetworkPipe, will be removed soon.
|
||||
virtual void SetConfig(const DefaultNetworkSimulationConfig& config) = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -78,10 +78,6 @@ DirectTransport::~DirectTransport() {
|
|||
task_queue_->CancelTask(next_scheduled_task_);
|
||||
}
|
||||
|
||||
void DirectTransport::SetConfig(const DefaultNetworkSimulationConfig& config) {
|
||||
fake_network_->SetConfig(config);
|
||||
}
|
||||
|
||||
void DirectTransport::StopSending() {
|
||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
|
||||
task_queue_->CancelTask(next_scheduled_task_);
|
||||
|
|
|
@ -66,8 +66,6 @@ class DirectTransport : public Transport {
|
|||
|
||||
~DirectTransport() override;
|
||||
|
||||
void SetConfig(const DefaultNetworkSimulationConfig& config);
|
||||
|
||||
RTC_DEPRECATED void StopSending();
|
||||
|
||||
// TODO(holmer): Look into moving this to the constructor.
|
||||
|
|
|
@ -221,14 +221,14 @@ TEST_P(ProbingEndToEndTest, ProbeOnVideoEncoderReconfiguration) {
|
|||
test::PacketTransport* CreateSendTransport(
|
||||
test::SingleThreadedTaskQueueForTesting* task_queue,
|
||||
Call* sender_call) override {
|
||||
send_transport_ = new test::PacketTransport(
|
||||
auto network =
|
||||
absl::make_unique<SimulatedNetwork>(DefaultNetworkSimulationConfig());
|
||||
send_simulated_network_ = network.get();
|
||||
return new test::PacketTransport(
|
||||
task_queue, sender_call, this, test::PacketTransport::kSender,
|
||||
CallTest::payload_type_map_,
|
||||
absl::make_unique<FakeNetworkPipe>(
|
||||
Clock::GetRealTimeClock(),
|
||||
absl::make_unique<SimulatedNetwork>(
|
||||
DefaultNetworkSimulationConfig())));
|
||||
return send_transport_;
|
||||
absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
|
||||
std::move(network)));
|
||||
}
|
||||
|
||||
void PerformTest() override {
|
||||
|
@ -248,7 +248,7 @@ TEST_P(ProbingEndToEndTest, ProbeOnVideoEncoderReconfiguration) {
|
|||
stats.send_bandwidth_bps <= 350000) {
|
||||
DefaultNetworkSimulationConfig config;
|
||||
config.link_capacity_kbps = 200;
|
||||
send_transport_->SetConfig(config);
|
||||
send_simulated_network_->SetConfig(config);
|
||||
|
||||
// In order to speed up the test we can interrupt exponential
|
||||
// probing by toggling the network availability. The alternative
|
||||
|
@ -263,7 +263,7 @@ TEST_P(ProbingEndToEndTest, ProbeOnVideoEncoderReconfiguration) {
|
|||
if (stats.send_bandwidth_bps <= 210000) {
|
||||
DefaultNetworkSimulationConfig config;
|
||||
config.link_capacity_kbps = 5000;
|
||||
send_transport_->SetConfig(config);
|
||||
send_simulated_network_->SetConfig(config);
|
||||
|
||||
encoder_config_->max_bitrate_bps = 2000000;
|
||||
encoder_config_->simulcast_layers[0].max_bitrate_bps = 1200000;
|
||||
|
@ -288,7 +288,7 @@ TEST_P(ProbingEndToEndTest, ProbeOnVideoEncoderReconfiguration) {
|
|||
const int kTimeoutMs = 3000;
|
||||
test::SingleThreadedTaskQueueForTesting* const task_queue_;
|
||||
bool* const success_;
|
||||
test::PacketTransport* send_transport_;
|
||||
SimulatedNetwork* send_simulated_network_;
|
||||
VideoSendStream* send_stream_;
|
||||
VideoEncoderConfig* encoder_config_;
|
||||
RtpTransportControllerSend* transport_controller_;
|
||||
|
|
Loading…
Reference in a new issue