OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ | 5 #ifndef MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ |
6 #define MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ | 6 #define MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // Randomly drops |drop_fraction|*100% of packets. | 133 // Randomly drops |drop_fraction|*100% of packets. |
134 scoped_ptr<PacketPipe> NewRandomDrop(double drop_fraction); | 134 scoped_ptr<PacketPipe> NewRandomDrop(double drop_fraction); |
135 | 135 |
136 // Delays each packet by |delay_seconds|. | 136 // Delays each packet by |delay_seconds|. |
137 scoped_ptr<PacketPipe> NewConstantDelay(double delay_seconds); | 137 scoped_ptr<PacketPipe> NewConstantDelay(double delay_seconds); |
138 | 138 |
139 // Delays packets by a random amount between zero and |delay|. | 139 // Delays packets by a random amount between zero and |delay|. |
140 // This PacketPipe can reorder packets. | 140 // This PacketPipe can reorder packets. |
141 scoped_ptr<PacketPipe> NewRandomUnsortedDelay(double delay); | 141 scoped_ptr<PacketPipe> NewRandomUnsortedDelay(double delay); |
142 | 142 |
| 143 // Duplicates every packet, one is transmitted immediately, |
| 144 // one is transmitted after a random delay between |delay_min| |
| 145 // and |delay_min + random_delay|. |
| 146 // This PacketPipe will reorder packets. |
| 147 scoped_ptr<PacketPipe> NewDuplicateAndDelay(double delay_min, |
| 148 double random_delay); |
| 149 |
143 // This PacketPipe inserts a random delay between each packet. | 150 // This PacketPipe inserts a random delay between each packet. |
144 // This PacketPipe cannot re-order packets. The delay between each | 151 // This PacketPipe cannot re-order packets. The delay between each |
145 // packet is asically |min_delay| + random( |random_delay| ) | 152 // packet is asically |min_delay| + random( |random_delay| ) |
146 // However, every now and then a delay of |big_delay| will be | 153 // However, every now and then a delay of |big_delay| will be |
147 // inserted (roughly every |seconds_between_big_delay| seconds). | 154 // inserted (roughly every |seconds_between_big_delay| seconds). |
148 scoped_ptr<PacketPipe> NewRandomSortedDelay(double random_delay, | 155 scoped_ptr<PacketPipe> NewRandomSortedDelay(double random_delay, |
149 double big_delay, | 156 double big_delay, |
150 double seconds_between_big_delay); | 157 double seconds_between_big_delay); |
151 | 158 |
152 // This PacketPipe emulates network outages. It basically waits | 159 // This PacketPipe emulates network outages. It basically waits |
(...skipping 18 matching lines...) Expand all Loading... |
171 // This method builds a stack of PacketPipes to emulate a crappy wifi network. | 178 // This method builds a stack of PacketPipes to emulate a crappy wifi network. |
172 // ~2mbit, 20% packet loss, ~40ms latency and packets can get reordered. | 179 // ~2mbit, 20% packet loss, ~40ms latency and packets can get reordered. |
173 // 300ms drouputs every ~2 seconds. | 180 // 300ms drouputs every ~2 seconds. |
174 scoped_ptr<PacketPipe> EvilNetwork(); | 181 scoped_ptr<PacketPipe> EvilNetwork(); |
175 | 182 |
176 } // namespace test | 183 } // namespace test |
177 } // namespace cast | 184 } // namespace cast |
178 } // namespace media | 185 } // namespace media |
179 | 186 |
180 #endif // MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ | 187 #endif // MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ |
OLD | NEW |