| 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 <cstdio> | 5 #include <cstdio> |
| 6 #include <cstdlib> | 6 #include <cstdlib> |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 ByteCounter in_pipe_input_counter; | 63 ByteCounter in_pipe_input_counter; |
| 64 ByteCounter in_pipe_output_counter; | 64 ByteCounter in_pipe_output_counter; |
| 65 ByteCounter out_pipe_input_counter; | 65 ByteCounter out_pipe_input_counter; |
| 66 ByteCounter out_pipe_output_counter; | 66 ByteCounter out_pipe_output_counter; |
| 67 | 67 |
| 68 class ByteCounterPipe : public media::cast::test::PacketPipe { | 68 class ByteCounterPipe : public media::cast::test::PacketPipe { |
| 69 public: | 69 public: |
| 70 ByteCounterPipe(ByteCounter* counter) : counter_(counter) {} | 70 ByteCounterPipe(ByteCounter* counter) : counter_(counter) {} |
| 71 virtual void Send(scoped_ptr<media::cast::Packet> packet) | 71 virtual void Send(scoped_ptr<media::cast::Packet> packet) |
| 72 OVERRIDE { | 72 override { |
| 73 counter_->Increment(packet->size()); | 73 counter_->Increment(packet->size()); |
| 74 pipe_->Send(packet.Pass()); | 74 pipe_->Send(packet.Pass()); |
| 75 } | 75 } |
| 76 private: | 76 private: |
| 77 ByteCounter* counter_; | 77 ByteCounter* counter_; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 void SetupByteCounters(scoped_ptr<media::cast::test::PacketPipe>* pipe, | 80 void SetupByteCounters(scoped_ptr<media::cast::test::PacketPipe>* pipe, |
| 81 ByteCounter* pipe_input_counter, | 81 ByteCounter* pipe_input_counter, |
| 82 ByteCounter* pipe_output_counter) { | 82 ByteCounter* pipe_output_counter) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 remote_endpoint, | 175 remote_endpoint, |
| 176 in_pipe.Pass(), | 176 in_pipe.Pass(), |
| 177 out_pipe.Pass(), | 177 out_pipe.Pass(), |
| 178 NULL)); | 178 NULL)); |
| 179 base::MessageLoop message_loop; | 179 base::MessageLoop message_loop; |
| 180 last_printout = base::TimeTicks::Now(); | 180 last_printout = base::TimeTicks::Now(); |
| 181 CheckByteCounters(); | 181 CheckByteCounters(); |
| 182 message_loop.Run(); | 182 message_loop.Run(); |
| 183 return 1; | 183 return 1; |
| 184 } | 184 } |
| OLD | NEW |