File: ice_connection.cc

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (49 lines) | stat: -rw-r--r-- 1,838 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "third_party/webrtc_overrides/p2p/base/ice_connection.h"

#include <string>

#include "third_party/webrtc/p2p/base/connection.h"
#include "third_party/webrtc/rtc_base/strings/string_builder.h"

namespace blink {

namespace {

IceConnection::WriteState ConvertFromWebrtcWriteState(
    webrtc::Connection::WriteState write_state) {
  switch (write_state) {
    case webrtc::Connection::WriteState::STATE_WRITE_INIT:
      return IceConnection::WriteState::STATE_WRITE_INIT;
    case webrtc::Connection::STATE_WRITABLE:
      return IceConnection::WriteState::STATE_WRITABLE;
    case webrtc::Connection::STATE_WRITE_UNRELIABLE:
      return IceConnection::WriteState::STATE_WRITE_UNRELIABLE;
    case webrtc::Connection::STATE_WRITE_TIMEOUT:
      return IceConnection::WriteState::STATE_WRITE_TIMEOUT;
  }
}

}  // unnamed namespace

IceConnection::IceConnection(const webrtc::Connection* connection)
    : id_(connection->id()),
      local_candidate_(connection->local_candidate()),
      remote_candidate_(connection->remote_candidate()),
      connected_(connection->connected()),
      selected_(connection->selected()),
      write_state_(ConvertFromWebrtcWriteState(connection->write_state())),
      last_ping_sent_(connection->last_ping_sent()),
      last_ping_received_(connection->last_ping_received()),
      last_data_received_(connection->last_data_received()),
      last_ping_response_received_(connection->last_ping_response_received()),
      num_pings_sent_(connection->num_pings_sent()) {}
// TODO(crbug.com/1369096): rtt_samples_: extract RTT samples from connection.

std::string IceConnection::ToString() const {
  webrtc::StringBuilder ss;
  ss << "IceConn[" << id_ << ":" << local_candidate_.ToString() << ":"
     << remote_candidate_.ToString() << "]";
  return ss.Release();
}

}  // namespace blink