blob: 923c0aacd6090d8c8386993b5ae0f93e6a750416 [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#include "logging/rtc_event_log/icelogger.h"
12
13#include "logging/rtc_event_log/rtc_event_log.h"
14#include "rtc_base/ptr_util.h"
15
16namespace webrtc {
17
18IceEventLog::IceEventLog() {}
19IceEventLog::~IceEventLog() {}
20
Bjorn Terelius59b4e3e2018-05-30 17:14:08 +020021void IceEventLog::LogCandidatePairConfig(
22 IceCandidatePairConfigType type,
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080023 uint32_t candidate_pair_id,
24 const IceCandidatePairDescription& candidate_pair_desc) {
25 if (event_log_ == nullptr) {
26 return;
27 }
Bjorn Terelius59b4e3e2018-05-30 17:14:08 +020028 candidate_pair_desc_by_id_[candidate_pair_id] = candidate_pair_desc;
29 event_log_->Log(rtc::MakeUnique<RtcEventIceCandidatePairConfig>(
30 type, candidate_pair_id, candidate_pair_desc));
31}
32
33void IceEventLog::LogCandidatePairEvent(IceCandidatePairEventType type,
34 uint32_t candidate_pair_id) {
35 if (event_log_ == nullptr) {
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080036 return;
37 }
38 event_log_->Log(
39 rtc::MakeUnique<RtcEventIceCandidatePair>(type, candidate_pair_id));
40}
41
42void IceEventLog::DumpCandidatePairDescriptionToMemoryAsConfigEvents() const {
43 for (const auto& desc_id_pair : candidate_pair_desc_by_id_) {
44 event_log_->Log(rtc::MakeUnique<RtcEventIceCandidatePairConfig>(
Bjorn Terelius59b4e3e2018-05-30 17:14:08 +020045 IceCandidatePairConfigType::kUpdated, desc_id_pair.first,
Qingsi Wang8eca1ff2018-02-02 11:49:44 -080046 desc_id_pair.second));
47 }
48}
49
50} // namespace webrtc