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