diff options
Diffstat (limited to '')
5 files changed, 26 insertions, 22 deletions
diff --git a/third_party/libwebrtc/rtc_tools/BUILD.gn b/third_party/libwebrtc/rtc_tools/BUILD.gn index df3c55fec8..6637d143fe 100644 --- a/third_party/libwebrtc/rtc_tools/BUILD.gn +++ b/third_party/libwebrtc/rtc_tools/BUILD.gn @@ -258,6 +258,7 @@ if (!is_component_build) { "../api:rtp_parameters", "../api/environment", "../api/environment:environment_factory", + "../api/task_queue", "../api/test/video:function_video_factory", "../api/transport:field_trial_based_config", "../api/units:timestamp", diff --git a/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn b/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn index 5930431ab9..e44681441a 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn +++ b/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn @@ -43,6 +43,7 @@ if (rtc_enable_protobuf) { "../../api/task_queue", "../../api/task_queue:default_task_queue_factory", "../../api/task_queue:pending_task_safety_flag", + "../../api/units:timestamp", "../../p2p:rtc_p2p", "../../rtc_base:async_packet_socket", "../../rtc_base:checks", @@ -55,9 +56,9 @@ if (rtc_enable_protobuf) { "../../rtc_base:socket_server", "../../rtc_base:threading", "../../rtc_base:timeutils", + "../../rtc_base/network:received_packet", "../../rtc_base/synchronization:mutex", "../../rtc_base/system:no_unique_address", - "../../rtc_base/third_party/sigslot", ] absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable", diff --git a/third_party/libwebrtc/rtc_tools/network_tester/test_controller.cc b/third_party/libwebrtc/rtc_tools/network_tester/test_controller.cc index 3d9af380f1..f8641aacb6 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/test_controller.cc +++ b/third_party/libwebrtc/rtc_tools/network_tester/test_controller.cc @@ -13,10 +13,12 @@ #include <limits> #include "absl/types/optional.h" +#include "api/units/timestamp.h" #include "rtc_base/checks.h" #include "rtc_base/internal/default_socket_server.h" #include "rtc_base/ip_address.h" #include "rtc_base/logging.h" +#include "rtc_base/network/received_packet.h" #include "rtc_base/thread.h" namespace webrtc { @@ -44,7 +46,10 @@ TestController::TestController(int min_port, std::unique_ptr<rtc::AsyncPacketSocket>(socket_factory_.CreateUdpSocket( rtc::SocketAddress(rtc::GetAnyIP(AF_INET), 0), min_port, max_port)); RTC_CHECK(udp_socket_ != nullptr); - udp_socket_->SignalReadPacket.connect(this, &TestController::OnReadPacket); + udp_socket_->RegisterReceivedPacketCallback( + [&](rtc::AsyncPacketSocket* socket, const rtc::ReceivedPacket& packet) { + OnReadPacket(socket, packet); + }); }); } @@ -103,14 +108,13 @@ bool TestController::IsTestDone() { } void TestController::OnReadPacket(rtc::AsyncPacketSocket* socket, - const char* data, - size_t len, - const rtc::SocketAddress& remote_addr, - const int64_t& packet_time_us) { + const rtc::ReceivedPacket& received_packet) { RTC_DCHECK_RUN_ON(packet_sender_thread_.get()); RTC_LOG(LS_VERBOSE) << "OnReadPacket"; - size_t packet_size = data[0]; - std::string receive_data(&data[1], packet_size); + size_t packet_size = received_packet.payload()[0]; + std::string receive_data( + reinterpret_cast<const char*>(&received_packet.payload()[1]), + packet_size); NetworkTesterPacket packet; packet.ParseFromString(receive_data); RTC_CHECK(packet.has_type()); @@ -118,7 +122,7 @@ void TestController::OnReadPacket(rtc::AsyncPacketSocket* socket, case NetworkTesterPacket::HAND_SHAKING: { NetworkTesterPacket packet; packet.set_type(NetworkTesterPacket::TEST_START); - remote_address_ = remote_addr; + remote_address_ = received_packet.source_address(); SendData(packet, absl::nullopt); packet_sender_.reset(new PacketSender(this, packet_sender_thread_.get(), task_safety_flag_, @@ -140,8 +144,9 @@ void TestController::OnReadPacket(rtc::AsyncPacketSocket* socket, break; } case NetworkTesterPacket::TEST_DATA: { - packet.set_arrival_timestamp(packet_time_us); - packet.set_packet_size(len); + packet.set_arrival_timestamp( + received_packet.arrival_time().value_or(Timestamp::Zero()).us()); + packet.set_packet_size(received_packet.payload().size()); packet_logger_.LogPacket(packet); break; } diff --git a/third_party/libwebrtc/rtc_tools/network_tester/test_controller.h b/third_party/libwebrtc/rtc_tools/network_tester/test_controller.h index 3638c75af1..423eb08d0c 100644 --- a/third_party/libwebrtc/rtc_tools/network_tester/test_controller.h +++ b/third_party/libwebrtc/rtc_tools/network_tester/test_controller.h @@ -22,11 +22,11 @@ #include "api/sequence_checker.h" #include "p2p/base/basic_packet_socket_factory.h" #include "rtc_base/async_packet_socket.h" +#include "rtc_base/network/received_packet.h" #include "rtc_base/socket_address.h" #include "rtc_base/socket_server.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/system/no_unique_address.h" -#include "rtc_base/third_party/sigslot/sigslot.h" #include "rtc_base/thread.h" #include "rtc_base/thread_annotations.h" #include "rtc_tools/network_tester/packet_logger.h" @@ -43,13 +43,13 @@ namespace webrtc { constexpr size_t kEthernetMtu = 1500; -class TestController : public sigslot::has_slots<> { +class TestController { public: TestController(int min_port, int max_port, const std::string& config_file_path, const std::string& log_file_path); - ~TestController() override; + ~TestController(); TestController(const TestController&) = delete; TestController& operator=(const TestController&) = delete; @@ -65,10 +65,7 @@ class TestController : public sigslot::has_slots<> { private: void OnReadPacket(rtc::AsyncPacketSocket* socket, - const char* data, - size_t len, - const rtc::SocketAddress& remote_addr, - const int64_t& packet_time_us); + const rtc::ReceivedPacket& received_packet); RTC_NO_UNIQUE_ADDRESS SequenceChecker test_controller_thread_checker_; std::unique_ptr<rtc::SocketServer> socket_server_; std::unique_ptr<rtc::Thread> packet_sender_thread_; diff --git a/third_party/libwebrtc/rtc_tools/video_replay.cc b/third_party/libwebrtc/rtc_tools/video_replay.cc index 52c8d68048..243919ca94 100644 --- a/third_party/libwebrtc/rtc_tools/video_replay.cc +++ b/third_party/libwebrtc/rtc_tools/video_replay.cc @@ -20,6 +20,7 @@ #include "api/environment/environment_factory.h" #include "api/field_trials.h" #include "api/media_types.h" +#include "api/task_queue/task_queue_base.h" #include "api/test/video/function_video_decoder_factory.h" #include "api/transport/field_trial_based_config.h" #include "api/units/timestamp.h" @@ -486,9 +487,8 @@ class RtpReplayer final { time_sim_ ? time_sim_->GetTaskQueueFactory() : nullptr, time_sim_ ? time_sim_->GetClock() : nullptr)), rtp_reader_(CreateRtpReader(rtp_dump_path_)) { - worker_thread_ = std::make_unique<rtc::TaskQueue>( - env_.task_queue_factory().CreateTaskQueue( - "worker_thread", TaskQueueFactory::Priority::NORMAL)); + worker_thread_ = env_.task_queue_factory().CreateTaskQueue( + "worker_thread", TaskQueueFactory::Priority::NORMAL); rtc::Event event; worker_thread_->PostTask([&]() { call_ = Call::Create(CallConfig(env_)); @@ -663,7 +663,7 @@ class RtpReplayer final { const std::string rtp_dump_path_; std::unique_ptr<GlobalSimulatedTimeController> time_sim_; Environment env_; - std::unique_ptr<rtc::TaskQueue> worker_thread_; + std::unique_ptr<TaskQueueBase, TaskQueueDeleter> worker_thread_; std::unique_ptr<Call> call_; std::unique_ptr<test::RtpFileReader> rtp_reader_; std::unique_ptr<StreamState> stream_state_; |