1 /* 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 15 namespace cricket { 16 ToString() const17std::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 case ICE_CONTROLLER_RECHECK: 48 reason = "ice-controller-request-recheck"; 49 break; 50 } 51 if (recheck_delay_ms) { 52 reason += " (after delay: " + std::to_string(recheck_delay_ms) + ")"; 53 } 54 return reason; 55 } 56 57 } // namespace cricket 58