| 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 "media/cast/test/utility/udp_proxy.h" | 5 #include "media/cast/test/utility/udp_proxy.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 BuildPipe(&pipe, new RandomSortedDelay(1E-3, 20E-3, 3)); | 586 BuildPipe(&pipe, new RandomSortedDelay(1E-3, 20E-3, 3)); |
| 587 BuildPipe(&pipe, new Buffer(256 << 10, 20)); | 587 BuildPipe(&pipe, new Buffer(256 << 10, 20)); |
| 588 BuildPipe(&pipe, new ConstantDelay(1E-3)); | 588 BuildPipe(&pipe, new ConstantDelay(1E-3)); |
| 589 BuildPipe(&pipe, new RandomSortedDelay(1E-3, 20E-3, 3)); | 589 BuildPipe(&pipe, new RandomSortedDelay(1E-3, 20E-3, 3)); |
| 590 BuildPipe(&pipe, new RandomDrop(0.005)); | 590 BuildPipe(&pipe, new RandomDrop(0.005)); |
| 591 // This represents the buffer on the receiving device. | 591 // This represents the buffer on the receiving device. |
| 592 BuildPipe(&pipe, new Buffer(256 << 10, 20)); | 592 BuildPipe(&pipe, new Buffer(256 << 10, 20)); |
| 593 return pipe; | 593 return pipe; |
| 594 } | 594 } |
| 595 | 595 |
| 596 std::unique_ptr<PacketPipe> SlowNetwork() { |
| 597 // This represents the buffer on the sender. |
| 598 std::unique_ptr<PacketPipe> pipe; |
| 599 BuildPipe(&pipe, new Buffer(256 << 10, 1.5)); |
| 600 BuildPipe(&pipe, new RandomDrop(0.005)); |
| 601 // This represents the buffer on the router. |
| 602 BuildPipe(&pipe, new ConstantDelay(10E-3)); |
| 603 BuildPipe(&pipe, new RandomSortedDelay(10E-3, 20E-3, 3)); |
| 604 BuildPipe(&pipe, new Buffer(256 << 10, 20)); |
| 605 BuildPipe(&pipe, new ConstantDelay(10E-3)); |
| 606 BuildPipe(&pipe, new RandomSortedDelay(10E-3, 20E-3, 3)); |
| 607 BuildPipe(&pipe, new RandomDrop(0.005)); |
| 608 // This represents the buffer on the receiving device. |
| 609 BuildPipe(&pipe, new Buffer(256 << 10, 20)); |
| 610 return pipe; |
| 611 } |
| 612 |
| 596 std::unique_ptr<PacketPipe> BadNetwork() { | 613 std::unique_ptr<PacketPipe> BadNetwork() { |
| 597 std::unique_ptr<PacketPipe> pipe; | 614 std::unique_ptr<PacketPipe> pipe; |
| 598 // This represents the buffer on the sender. | 615 // This represents the buffer on the sender. |
| 599 BuildPipe(&pipe, new Buffer(64 << 10, 5)); // 64 kb buf, 5mbit/s | 616 BuildPipe(&pipe, new Buffer(64 << 10, 5)); // 64 kb buf, 5mbit/s |
| 600 BuildPipe(&pipe, new RandomDrop(0.05)); // 5% packet drop | 617 BuildPipe(&pipe, new RandomDrop(0.05)); // 5% packet drop |
| 601 BuildPipe(&pipe, new RandomSortedDelay(2E-3, 20E-3, 1)); | 618 BuildPipe(&pipe, new RandomSortedDelay(2E-3, 20E-3, 1)); |
| 602 // This represents the buffer on the router. | 619 // This represents the buffer on the router. |
| 603 BuildPipe(&pipe, new Buffer(64 << 10, 5)); // 64 kb buf, 4mbit/s | 620 BuildPipe(&pipe, new Buffer(64 << 10, 5)); // 64 kb buf, 4mbit/s |
| 604 BuildPipe(&pipe, new ConstantDelay(1E-3)); | 621 BuildPipe(&pipe, new ConstantDelay(1E-3)); |
| 605 // Random 40ms every other second | 622 // Random 40ms every other second |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 net::NetLog* net_log) { | 871 net::NetLog* net_log) { |
| 855 std::unique_ptr<UDPProxy> ret( | 872 std::unique_ptr<UDPProxy> ret( |
| 856 new UDPProxyImpl(local_port, destination, std::move(to_dest_pipe), | 873 new UDPProxyImpl(local_port, destination, std::move(to_dest_pipe), |
| 857 std::move(from_dest_pipe), net_log)); | 874 std::move(from_dest_pipe), net_log)); |
| 858 return ret; | 875 return ret; |
| 859 } | 876 } |
| 860 | 877 |
| 861 } // namespace test | 878 } // namespace test |
| 862 } // namespace cast | 879 } // namespace cast |
| 863 } // namespace media | 880 } // namespace media |
| OLD | NEW |