OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_TOOLS_NETWORK_TESTER_PACKET_SENDER_H_ | |
12 #define WEBRTC_TOOLS_NETWORK_TESTER_PACKET_SENDER_H_ | |
13 | |
14 #include <memory> | |
15 #include <string> | |
16 | |
17 #include "webrtc/base/constructormagic.h" | |
18 #include "webrtc/base/ignore_wundef.h" | |
19 #include "webrtc/base/sequenced_task_checker.h" | |
20 #include "webrtc/base/task_queue.h" | |
21 | |
22 #ifdef WEBRTC_NETWORK_TESTER_PROTO | |
23 RTC_PUSH_IGNORING_WUNDEF() | |
24 #include "webrtc/tools/network_tester/network_tester_packet.pb.h" | |
25 RTC_POP_IGNORING_WUNDEF() | |
26 using webrtc::network_tester::packet::NetworkTesterPacket; | |
27 #else | |
28 class NetworkTesterPacket; | |
29 #endif // WEBRTC_NETWORK_TESTER_PROTO | |
30 | |
31 namespace webrtc { | |
32 | |
33 class TestController; | |
34 | |
35 class PacketSender { | |
36 public: | |
37 PacketSender(TestController* test_controller, | |
38 const std::string& config_file_path); | |
39 ~PacketSender(); | |
40 | |
41 void StartSending(); | |
42 void StopSending(); | |
43 bool IsSending() const; | |
44 | |
45 void SendPacket(); | |
46 | |
47 int64_t GetSendIntervalMs() const; | |
48 void UpdateTestSetting(size_t packet_size, int64_t send_interval_ms); | |
49 | |
50 private: | |
51 rtc::SequencedTaskChecker worker_queue_checker_; | |
52 size_t packet_size_ ACCESS_ON(worker_queue_checker_); | |
53 int64_t send_interval_ms_ ACCESS_ON(worker_queue_checker_); | |
54 int64_t sequence_number_ ACCESS_ON(worker_queue_checker_); | |
55 bool sending_ ACCESS_ON(worker_queue_checker_); | |
56 const std::string config_file_path_; | |
57 TestController* const test_controller_; | |
58 rtc::TaskQueue worker_queue_; | |
59 | |
60 RTC_DISALLOW_COPY_AND_ASSIGN(PacketSender); | |
61 }; | |
62 | |
63 } // namespace webrtc | |
64 | |
65 #endif // WEBRTC_TOOLS_NETWORK_TESTER_PACKET_SENDER_H_ | |
OLD | NEW |