peer_connection_internal.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright 2018 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. #ifndef PC_PEER_CONNECTION_INTERNAL_H_
  11. #define PC_PEER_CONNECTION_INTERNAL_H_
  12. #include <map>
  13. #include <memory>
  14. #include <set>
  15. #include <string>
  16. #include <vector>
  17. #include "api/peer_connection_interface.h"
  18. #include "call/call.h"
  19. #include "pc/data_channel.h"
  20. #include "pc/rtp_transceiver.h"
  21. namespace webrtc {
  22. // Internal interface for extra PeerConnection methods.
  23. class PeerConnectionInternal : public PeerConnectionInterface {
  24. public:
  25. virtual rtc::Thread* network_thread() const = 0;
  26. virtual rtc::Thread* worker_thread() const = 0;
  27. virtual rtc::Thread* signaling_thread() const = 0;
  28. // The SDP session ID as defined by RFC 3264.
  29. virtual std::string session_id() const = 0;
  30. // Returns true if we were the initial offerer.
  31. virtual bool initial_offerer() const = 0;
  32. virtual std::vector<
  33. rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>>
  34. GetTransceiversInternal() const = 0;
  35. virtual sigslot::signal1<DataChannel*>& SignalDataChannelCreated() = 0;
  36. // Only valid when using deprecated RTP data channels.
  37. virtual cricket::RtpDataChannel* rtp_data_channel() const = 0;
  38. // Call on the network thread to fetch stats for all the data channels.
  39. // TODO(tommi): Make pure virtual after downstream updates.
  40. virtual std::vector<DataChannel::Stats> GetDataChannelStats() const {
  41. return {};
  42. }
  43. virtual absl::optional<std::string> sctp_transport_name() const = 0;
  44. virtual cricket::CandidateStatsList GetPooledCandidateStats() const = 0;
  45. // Returns a map from MID to transport name for all active media sections.
  46. virtual std::map<std::string, std::string> GetTransportNamesByMid() const = 0;
  47. // Returns a map from transport name to transport stats for all given
  48. // transport names.
  49. virtual std::map<std::string, cricket::TransportStats>
  50. GetTransportStatsByNames(const std::set<std::string>& transport_names) = 0;
  51. virtual Call::Stats GetCallStats() = 0;
  52. virtual bool GetLocalCertificate(
  53. const std::string& transport_name,
  54. rtc::scoped_refptr<rtc::RTCCertificate>* certificate) = 0;
  55. virtual std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain(
  56. const std::string& transport_name) = 0;
  57. // Returns true if there was an ICE restart initiated by the remote offer.
  58. virtual bool IceRestartPending(const std::string& content_name) const = 0;
  59. // Returns true if the ICE restart flag above was set, and no ICE restart has
  60. // occurred yet for this transport (by applying a local description with
  61. // changed ufrag/password). If the transport has been deleted as a result of
  62. // bundling, returns false.
  63. virtual bool NeedsIceRestart(const std::string& content_name) const = 0;
  64. // Get SSL role for an arbitrary m= section (handles bundling correctly).
  65. virtual bool GetSslRole(const std::string& content_name,
  66. rtc::SSLRole* role) = 0;
  67. };
  68. } // namespace webrtc
  69. #endif // PC_PEER_CONNECTION_INTERNAL_H_