Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: media/cast/test/utility/udp_proxy_main.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 double megabits_per_second() { 41 double megabits_per_second() {
42 double megabits = (byte_data_.back() - byte_data_.front()) * 8 / 1E6; 42 double megabits = (byte_data_.back() - byte_data_.front()) * 8 / 1E6;
43 return megabits / time_range().InSecondsF(); 43 return megabits / time_range().InSecondsF();
44 } 44 }
45 45
46 double packets_per_second() { 46 double packets_per_second() {
47 double packets = packet_data_.back()- packet_data_.front(); 47 double packets = packet_data_.back()- packet_data_.front();
48 return packets / time_range().InSecondsF(); 48 return packets / time_range().InSecondsF();
49 } 49 }
50 50
51 void Increment(uint64 x) { 51 void Increment(uint64_t x) {
52 bytes_ += x; 52 bytes_ += x;
53 packets_ ++; 53 packets_ ++;
54 } 54 }
55 55
56 private: 56 private:
57 uint64 bytes_; 57 uint64_t bytes_;
58 uint64 packets_; 58 uint64_t packets_;
59 std::deque<uint64> byte_data_; 59 std::deque<uint64_t> byte_data_;
60 std::deque<uint64> packet_data_; 60 std::deque<uint64_t> packet_data_;
61 std::deque<base::TimeTicks> time_data_; 61 std::deque<base::TimeTicks> time_data_;
62 }; 62 };
63 63
64 namespace { 64 namespace {
65 struct GlobalCounter { 65 struct GlobalCounter {
66 base::TimeTicks last_printout; 66 base::TimeTicks last_printout;
67 ByteCounter in_pipe_input_counter; 67 ByteCounter in_pipe_input_counter;
68 ByteCounter in_pipe_output_counter; 68 ByteCounter in_pipe_output_counter;
69 ByteCounter out_pipe_input_counter; 69 ByteCounter out_pipe_input_counter;
70 ByteCounter out_pipe_output_counter; 70 ByteCounter out_pipe_output_counter;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } else { 154 } else {
155 // V1 proxy 155 // V1 proxy
156 network_type = argv[2]; 156 network_type = argv[2];
157 } 157 }
158 if (local_port < 0 || local_port > 65535 || remote_port < 0 || 158 if (local_port < 0 || local_port > 65535 || remote_port < 0 ||
159 remote_port > 65535) { 159 remote_port > 65535) {
160 fprintf(stderr, "Port numbers must be between 0 and 65535\n"); 160 fprintf(stderr, "Port numbers must be between 0 and 65535\n");
161 exit(1); 161 exit(1);
162 } 162 }
163 net::IPEndPoint remote_endpoint(remote_ip_number, 163 net::IPEndPoint remote_endpoint(remote_ip_number,
164 static_cast<uint16>(remote_port)); 164 static_cast<uint16_t>(remote_port));
165 net::IPEndPoint local_endpoint(local_ip_number, 165 net::IPEndPoint local_endpoint(local_ip_number,
166 static_cast<uint16>(local_port)); 166 static_cast<uint16_t>(local_port));
167 scoped_ptr<media::cast::test::PacketPipe> in_pipe, out_pipe; 167 scoped_ptr<media::cast::test::PacketPipe> in_pipe, out_pipe;
168 scoped_ptr<media::cast::test::InterruptedPoissonProcess> ipp( 168 scoped_ptr<media::cast::test::InterruptedPoissonProcess> ipp(
169 media::cast::test::DefaultInterruptedPoissonProcess()); 169 media::cast::test::DefaultInterruptedPoissonProcess());
170 170
171 if (network_type == "perfect") { 171 if (network_type == "perfect") {
172 // No action needed. 172 // No action needed.
173 } else if (network_type == "wifi") { 173 } else if (network_type == "wifi") {
174 in_pipe = media::cast::test::WifiNetwork().Pass(); 174 in_pipe = media::cast::test::WifiNetwork().Pass();
175 out_pipe = media::cast::test::WifiNetwork().Pass(); 175 out_pipe = media::cast::test::WifiNetwork().Pass();
176 } else if (network_type == "bad") { 176 } else if (network_type == "bad") {
(...skipping 22 matching lines...) Expand all
199 remote_endpoint, 199 remote_endpoint,
200 in_pipe.Pass(), 200 in_pipe.Pass(),
201 out_pipe.Pass(), 201 out_pipe.Pass(),
202 NULL)); 202 NULL));
203 base::MessageLoop message_loop; 203 base::MessageLoop message_loop;
204 g_counter.Get().last_printout = base::TimeTicks::Now(); 204 g_counter.Get().last_printout = base::TimeTicks::Now();
205 CheckByteCounters(); 205 CheckByteCounters();
206 message_loop.Run(); 206 message_loop.Run();
207 return 1; 207 return 1;
208 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698