| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 BuildPipe(&pipe, new Buffer(4 << 10, 2)); // 4 kb buf, 2mbit/s | 622 BuildPipe(&pipe, new Buffer(4 << 10, 2)); // 4 kb buf, 2mbit/s |
| 623 BuildPipe(&pipe, new RandomDrop(0.1)); // 10% packet drop | 623 BuildPipe(&pipe, new RandomDrop(0.1)); // 10% packet drop |
| 624 BuildPipe(&pipe, new ConstantDelay(1E-3)); | 624 BuildPipe(&pipe, new ConstantDelay(1E-3)); |
| 625 BuildPipe(&pipe, new NetworkGlitchPipe(2.0, 0.3)); | 625 BuildPipe(&pipe, new NetworkGlitchPipe(2.0, 0.3)); |
| 626 BuildPipe(&pipe, new RandomUnsortedDelay(20E-3)); | 626 BuildPipe(&pipe, new RandomUnsortedDelay(20E-3)); |
| 627 // This represents the buffer on the receiving device. | 627 // This represents the buffer on the receiving device. |
| 628 BuildPipe(&pipe, new Buffer(4 << 10, 2)); // 4 kb buf, 2mbit/s | 628 BuildPipe(&pipe, new Buffer(4 << 10, 2)); // 4 kb buf, 2mbit/s |
| 629 return pipe.Pass(); | 629 return pipe.Pass(); |
| 630 } | 630 } |
| 631 | 631 |
| 632 scoped_ptr<InterruptedPoissonProcess> DefaultInterruptedPoissonProcess() { |
| 633 // The following values are taken from a session reported from a user. |
| 634 // They are experimentally tested to demonstrate challenging network |
| 635 // conditions. The average bitrate is about 2mbits/s. |
| 636 |
| 637 // Each element in this vector is the average number of packets sent |
| 638 // per millisecond. The average changes and rotates every second. |
| 639 std::vector<double> average_rates; |
| 640 average_rates.push_back(0.609); |
| 641 average_rates.push_back(0.495); |
| 642 average_rates.push_back(0.561); |
| 643 average_rates.push_back(0.458); |
| 644 average_rates.push_back(0.538); |
| 645 average_rates.push_back(0.513); |
| 646 average_rates.push_back(0.585); |
| 647 average_rates.push_back(0.592); |
| 648 average_rates.push_back(0.658); |
| 649 average_rates.push_back(0.556); |
| 650 average_rates.push_back(0.371); |
| 651 average_rates.push_back(0.595); |
| 652 average_rates.push_back(0.490); |
| 653 average_rates.push_back(0.980); |
| 654 average_rates.push_back(0.781); |
| 655 average_rates.push_back(0.463); |
| 656 |
| 657 const double burstiness = 0.609; |
| 658 const double variance = 4.1; |
| 659 |
| 660 scoped_ptr<InterruptedPoissonProcess> ipp( |
| 661 new InterruptedPoissonProcess( |
| 662 average_rates, burstiness, variance, 0)); |
| 663 return ipp.Pass(); |
| 664 } |
| 665 |
| 632 class UDPProxyImpl : public UDPProxy { | 666 class UDPProxyImpl : public UDPProxy { |
| 633 public: | 667 public: |
| 634 UDPProxyImpl(const net::IPEndPoint& local_port, | 668 UDPProxyImpl(const net::IPEndPoint& local_port, |
| 635 const net::IPEndPoint& destination, | 669 const net::IPEndPoint& destination, |
| 636 scoped_ptr<PacketPipe> to_dest_pipe, | 670 scoped_ptr<PacketPipe> to_dest_pipe, |
| 637 scoped_ptr<PacketPipe> from_dest_pipe, | 671 scoped_ptr<PacketPipe> from_dest_pipe, |
| 638 net::NetLog* net_log) | 672 net::NetLog* net_log) |
| 639 : local_port_(local_port), | 673 : local_port_(local_port), |
| 640 destination_(destination), | 674 destination_(destination), |
| 641 destination_is_mutable_(destination.address().empty()), | 675 destination_is_mutable_(destination.address().empty()), |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 destination, | 858 destination, |
| 825 to_dest_pipe.Pass(), | 859 to_dest_pipe.Pass(), |
| 826 from_dest_pipe.Pass(), | 860 from_dest_pipe.Pass(), |
| 827 net_log)); | 861 net_log)); |
| 828 return ret.Pass(); | 862 return ret.Pass(); |
| 829 } | 863 } |
| 830 | 864 |
| 831 } // namespace test | 865 } // namespace test |
| 832 } // namespace cast | 866 } // namespace cast |
| 833 } // namespace media | 867 } // namespace media |
| OLD | NEW |