OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // length. | 29 // length. |
30 kBurst | 30 kBurst |
31 }; | 31 }; |
32 // Returns a string representation of the enum value. | 32 // Returns a string representation of the enum value. |
33 const char* PacketLossModeToStr(PacketLossMode e); | 33 const char* PacketLossModeToStr(PacketLossMode e); |
34 | 34 |
35 // Contains configurations related to networking and simulation of | 35 // Contains configurations related to networking and simulation of |
36 // scenarios caused by network interference. | 36 // scenarios caused by network interference. |
37 struct NetworkingConfig { | 37 struct NetworkingConfig { |
38 NetworkingConfig() | 38 NetworkingConfig() |
39 : packet_size_in_bytes(1500), max_payload_size_in_bytes(1440), | 39 : packet_size_in_bytes(1500), |
40 packet_loss_mode(kUniform), packet_loss_probability(0.0), | 40 max_payload_size_in_bytes(1440), |
41 packet_loss_burst_length(1) { | 41 packet_loss_mode(kUniform), |
42 } | 42 packet_loss_probability(0.0), |
| 43 packet_loss_burst_length(1) {} |
43 | 44 |
44 // Packet size in bytes. Default: 1500 bytes. | 45 // Packet size in bytes. Default: 1500 bytes. |
45 size_t packet_size_in_bytes; | 46 size_t packet_size_in_bytes; |
46 | 47 |
47 // Encoder specific setting of maximum size in bytes of each payload. | 48 // Encoder specific setting of maximum size in bytes of each payload. |
48 // Default: 1440 bytes. | 49 // Default: 1440 bytes. |
49 size_t max_payload_size_in_bytes; | 50 size_t max_payload_size_in_bytes; |
50 | 51 |
51 // Packet loss mode. Two different packet loss models are supported: | 52 // Packet loss mode. Two different packet loss models are supported: |
52 // uniform or burst. This setting has no effect unless | 53 // uniform or burst. This setting has no effect unless |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 }; | 87 }; |
87 | 88 |
88 class PacketManipulatorImpl : public PacketManipulator { | 89 class PacketManipulatorImpl : public PacketManipulator { |
89 public: | 90 public: |
90 PacketManipulatorImpl(PacketReader* packet_reader, | 91 PacketManipulatorImpl(PacketReader* packet_reader, |
91 const NetworkingConfig& config, | 92 const NetworkingConfig& config, |
92 bool verbose); | 93 bool verbose); |
93 virtual ~PacketManipulatorImpl(); | 94 virtual ~PacketManipulatorImpl(); |
94 int ManipulatePackets(webrtc::EncodedImage* encoded_image) override; | 95 int ManipulatePackets(webrtc::EncodedImage* encoded_image) override; |
95 virtual void InitializeRandomSeed(unsigned int seed); | 96 virtual void InitializeRandomSeed(unsigned int seed); |
| 97 |
96 protected: | 98 protected: |
97 // Returns a uniformly distributed random value between 0.0 and 1.0 | 99 // Returns a uniformly distributed random value between 0.0 and 1.0 |
98 virtual double RandomUniform(); | 100 virtual double RandomUniform(); |
| 101 |
99 private: | 102 private: |
100 PacketReader* packet_reader_; | 103 PacketReader* packet_reader_; |
101 const NetworkingConfig& config_; | 104 const NetworkingConfig& config_; |
102 // Used to simulate a burst over several frames. | 105 // Used to simulate a burst over several frames. |
103 int active_burst_packets_; | 106 int active_burst_packets_; |
104 CriticalSectionWrapper* critsect_; | 107 CriticalSectionWrapper* critsect_; |
105 unsigned int random_seed_; | 108 unsigned int random_seed_; |
106 bool verbose_; | 109 bool verbose_; |
107 }; | 110 }; |
108 | 111 |
109 } // namespace test | 112 } // namespace test |
110 } // namespace webrtc | 113 } // namespace webrtc |
111 | 114 |
112 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_PACKET_MANIPULATOR_H_ | 115 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_PACKET_MANIPULATOR_H_ |
OLD | NEW |