WebRTCPlugin.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #pragma once
  2. #include <api/media_stream_interface.h>
  3. #include <api/rtc_error.h>
  4. struct IUnityInterfaces;
  5. namespace unity
  6. {
  7. namespace webrtc
  8. {
  9. using namespace ::webrtc;
  10. class Context;
  11. class PeerConnectionObject;
  12. class UnityVideoRenderer;
  13. class AudioTrackSinkAdapter;
  14. enum class RTCSdpType;
  15. enum class RTCPeerConnectionEventType;
  16. struct MediaStreamEvent;
  17. using DelegateDebugLog = void (*)(const char*);
  18. using DelegateSetResolution = void (*)(int32_t*, int32_t*);
  19. using DelegateMediaStreamOnAddTrack = void (*)(MediaStreamInterface*, MediaStreamTrackInterface*);
  20. using DelegateMediaStreamOnRemoveTrack = void (*)(MediaStreamInterface*, MediaStreamTrackInterface*);
  21. using DelegateVideoFrameResize = void (*)(UnityVideoRenderer* renderer, int width, int height);
  22. void debugLog(const char* buf);
  23. extern DelegateDebugLog delegateDebugLog;
  24. enum class RTCPeerConnectionState
  25. {
  26. New,
  27. Connecting,
  28. Connected,
  29. Disconnected,
  30. Failed,
  31. Closed
  32. };
  33. enum class RTCIceConnectionState
  34. {
  35. New,
  36. Checking,
  37. Connected,
  38. Completed,
  39. Failed,
  40. Disconnected,
  41. Closed,
  42. Max
  43. };
  44. enum class RTCSignalingState
  45. {
  46. Stable,
  47. HaveLocalOffer,
  48. HaveRemoteOffer,
  49. HaveLocalPranswer,
  50. HaveRemotePranswer,
  51. Closed
  52. };
  53. enum class RTCPeerConnectionEventType
  54. {
  55. ConnectionStateChange,
  56. DataChannel,
  57. IceCandidate,
  58. IceConnectionStateChange,
  59. Track
  60. };
  61. enum class RTCSdpType
  62. {
  63. Offer,
  64. PrAnswer,
  65. Answer,
  66. Rollback
  67. };
  68. enum class SdpSemanticsType
  69. {
  70. UnifiedPlan
  71. };
  72. enum class RTCErrorDetailType
  73. {
  74. DataChannelFailure,
  75. DtlsFailure,
  76. FingerprintFailure,
  77. IdpBadScriptFailure,
  78. IdpExecutionFailure,
  79. IdpLoadFailure,
  80. IdpNeedLogin,
  81. IdpTimeout,
  82. IdpTlsFailure,
  83. IdpTokenExpired,
  84. IdpTokenInvalid,
  85. SctpFailure,
  86. SdpSyntaxError,
  87. HardwareEncoderNotAvailable,
  88. HardwareEncoderError
  89. };
  90. enum class RTCIceCredentialType
  91. {
  92. Password,
  93. OAuth
  94. };
  95. enum class TrackKind
  96. {
  97. Audio,
  98. Video
  99. };
  100. struct RTCSessionDescription
  101. {
  102. RTCSdpType type;
  103. char* sdp;
  104. };
  105. struct RTCIceServer
  106. {
  107. char* credential;
  108. char* credentialType;
  109. char** urls;
  110. int urlsLength;
  111. char* username;
  112. };
  113. struct RTCConfiguration
  114. {
  115. RTCIceServer* iceServers;
  116. int iceServersLength;
  117. char* iceServerPolicy;
  118. };
  119. struct RTCIceCandidate
  120. {
  121. char* candidate;
  122. char* sdpMid;
  123. int sdpMLineIndex;
  124. };
  125. struct RTCOfferAnswerOptions
  126. {
  127. bool iceRestart;
  128. bool voiceActivityDetection;
  129. };
  130. class IGraphicsDevice;
  131. class ProfilerMarkerFactory;
  132. class Plugin
  133. {
  134. public:
  135. static IGraphicsDevice* GraphicsDevice();
  136. static ProfilerMarkerFactory* ProfilerMarkerFactory();
  137. };
  138. } // end namespace webrtc
  139. } // end namespace unity