blob: 0dea43bf9d4947c2e28e8a453fa56957d2874aa0 [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
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_
12#define LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080013
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,
Zach Stein92c42892018-11-28 11:38:52 -080039 uint32_t candidate_pair_id,
40 uint32_t transaction_id);
Bjorn Terelius59b4e3e2018-05-30 17:14:08 +020041
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080042 // 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 Wang8eca1ff2018-02-02 11:49:44 -080049 RtcEventLog* event_log_ = nullptr;
50 std::unordered_map<uint32_t, IceCandidatePairDescription>
51 candidate_pair_desc_by_id_;
52};
53
54} // namespace webrtc
55
Steve Anton10542f22019-01-11 09:11:00 -080056#endif // LOGGING_RTC_EVENT_LOG_ICE_LOGGER_H_