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 #ifndef WEBRTC_TOOLS_NETWORK_TESTER_PACKET_SENDER_H_ | 11 #ifndef WEBRTC_TOOLS_NETWORK_TESTER_PACKET_LOGGER_H_ |
12 #define WEBRTC_TOOLS_NETWORK_TESTER_PACKET_SENDER_H_ | 12 #define WEBRTC_TOOLS_NETWORK_TESTER_PACKET_LOGGER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <fstream> |
15 #include <string> | 15 #include <string> |
16 | 16 |
| 17 #include "webrtc/base/constructormagic.h" |
17 #include "webrtc/base/ignore_wundef.h" | 18 #include "webrtc/base/ignore_wundef.h" |
18 #include "webrtc/base/task_queue.h" | |
19 | 19 |
20 #ifdef WEBRTC_NETWORK_TESTER_PROTO | 20 #ifdef WEBRTC_NETWORK_TESTER_PROTO |
21 RTC_PUSH_IGNORING_WUNDEF() | 21 RTC_PUSH_IGNORING_WUNDEF() |
22 #include "webrtc/tools/network_tester/network_tester_packet.pb.h" | 22 #include "webrtc/tools/network_tester/network_tester_packet.pb.h" |
23 RTC_POP_IGNORING_WUNDEF() | 23 RTC_POP_IGNORING_WUNDEF() |
24 using webrtc::network_tester::packet::NetworkTesterPacket; | 24 using webrtc::network_tester::packet::NetworkTesterPacket; |
25 #else | 25 #else |
26 class NetworkTesterPacket; | 26 class NetworkTesterPacket; |
27 #endif // WEBRTC_NETWORK_TESTER_PROTO | 27 #endif // WEBRTC_NETWORK_TESTER_PROTO |
28 | 28 |
29 namespace webrtc { | 29 namespace webrtc { |
30 | 30 |
31 class TestController; | 31 class PacketLogger { |
| 32 public: |
| 33 explicit PacketLogger(const std::string& log_file_path); |
| 34 ~PacketLogger(); |
32 | 35 |
33 class PacketSender { | 36 void LogPacket(const NetworkTesterPacket& packet); |
34 public: | |
35 PacketSender(TestController* test_controller, | |
36 const std::string& config_file_path); | |
37 ~PacketSender(); | |
38 | |
39 void StartSending(); | |
40 void StopSending(); | |
41 bool IsSending(); | |
42 | |
43 void SendPacket(); | |
44 | |
45 int64_t GetSendIntervalMs(); | |
46 void UpdateTestSetting(size_t packet_size, int64_t send_interval_ms); | |
47 | 37 |
48 private: | 38 private: |
49 rtc::TaskQueue worker_queue_; | 39 std::ofstream packet_logger_stream_; |
50 size_t packet_size_; | 40 |
51 int64_t send_interval_ms_; | 41 RTC_DISALLOW_COPY_AND_ASSIGN(PacketLogger); |
52 int64_t sequence_number_; | |
53 bool sending_; | |
54 const std::string config_file_path_; | |
55 TestController* const test_controller_; | |
56 RTC_DISALLOW_COPY_AND_ASSIGN(PacketSender); | |
57 }; | 42 }; |
58 | 43 |
59 } // namespace webrtc | 44 } // namespace webrtc |
60 | 45 |
61 #endif // WEBRTC_TOOLS_NETWORK_TESTER_PACKET_SENDER_H_ | 46 #endif // WEBRTC_TOOLS_NETWORK_TESTER_PACKET_LOGGER_H_ |
OLD | NEW |