peer_connection_internal.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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/rtp_data_channel.h"
  20. #include "pc/rtp_transceiver.h"
  21. #include "pc/sctp_data_channel.h"
  22. namespace webrtc {
  23. // Internal interface for extra PeerConnection methods.
  24. class PeerConnectionInternal : public PeerConnectionInterface {
  25. public:
  26. virtual rtc::Thread* network_thread() const = 0;
  27. virtual rtc::Thread* worker_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<RtpDataChannel*>& SignalRtpDataChannelCreated() = 0;
  36. virtual sigslot::signal1<SctpDataChannel*>&
  37. SignalSctpDataChannelCreated() = 0;
  38. // Only valid when using deprecated RTP data channels.
  39. virtual cricket::RtpDataChannel* rtp_data_channel() const = 0;
  40. // Call on the network thread to fetch stats for all the data channels.
  41. // TODO(tommi): Make pure virtual after downstream updates.
  42. virtual std::vector<DataChannelStats> GetDataChannelStats() const {
  43. return {};
  44. }
  45. virtual absl::optional<std::string> sctp_transport_name() const = 0;
  46. virtual cricket::CandidateStatsList GetPooledCandidateStats() const = 0;
  47. // Returns a map from MID to transport name for all active media sections.
  48. virtual std::map<std::string, std::string> GetTransportNamesByMid() const = 0;
  49. // Returns a map from transport name to transport stats for all given
  50. // transport names.
  51. virtual std::map<std::string, cricket::TransportStats>
  52. GetTransportStatsByNames(const std::set<std::string>& transport_names) = 0;
  53. virtual Call::Stats GetCallStats() = 0;
  54. virtual bool GetLocalCertificate(
  55. const std::string& transport_name,
  56. rtc::scoped_refptr<rtc::RTCCertificate>* certificate) = 0;
  57. virtual std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain(
  58. const std::string& transport_name) = 0;
  59. // Returns true if there was an ICE restart initiated by the remote offer.
  60. virtual bool IceRestartPending(const std::string& content_name) const = 0;
  61. // Returns true if the ICE restart flag above was set, and no ICE restart has
  62. // occurred yet for this transport (by applying a local description with
  63. // changed ufrag/password). If the transport has been deleted as a result of
  64. // bundling, returns false.
  65. virtual bool NeedsIceRestart(const std::string& content_name) const = 0;
  66. // Get SSL role for an arbitrary m= section (handles bundling correctly).
  67. virtual bool GetSslRole(const std::string& content_name,
  68. rtc::SSLRole* role) = 0;
  69. };
  70. } // namespace webrtc
  71. #endif // PC_PEER_CONNECTION_INTERNAL_H_