| 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 #include <math.h> | 5 #include <math.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "media/cast/test/utility/udp_proxy.h" | 9 #include "media/cast/test/utility/udp_proxy.h" |
| 10 | 10 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 clock_ = clock; | 444 clock_ = clock; |
| 445 UpdateRates(); | 445 UpdateRates(); |
| 446 SwitchOn(); | 446 SwitchOn(); |
| 447 SendPacket(); | 447 SendPacket(); |
| 448 } | 448 } |
| 449 | 449 |
| 450 scoped_ptr<PacketPipe> InterruptedPoissonProcess::NewBuffer(size_t size) { | 450 scoped_ptr<PacketPipe> InterruptedPoissonProcess::NewBuffer(size_t size) { |
| 451 scoped_ptr<InternalBuffer> buffer( | 451 scoped_ptr<InternalBuffer> buffer( |
| 452 new InternalBuffer(weak_factory_.GetWeakPtr(), size)); | 452 new InternalBuffer(weak_factory_.GetWeakPtr(), size)); |
| 453 send_buffers_.push_back(buffer->GetWeakPtr()); | 453 send_buffers_.push_back(buffer->GetWeakPtr()); |
| 454 return buffer.PassAs<PacketPipe>(); | 454 return buffer.Pass(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 base::TimeDelta InterruptedPoissonProcess::NextEvent(double rate) { | 457 base::TimeDelta InterruptedPoissonProcess::NextEvent(double rate) { |
| 458 // Rate is per milliseconds. | 458 // Rate is per milliseconds. |
| 459 // The time until next event is exponentially distributed to the | 459 // The time until next event is exponentially distributed to the |
| 460 // inverse of |rate|. | 460 // inverse of |rate|. |
| 461 return base::TimeDelta::FromMillisecondsD( | 461 return base::TimeDelta::FromMillisecondsD( |
| 462 fabs(-log(1.0 - RandDouble()) / rate)); | 462 fabs(-log(1.0 - RandDouble()) / rate)); |
| 463 } | 463 } |
| 464 | 464 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 destination, | 830 destination, |
| 831 to_dest_pipe.Pass(), | 831 to_dest_pipe.Pass(), |
| 832 from_dest_pipe.Pass(), | 832 from_dest_pipe.Pass(), |
| 833 net_log)); | 833 net_log)); |
| 834 return ret.Pass(); | 834 return ret.Pass(); |
| 835 } | 835 } |
| 836 | 836 |
| 837 } // namespace test | 837 } // namespace test |
| 838 } // namespace cast | 838 } // namespace cast |
| 839 } // namespace media | 839 } // namespace media |
| OLD | NEW |