Roll src/third_party/WebKit a452221:9ff6d11 (svn 202117:202119)
[chromium-blink-merge.git] / content / renderer / media / webrtc / stun_field_trial.h
blob4095bede6812c01ab81f8b934d2f642a2731e52f
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_STUN_FIELD_TRIAL_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_STUN_FIELD_TRIAL_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h"
12 #include "third_party/webrtc/base/network.h"
14 namespace rtc {
15 class PacketSocketFactory;
16 class SocketAddress;
17 } // namespace rtc
19 namespace stunprober {
20 class StunProber;
21 } // namespace stunprober
23 namespace content {
25 // Wait for 30 seconds to avoid high CPU usage during browser start-up which
26 // might affect the accuracy of the trial. The trial wakes up the browser every
27 // 1 ms for no more than 3 seconds to see if time has passed for sending next
28 // stun probe.
29 static const int kExperimentStartDelayMs = 30000;
31 // This will use |factory| to create sockets, send stun binding requests with
32 // various intervals as determined by |params|, observed the success rate and
33 // latency of the stun responses and report through UMA.
34 scoped_ptr<stunprober::StunProber> StartStunProbeTrial(
35 const rtc::NetworkManager::NetworkList& networks,
36 const std::string& params,
37 rtc::PacketSocketFactory* factory);
39 // Parsing function to decode the '/' separated parameter string |params|.
40 CONTENT_EXPORT bool ParseStunProbeParameters(
41 const std::string& params,
42 int* requests_per_ip,
43 int* interval_ms,
44 int* shared_socket_mode,
45 std::vector<rtc::SocketAddress>* servers);
47 } // namespace content
49 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_STUN_FIELD_TRIAL_H_