|  | 
|  | 1 | +#ifndef LIB_WEBRTC_RTC_TYPES_HXX_CAPI | 
|  | 2 | +#define LIB_WEBRTC_RTC_TYPES_HXX_CAPI | 
|  | 3 | + | 
|  | 4 | +#ifdef LIB_WEBRTC_API_EXPORTS | 
|  | 5 | +#define LIB_WEBRTC_CAPI __declspec(dllexport) | 
|  | 6 | +#elif defined(LIB_WEBRTC_API_DLL) | 
|  | 7 | +#define LIB_WEBRTC_CAPI __declspec(dllimport) | 
|  | 8 | +#elif !defined(WIN32) | 
|  | 9 | +#define LIB_WEBRTC_CAPI __attribute__((visibility("default"))) | 
|  | 10 | +#else | 
|  | 11 | +#define LIB_WEBRTC_CAPI | 
|  | 12 | +#endif | 
|  | 13 | + | 
|  | 14 | +#include <stdint.h> | 
|  | 15 | + | 
|  | 16 | +extern "C" { | 
|  | 17 | +typedef void* rtcRefCountedObjectHandle; | 
|  | 18 | + | 
|  | 19 | +typedef struct { | 
|  | 20 | +  const char* message; | 
|  | 21 | +} rtcError; | 
|  | 22 | + | 
|  | 23 | +enum class rtcBoolean : int { kFalse = 0, kTrue = 1 }; | 
|  | 24 | + | 
|  | 25 | +enum class rtcResult : uint32_t { | 
|  | 26 | +  kSuccess = 0, | 
|  | 27 | +  kInvalidPointer = 1, | 
|  | 28 | +}; | 
|  | 29 | + | 
|  | 30 | +const int kMaxIceServerSize = 8; | 
|  | 31 | + | 
|  | 32 | +enum class MediaSecurityType : int { | 
|  | 33 | +  kSRTP_None = 0, | 
|  | 34 | +  kSDES_SRTP = 1, | 
|  | 35 | +  kDTLS_SRTP = 2 | 
|  | 36 | +}; | 
|  | 37 | + | 
|  | 38 | +enum class RTCMediaType : int { | 
|  | 39 | +  AUDIO = 0, | 
|  | 40 | +  VIDEO = 1, | 
|  | 41 | +  DATA = 2, | 
|  | 42 | +  UNSUPPORTED = 3 | 
|  | 43 | +}; | 
|  | 44 | + | 
|  | 45 | +struct IceServer { | 
|  | 46 | +  const char* uri = nullptr; | 
|  | 47 | +  const char* username = nullptr; | 
|  | 48 | +  const char* password = nullptr; | 
|  | 49 | +}; | 
|  | 50 | + | 
|  | 51 | +enum class IceTransportsType { kNone, kRelay, kNoHost, kAll }; | 
|  | 52 | + | 
|  | 53 | +enum class TcpCandidatePolicy { | 
|  | 54 | +  kTcpCandidatePolicyEnabled, | 
|  | 55 | +  kTcpCandidatePolicyDisabled | 
|  | 56 | +}; | 
|  | 57 | + | 
|  | 58 | +enum class CandidateNetworkPolicy { | 
|  | 59 | +  kCandidateNetworkPolicyAll, | 
|  | 60 | +  kCandidateNetworkPolicyLowCost | 
|  | 61 | +}; | 
|  | 62 | + | 
|  | 63 | +enum class RtcpMuxPolicy { | 
|  | 64 | +  kRtcpMuxPolicyNegotiate, | 
|  | 65 | +  kRtcpMuxPolicyRequire, | 
|  | 66 | +}; | 
|  | 67 | + | 
|  | 68 | +enum BundlePolicy { | 
|  | 69 | +  kBundlePolicyBalanced, | 
|  | 70 | +  kBundlePolicyMaxBundle, | 
|  | 71 | +  kBundlePolicyMaxCompat | 
|  | 72 | +}; | 
|  | 73 | + | 
|  | 74 | +enum class SdpSemantics { kPlanB, kUnifiedPlan }; | 
|  | 75 | + | 
|  | 76 | +struct RTCConfiguration { | 
|  | 77 | +  IceServer ice_servers[kMaxIceServerSize]; | 
|  | 78 | +  IceTransportsType type = IceTransportsType::kAll; | 
|  | 79 | +  BundlePolicy bundle_policy = BundlePolicy::kBundlePolicyBalanced; | 
|  | 80 | +  RtcpMuxPolicy rtcp_mux_policy = RtcpMuxPolicy::kRtcpMuxPolicyRequire; | 
|  | 81 | +  CandidateNetworkPolicy candidate_network_policy = | 
|  | 82 | +      CandidateNetworkPolicy::kCandidateNetworkPolicyAll; | 
|  | 83 | +  TcpCandidatePolicy tcp_candidate_policy = | 
|  | 84 | +      TcpCandidatePolicy::kTcpCandidatePolicyEnabled; | 
|  | 85 | + | 
|  | 86 | +  int ice_candidate_pool_size = 0; | 
|  | 87 | + | 
|  | 88 | +  MediaSecurityType srtp_type = MediaSecurityType::kDTLS_SRTP; | 
|  | 89 | +  SdpSemantics sdp_semantics = SdpSemantics::kUnifiedPlan; | 
|  | 90 | +  bool offer_to_receive_audio = true; | 
|  | 91 | +  bool offer_to_receive_video = true; | 
|  | 92 | + | 
|  | 93 | +  bool disable_ipv6 = false; | 
|  | 94 | +  bool disable_ipv6_on_wifi = false; | 
|  | 95 | +  int max_ipv6_networks = 5; | 
|  | 96 | +  bool disable_link_local_networks = false; | 
|  | 97 | +  int screencast_min_bitrate = -1; | 
|  | 98 | + | 
|  | 99 | +  // private | 
|  | 100 | +  bool use_rtp_mux = true; | 
|  | 101 | +  uint32_t local_audio_bandwidth = 128; | 
|  | 102 | +  uint32_t local_video_bandwidth = 512; | 
|  | 103 | +}; | 
|  | 104 | + | 
|  | 105 | +struct SdpParseError { | 
|  | 106 | +  // The sdp line that causes the error. | 
|  | 107 | +  const char* line = nullptr; | 
|  | 108 | +  // Explains the error. | 
|  | 109 | +  const char* description = nullptr; | 
|  | 110 | +}; | 
|  | 111 | + | 
|  | 112 | +enum DesktopType { kScreen, kWindow }; | 
|  | 113 | + | 
|  | 114 | +#define CHECK_POINTER_EX(p, r) \ | 
|  | 115 | +  if ((p) == nullptr) {        \ | 
|  | 116 | +    return (r);                \ | 
|  | 117 | +  } | 
|  | 118 | + | 
|  | 119 | +#define CHECK_POINTER(p) CHECK_POINTER_EX(p, rtcResult::kInvalidPointer) | 
|  | 120 | +} | 
|  | 121 | + | 
|  | 122 | +#endif  // LIB_WEBRTC_RTC_TYPES_HXX | 
0 commit comments