blob: b3689c7c1031cadb95f392f625e5f23fcceea053 [file] [log] [blame]
Qingsi Wang8eca1ff2018-02-02 11:49:44 -08001/*
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
11#ifndef LOGGING_RTC_EVENT_LOG_ICELOGGER_H_
12#define LOGGING_RTC_EVENT_LOG_ICELOGGER_H_
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
19namespace webrtc {
20
21class 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.
26class IceEventLog {
27 public:
28 IceEventLog();
29 ~IceEventLog();
30 void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; }
31 void LogCandidatePairEvent(
32 IceCandidatePairEventType type,
33 uint32_t candidate_pair_id,
34 const IceCandidatePairDescription& candidate_pair_desc);
35 // This method constructs a config event for each candidate pair with their
36 // description and logs these config events. It is intended to be called when
37 // logging starts to ensure that we have at least one config for each
38 // candidate pair id.
39 void DumpCandidatePairDescriptionToMemoryAsConfigEvents() const;
40
41 private:
42 bool IsIceCandidatePairConfigEvent(IceCandidatePairEventType type);
43
44 RtcEventLog* event_log_ = nullptr;
45 std::unordered_map<uint32_t, IceCandidatePairDescription>
46 candidate_pair_desc_by_id_;
47};
48
49} // namespace webrtc
50
51#endif // LOGGING_RTC_EVENT_LOG_ICELOGGER_H_