| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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 |
| 11 #include "webrtc/tools/network_tester/test_controller.h" | 11 #include "webrtc/tools/network_tester/test_controller.h" |
| 12 | 12 |
| 13 namespace webrtc { | 13 namespace webrtc { |
| 14 | 14 |
| 15 TestController::TestController(int min_port, | 15 TestController::TestController(int min_port, |
| 16 int max_port, | 16 int max_port, |
| 17 const std::string& config_file_path) | 17 const std::string& config_file_path, |
| 18 const std::string& log_file_path) |
| 18 : config_file_path_(config_file_path), | 19 : config_file_path_(config_file_path), |
| 20 packet_logger_(log_file_path), |
| 19 local_test_done_(false), | 21 local_test_done_(false), |
| 20 remote_test_done_(false) { | 22 remote_test_done_(false) { |
| 21 RTC_DCHECK_RUN_ON(&test_controller_thread_checker_); | 23 RTC_DCHECK_RUN_ON(&test_controller_thread_checker_); |
| 22 send_data_.fill(42); | 24 send_data_.fill(42); |
| 23 packet_sender_checker_.Detach(); | 25 packet_sender_checker_.Detach(); |
| 24 auto socket = | 26 auto socket = |
| 25 std::unique_ptr<rtc::AsyncPacketSocket>(socket_factory_.CreateUdpSocket( | 27 std::unique_ptr<rtc::AsyncPacketSocket>(socket_factory_.CreateUdpSocket( |
| 26 rtc::SocketAddress(rtc::GetAnyIP(AF_INET), 0), min_port, max_port)); | 28 rtc::SocketAddress(rtc::GetAnyIP(AF_INET), 0), min_port, max_port)); |
| 27 socket->SignalReadPacket.connect(this, &TestController::OnReadPacket); | 29 socket->SignalReadPacket.connect(this, &TestController::OnReadPacket); |
| 28 udp_transport_.reset( | 30 udp_transport_.reset( |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 break; | 99 break; |
| 98 } | 100 } |
| 99 case NetworkTesterPacket::TEST_START: { | 101 case NetworkTesterPacket::TEST_START: { |
| 100 packet_sender_.reset(new PacketSender(this, config_file_path_)); | 102 packet_sender_.reset(new PacketSender(this, config_file_path_)); |
| 101 packet_sender_->StartSending(); | 103 packet_sender_->StartSending(); |
| 102 break; | 104 break; |
| 103 } | 105 } |
| 104 case NetworkTesterPacket::TEST_DATA: { | 106 case NetworkTesterPacket::TEST_DATA: { |
| 105 packet.set_arrival_timestamp(packet_time.timestamp); | 107 packet.set_arrival_timestamp(packet_time.timestamp); |
| 106 packet.set_packet_size(len); | 108 packet.set_packet_size(len); |
| 107 // log packet | 109 packet_logger_.LogPacket(packet); |
| 108 break; | 110 break; |
| 109 } | 111 } |
| 110 case NetworkTesterPacket::TEST_DONE: { | 112 case NetworkTesterPacket::TEST_DONE: { |
| 111 remote_test_done_ = true; | 113 remote_test_done_ = true; |
| 112 break; | 114 break; |
| 113 } | 115 } |
| 114 default: { RTC_NOTREACHED(); } | 116 default: { RTC_NOTREACHED(); } |
| 115 } | 117 } |
| 116 } | 118 } |
| 117 | 119 |
| 118 } // namespace webrtc | 120 } // namespace webrtc |
| OLD | NEW |