tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ice_logger.cc (1908B)


      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 
     11 #include "logging/rtc_event_log/ice_logger.h"
     12 
     13 #include <cstdint>
     14 #include <memory>
     15 
     16 #include "api/rtc_event_log/rtc_event_log.h"
     17 #include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h"
     18 #include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
     19 
     20 namespace webrtc {
     21 
     22 IceEventLog::IceEventLog() {}
     23 IceEventLog::~IceEventLog() {}
     24 
     25 void IceEventLog::LogCandidatePairConfig(
     26    IceCandidatePairConfigType type,
     27    uint32_t candidate_pair_id,
     28    const IceCandidatePairDescription& candidate_pair_desc) {
     29  if (event_log_ == nullptr) {
     30    return;
     31  }
     32 
     33  candidate_pair_desc_by_id_.emplace(candidate_pair_id, candidate_pair_desc);
     34  event_log_->Log(std::make_unique<RtcEventIceCandidatePairConfig>(
     35      type, candidate_pair_id, candidate_pair_desc));
     36 }
     37 
     38 void IceEventLog::LogCandidatePairEvent(IceCandidatePairEventType type,
     39                                        uint32_t candidate_pair_id,
     40                                        uint32_t transaction_id) {
     41  if (event_log_ == nullptr) {
     42    return;
     43  }
     44  event_log_->Log(std::make_unique<RtcEventIceCandidatePair>(
     45      type, candidate_pair_id, transaction_id));
     46 }
     47 
     48 void IceEventLog::DumpCandidatePairDescriptionToMemoryAsConfigEvents() const {
     49  for (const auto& desc_id_pair : candidate_pair_desc_by_id_) {
     50    event_log_->Log(std::make_unique<RtcEventIceCandidatePairConfig>(
     51        IceCandidatePairConfigType::kUpdated, desc_id_pair.first,
     52        desc_id_pair.second));
     53  }
     54 }
     55 
     56 }  // namespace webrtc