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_
10 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h"
12 #include "third_party/webrtc/base/network.h"
15 class PacketSocketFactory
;
19 namespace stunprober
{
21 } // namespace stunprober
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
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
,
44 int* shared_socket_mode
,
45 std::vector
<rtc::SocketAddress
>* servers
);
47 } // namespace content
49 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_STUN_FIELD_TRIAL_H_