| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/media/webrtc/stun_field_trial.h" | 5 #include "content/renderer/media/webrtc/stun_field_trial.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 SaveHistogramData(prober); | 126 SaveHistogramData(prober); |
| 127 } | 127 } |
| 128 | 128 |
| 129 } // namespace | 129 } // namespace |
| 130 | 130 |
| 131 bool ParseStunProbeParameters(const std::string& params, | 131 bool ParseStunProbeParameters(const std::string& params, |
| 132 int* requests_per_ip, | 132 int* requests_per_ip, |
| 133 int* interval_ms, | 133 int* interval_ms, |
| 134 int* shared_socket_mode, | 134 int* shared_socket_mode, |
| 135 std::vector<rtc::SocketAddress>* servers) { | 135 std::vector<rtc::SocketAddress>* servers) { |
| 136 std::vector<std::string> stun_params; | 136 std::vector<std::string> stun_params = base::SplitString( |
| 137 base::SplitString(params, '/', &stun_params); | 137 params, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 138 | 138 |
| 139 if (stun_params.size() < 4) { | 139 if (stun_params.size() < 4) { |
| 140 DLOG(ERROR) << "Not enough parameters specified in StartStunProbeTrial"; | 140 DLOG(ERROR) << "Not enough parameters specified in StartStunProbeTrial"; |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 auto param = stun_params.begin(); | 143 auto param = stun_params.begin(); |
| 144 | 144 |
| 145 if (param->empty()) { | 145 if (param->empty()) { |
| 146 *requests_per_ip = 10; | 146 *requests_per_ip = 10; |
| 147 } else if (!base::StringToInt(*param, requests_per_ip)) { | 147 } else if (!base::StringToInt(*param, requests_per_ip)) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 rtc::Callback2<void, StunProber*, int>(&OnStunProbeTrialFinished))) { | 213 rtc::Callback2<void, StunProber*, int>(&OnStunProbeTrialFinished))) { |
| 214 DLOG(ERROR) << "Failed to Start in StartStunProbeTrial"; | 214 DLOG(ERROR) << "Failed to Start in StartStunProbeTrial"; |
| 215 OnStunProbeTrialFinished(prober.get(), StunProber::GENERIC_FAILURE); | 215 OnStunProbeTrialFinished(prober.get(), StunProber::GENERIC_FAILURE); |
| 216 return nullptr; | 216 return nullptr; |
| 217 } | 217 } |
| 218 | 218 |
| 219 return prober; | 219 return prober; |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace content | 222 } // namespace content |
| OLD | NEW |