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" | |
11 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
15 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
16 #include "media/cast/net/cast_transport_config.h" | 15 #include "media/cast/net/cast_transport_config.h" |
17 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
18 #include "third_party/mt19937ar/mt19937ar.h" | 17 #include "third_party/mt19937ar/mt19937ar.h" |
19 | 18 |
20 namespace net { | 19 namespace net { |
(...skipping 26 matching lines...) Expand all Loading... |
47 }; | 46 }; |
48 | 47 |
49 // Implements a Interrupted Poisson Process for packet delivery. | 48 // Implements a Interrupted Poisson Process for packet delivery. |
50 // The process has 2 states: ON and OFF, the rate of switching between | 49 // The process has 2 states: ON and OFF, the rate of switching between |
51 // these two states are defined. | 50 // these two states are defined. |
52 // When in ON state packets are sent according to a defined rate. | 51 // When in ON state packets are sent according to a defined rate. |
53 // When in OFF state packets are not sent. | 52 // When in OFF state packets are not sent. |
54 // The rate above is the average rate of a poisson distribution. | 53 // The rate above is the average rate of a poisson distribution. |
55 class InterruptedPoissonProcess { | 54 class InterruptedPoissonProcess { |
56 public: | 55 public: |
57 InterruptedPoissonProcess( | 56 InterruptedPoissonProcess(const std::vector<double>& average_rates, |
58 const std::vector<double>& average_rates, | 57 double coef_burstiness, |
59 double coef_burstiness, | 58 double coef_variance, |
60 double coef_variance, | 59 uint32_t rand_seed); |
61 uint32 rand_seed); | |
62 ~InterruptedPoissonProcess(); | 60 ~InterruptedPoissonProcess(); |
63 | 61 |
64 scoped_ptr<PacketPipe> NewBuffer(size_t size); | 62 scoped_ptr<PacketPipe> NewBuffer(size_t size); |
65 | 63 |
66 private: | 64 private: |
67 class InternalBuffer; | 65 class InternalBuffer; |
68 | 66 |
69 // |task_runner| is the executor of the IO thread. | 67 // |task_runner| is the executor of the IO thread. |
70 // |clock| is the system clock. | 68 // |clock| is the system clock. |
71 void InitOnIOThread( | 69 void InitOnIOThread( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // Builds an Interrupted Poisson Process network simulator with default | 181 // Builds an Interrupted Poisson Process network simulator with default |
184 // settings. It simulates a challenging interference-heavy WiFi environment | 182 // settings. It simulates a challenging interference-heavy WiFi environment |
185 // of roughly 2mbits/s. | 183 // of roughly 2mbits/s. |
186 scoped_ptr<InterruptedPoissonProcess> DefaultInterruptedPoissonProcess(); | 184 scoped_ptr<InterruptedPoissonProcess> DefaultInterruptedPoissonProcess(); |
187 | 185 |
188 } // namespace test | 186 } // namespace test |
189 } // namespace cast | 187 } // namespace cast |
190 } // namespace media | 188 } // namespace media |
191 | 189 |
192 #endif // MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ | 190 #endif // MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ |
OLD | NEW |