Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 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 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_ |
| 12 | #define LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_ |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 13 | |
| 14 | #include <unordered_map> |
| 15 | |
| 16 | #include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h" |
| 17 | #include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h" |
| 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | class RtcEventLog; |
| 22 | |
| 23 | // IceEventLog wraps RtcEventLog and provides structural logging of ICE-specific |
| 24 | // events. The logged events are serialized with other RtcEvent's if protobuf is |
| 25 | // enabled in the build. |
| 26 | class IceEventLog { |
| 27 | public: |
| 28 | IceEventLog(); |
| 29 | ~IceEventLog(); |
Bjorn Terelius | 59b4e3e | 2018-05-30 17:14:08 +0200 | [diff] [blame] | 30 | |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 31 | void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; } |
Bjorn Terelius | 59b4e3e | 2018-05-30 17:14:08 +0200 | [diff] [blame] | 32 | |
| 33 | void LogCandidatePairConfig( |
| 34 | IceCandidatePairConfigType type, |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 35 | uint32_t candidate_pair_id, |
| 36 | const IceCandidatePairDescription& candidate_pair_desc); |
Bjorn Terelius | 59b4e3e | 2018-05-30 17:14:08 +0200 | [diff] [blame] | 37 | |
| 38 | void LogCandidatePairEvent(IceCandidatePairEventType type, |
Zach Stein | 92c4289 | 2018-11-28 11:38:52 -0800 | [diff] [blame] | 39 | uint32_t candidate_pair_id, |
| 40 | uint32_t transaction_id); |
Bjorn Terelius | 59b4e3e | 2018-05-30 17:14:08 +0200 | [diff] [blame] | 41 | |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 42 | // This method constructs a config event for each candidate pair with their |
| 43 | // description and logs these config events. It is intended to be called when |
| 44 | // logging starts to ensure that we have at least one config for each |
| 45 | // candidate pair id. |
| 46 | void DumpCandidatePairDescriptionToMemoryAsConfigEvents() const; |
| 47 | |
| 48 | private: |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 49 | RtcEventLog* event_log_ = nullptr; |
| 50 | std::unordered_map<uint32_t, IceCandidatePairDescription> |
| 51 | candidate_pair_desc_by_id_; |
| 52 | }; |
| 53 | |
| 54 | } // namespace webrtc |
| 55 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 56 | #endif // LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_ |