blob: b590fd7cb3298f51ed31ff5876f59911f70cd76d [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();
Bjorn Terelius59b4e3e2018-05-30 17:14:08 +020030
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080031 void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; }
Bjorn Terelius59b4e3e2018-05-30 17:14:08 +020032
33 void LogCandidatePairConfig(
34 IceCandidatePairConfigType type,
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080035 uint32_t candidate_pair_id,
36 const IceCandidatePairDescription& candidate_pair_desc);
Bjorn Terelius59b4e3e2018-05-30 17:14:08 +020037
38 void LogCandidatePairEvent(IceCandidatePairEventType type,
Erik Språng286ee012018-11-30 09:28:14 +000039 uint32_t candidate_pair_id);
Bjorn Terelius59b4e3e2018-05-30 17:14:08 +020040
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080041 // This method constructs a config event for each candidate pair with their
42 // description and logs these config events. It is intended to be called when
43 // logging starts to ensure that we have at least one config for each
44 // candidate pair id.
45 void DumpCandidatePairDescriptionToMemoryAsConfigEvents() const;
46
47 private:
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080048 RtcEventLog* event_log_ = nullptr;
49 std::unordered_map<uint32_t, IceCandidatePairDescription>
50 candidate_pair_desc_by_id_;
51};
52
53} // namespace webrtc
54
55#endif // LOGGING_RTC_EVENT_LOG_ICELOGGER_H_