blob: 6c930124aa271525e7d89ca318609fae2b70c68d [file] [log] [blame]
Jonas Oreland09c452e2019-11-20 09:01:02 +01001/*
2 * Copyright 2019 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "p2p/base/ice_controller_interface.h"
12
13#include <string>
14
15namespace cricket {
16
17std::string IceControllerEvent::ToString() const {
18 std::string reason;
19 switch (type) {
20 case REMOTE_CANDIDATE_GENERATION_CHANGE:
21 reason = "remote candidate generation maybe changed";
22 break;
23 case NETWORK_PREFERENCE_CHANGE:
24 reason = "network preference changed";
25 break;
26 case NEW_CONNECTION_FROM_LOCAL_CANDIDATE:
27 reason = "new candidate pairs created from a new local candidate";
28 break;
29 case NEW_CONNECTION_FROM_REMOTE_CANDIDATE:
30 reason = "new candidate pairs created from a new remote candidate";
31 break;
32 case NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS:
33 reason = "a new candidate pair created from an unknown remote address";
34 break;
35 case NOMINATION_ON_CONTROLLED_SIDE:
36 reason = "nomination on the controlled side";
37 break;
38 case DATA_RECEIVED:
39 reason = "data received";
40 break;
41 case CONNECT_STATE_CHANGE:
42 reason = "candidate pair state changed";
43 break;
44 case SELECTED_CONNECTION_DESTROYED:
45 reason = "selected candidate pair destroyed";
46 break;
47 }
48 if (dampening_delay) {
49 reason += " (after switching dampening interval: " +
50 std::to_string(dampening_delay) + ")";
51 }
52 return reason;
53}
54
55} // namespace cricket