| OLD | NEW |
| 1 This directory contains an example Unity native plugin for Windows OS. | 1 This directory contains an example Unity native plugin for Windows OS. |
| 2 The APIs use Platform Invoke (P/Invoke) technology as required by Unity native p
lugin. | 2 The APIs use Platform Invoke (P/Invoke) technology as required by Unity native p
lugin. |
| 3 This plugin dll can also be used by Windows C# applications other than Unity. | 3 This plugin dll can also be used by Windows C# applications other than Unity. |
| 4 | 4 |
| 5 An example of wrapping native plugin into a C# managed class in Unity is given a
s following: | 5 An example of wrapping native plugin into a C# managed class in Unity is given a
s following: |
| 6 | 6 |
| 7 using System; | 7 using System; |
| 8 using System.Collections.Generic; |
| 8 using System.Runtime.InteropServices; | 9 using System.Runtime.InteropServices; |
| 9 | 10 |
| 10 namespace SimplePeerConnectionM { | 11 namespace SimplePeerConnectionM { |
| 11 // This is a managed wrap up class for the native c style peer connection APIs
. | 12 // A class for ice candidate. |
| 13 public class IceCandidate { |
| 14 public IceCandidate(string candidate, int sdpMlineIndex, string sdpMid) { |
| 15 mCandidate = candidate; |
| 16 mSdpMlineIndex = sdpMlineIndex; |
| 17 mSdpMid = sdpMid; |
| 18 } |
| 19 string mCandidate; |
| 20 int mSdpMlineIndex; |
| 21 string mSdpMid; |
| 22 |
| 23 public string Candidate { |
| 24 get { return mCandidate; } |
| 25 set { mCandidate = value; } |
| 26 } |
| 27 |
| 28 public int SdpMlineIndex { |
| 29 get { return mSdpMlineIndex; } |
| 30 set { mSdpMlineIndex = value; } |
| 31 } |
| 32 |
| 33 public string SdpMid { |
| 34 get { return mSdpMid; } |
| 35 set { mSdpMid = value; } |
| 36 } |
| 37 } |
| 38 |
| 39 // A managed wrapper up class for the native c style peer connection APIs. |
| 12 public class PeerConnectionM { | 40 public class PeerConnectionM { |
| 13 //private const string dll_path = "SimplePeerConnection"; | 41 private const string dllPath = "webrtc_unity_plugin"; |
| 14 private const string dll_path = "webrtc_unity_plugin"; | 42 |
| 15 | 43 //create a peerconnection with turn servers |
| 16 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 44 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 17 private static extern int CreatePeerConnection(); | 45 private static extern int CreatePeerConnection(string[] turnUrls, int noOfUr
ls, |
| 18 | 46 string username, string credential); |
| 19 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 47 |
| 20 private static extern bool ClosePeerConnection(int peer_connection_id); | 48 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 21 | 49 private static extern bool ClosePeerConnection(int peerConnectionId); |
| 22 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 50 |
| 23 private static extern bool AddStream(int peer_connection_id, bool audio_only
); | 51 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 24 | 52 private static extern bool AddStream(int peerConnectionId, bool audioOnly); |
| 25 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 53 |
| 26 private static extern bool AddDataChannel(int peer_connection_id); | 54 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 27 | 55 private static extern bool AddDataChannel(int peerConnectionId); |
| 28 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 56 |
| 29 private static extern bool CreateOffer(int peer_connection_id); | 57 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 30 | 58 private static extern bool CreateOffer(int peerConnectionId); |
| 31 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 59 |
| 32 private static extern bool CreateAnswer(int peer_connection_id); | 60 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 33 | 61 private static extern bool CreateAnswer(int peerConnectionId); |
| 34 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 62 |
| 35 private static extern bool SendDataViaDataChannel(int peer_connection_id, st
ring data); | 63 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 36 | 64 private static extern bool SendDataViaDataChannel(int peerConnectionId, stri
ng data); |
| 37 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 65 |
| 38 private static extern bool SetAudioControl(int peer_connection_id, bool is_m
ute, bool is_record); | 66 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 67 private static extern bool SetAudioControl(int peerConnectionId, bool isMute
, bool isRecord); |
| 39 | 68 |
| 40 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | 69 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
| 41 private delegate void LocalDataChannelReadyInternalDelegate(); | 70 private delegate void LocalDataChannelReadyInternalDelegate(); |
| 42 public delegate void LocalDataChannelReadyDelegate(int id); | 71 public delegate void LocalDataChannelReadyDelegate(int id); |
| 43 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 72 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 44 private static extern bool RegisterOnLocalDataChannelReady(int peer_connecti
on_id, LocalDataChannelReadyInternalDelegate callback); | 73 private static extern bool RegisterOnLocalDataChannelReady( |
| 74 int peerConnectionId, LocalDataChannelReadyInternalDelegate callback); |
| 45 | 75 |
| 46 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | 76 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
| 47 private delegate void DataFromDataChannelReadyInternalDelegate(string s); | 77 private delegate void DataFromDataChannelReadyInternalDelegate(string s); |
| 48 public delegate void DataFromDataChannelReadyDelegate(int id, string s); | 78 public delegate void DataFromDataChannelReadyDelegate(int id, string s); |
| 49 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 79 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 50 private static extern bool RegisterOnDataFromDataChannelReady(int peer_conne
ction_id, DataFromDataChannelReadyInternalDelegate callback); | 80 private static extern bool RegisterOnDataFromDataChannelReady( |
| 81 int peerConnectionId, DataFromDataChannelReadyInternalDelegate callback)
; |
| 51 | 82 |
| 52 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | 83 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
| 53 private delegate void FailureMessageInternalDelegate(string msg); | 84 private delegate void FailureMessageInternalDelegate(string msg); |
| 54 public delegate void FailureMessageDelegate(int id, string msg); | 85 public delegate void FailureMessageDelegate(int id, string msg); |
| 55 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 86 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 56 private static extern bool RegisterOnFailure(int peer_connection_id, Failure
MessageInternalDelegate callback); | 87 private static extern bool RegisterOnFailure(int peerConnectionId, |
| 57 | 88 FailureMessageInternalDelegate callback); |
| 58 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | 89 |
| 59 private delegate void AudioBusReadyInternalDelegate(IntPtr data, int bits_pe
r_sample, | 90 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
| 60 int sample_rate, int number_of_channels, int number_of_frames); | 91 private delegate void AudioBusReadyInternalDelegate(IntPtr data, int bitsPer
Sample, |
| 61 public delegate void AudioBusReadyDelegate(int id, IntPtr data, int bits_per
_sample, | 92 int sampleRate, int numberOfChannels, int numberOfFrames); |
| 62 int sample_rate, int number_of_channels, int number_of_frames); | 93 public delegate void AudioBusReadyDelegate(int id, IntPtr data, int bitsPerS
ample, |
| 63 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 94 int sampleRate, int numberOfChannels, int numberOfFrames); |
| 64 private static extern bool RegisterOnAudioBusReady(int peer_connection_id, A
udioBusReadyInternalDelegate callback); | 95 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 65 | 96 private static extern bool RegisterOnAudioBusReady(int peerConnectionId, |
| 66 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | 97 AudioBusReadyInternalDelegate callback); |
| 67 private delegate void LocalSdpReadytoSendInternalDelegate(string s); | 98 |
| 68 public delegate void LocalSdpReadytoSendDelegate(int id, string s); | 99 // Video callbacks. |
| 69 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 100 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
| 70 private static extern bool RegisterOnLocalSdpReadytoSend(int peer_connection
_id, LocalSdpReadytoSendInternalDelegate callback); | 101 private delegate void I420FrameReadyInternalDelegate( |
| 71 | 102 IntPtr dataY, IntPtr dataU, IntPtr dataV, |
| 72 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | 103 int strideY, int strideU, int strideV, |
| 73 private delegate void IceCandiateReadytoSendInternalDelegate(string s); | 104 uint width, uint height); |
| 74 public delegate void IceCandiateReadytoSendDelegate(int id, string s); | 105 public delegate void I420FrameReadyDelegate(int id, |
| 75 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 106 IntPtr dataY, IntPtr dataU, IntPtr dataV, |
| 76 private static extern bool RegisterOnIceCandiateReadytoSend(int peer_connect
ion_id, IceCandiateReadytoSendInternalDelegate callback); | 107 int strideY, int strideU, int strideV, |
| 77 | 108 uint width, uint height); |
| 78 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 109 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 79 private static extern int ReceivedSdp(int peer_connection_id, string sdp); | 110 private static extern bool RegisterOnLocalI420FrameReady(int peerConnectionI
d, |
| 80 | 111 I420FrameReadyInternalDelegate callback); |
| 81 [DllImport(dll_path, CallingConvention = CallingConvention.Cdecl)] | 112 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 82 private static extern bool ReceivedIceCandidate(int peer_connection_id, stri
ng ice_candidate); | 113 private static extern bool RegisterOnRemoteI420FrameReady(int peerConnection
Id, |
| 83 | 114 I420FrameReadyInternalDelegate callback); |
| 84 public void CreatePeerConnectionM() { | 115 |
| 85 peer_connection_id_ = CreatePeerConnection(); | 116 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
| 117 private delegate void LocalSdpReadytoSendInternalDelegate(string type, strin
g sdp); |
| 118 public delegate void LocalSdpReadytoSendDelegate(int id, string type, string
sdp); |
| 119 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 120 private static extern bool RegisterOnLocalSdpReadytoSend(int peerConnectionI
d, |
| 121 LocalSdpReadytoSendInternalDelegate callback); |
| 122 |
| 123 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
| 124 private delegate void IceCandiateReadytoSendInternalDelegate( |
| 125 string candidate, int sdpMlineIndex, string sdpMid); |
| 126 public delegate void IceCandiateReadytoSendDelegate( |
| 127 int id, string candidate, int sdpMlineIndex, string sdpMid); |
| 128 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 129 private static extern bool RegisterOnIceCandiateReadytoSend( |
| 130 int peerConnectionId, IceCandiateReadytoSendInternalDelegate callback); |
| 131 |
| 132 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 133 private static extern bool SetRemoteDescription(int peerConnectionId, string
type, string sdp); |
| 134 |
| 135 [DllImport(dllPath, CallingConvention = CallingConvention.Cdecl)] |
| 136 private static extern bool AddIceCandidate(int peerConnectionId, string sdp, |
| 137 int sdpMlineindex, string sdpMid); |
| 138 |
| 139 public PeerConnectionM(List<string> turnUrls, string username, string creden
tial) { |
| 140 string[] urls = turnUrls != null ? turnUrls.ToArray() : null; |
| 141 int length = turnUrls != null ? turnUrls.Count : 0; |
| 142 mPeerConnectionId = CreatePeerConnection(urls, length, username, credentia
l); |
| 86 RegisterCallbacks(); | 143 RegisterCallbacks(); |
| 87 } | 144 } |
| 88 | 145 |
| 89 private void RegisterCallbacks() { | 146 public void ClosePeerConnection() { |
| 90 localDataChannelReadyDelegate_ = new LocalDataChannelReadyInternalDelegate
(RaiseLocalDataChannelReady); | 147 ClosePeerConnection(mPeerConnectionId); |
| 91 RegisterOnLocalDataChannelReady(peer_connection_id_, localDataChannelReady
Delegate_); | 148 mPeerConnectionId = -1; |
| 92 | |
| 93 dataFromDataChannelReadyDelegate_ = new DataFromDataChannelReadyInternalDe
legate(RaiseDataFromDataChannelReady); | |
| 94 RegisterOnDataFromDataChannelReady(peer_connection_id_, dataFromDataChanne
lReadyDelegate_); | |
| 95 | |
| 96 failureMessageDelegate_ = new FailureMessageInternalDelegate(RaiseFailureM
essage); | |
| 97 RegisterOnFailure(peer_connection_id_, failureMessageDelegate_); | |
| 98 | |
| 99 audioBusReadyDelegate_ = new AudioBusReadyInternalDelegate(RaiseAudioBusRe
ady); | |
| 100 RegisterOnAudioBusReady(peer_connection_id_, audioBusReadyDelegate_); | |
| 101 | |
| 102 localSdpReadytoSendDelegate_ = new LocalSdpReadytoSendInternalDelegate(Rai
seLocalSdpReadytoSend); | |
| 103 RegisterOnLocalSdpReadytoSend(peer_connection_id_, localSdpReadytoSendDele
gate_); | |
| 104 | |
| 105 iceCandiateReadytoSendDelegate_ = new IceCandiateReadytoSendInternalDelega
te(RaiseIceCandiateReadytoSend); | |
| 106 RegisterOnIceCandiateReadytoSend(peer_connection_id_, iceCandiateReadytoSe
ndDelegate_); | |
| 107 } | |
| 108 | |
| 109 public void ClosePeerConnectionM() { | |
| 110 ClosePeerConnection(peer_connection_id_); | |
| 111 peer_connection_id_ = -1; | |
| 112 } | 149 } |
| 113 | 150 |
| 114 // Return -1 if Peerconnection is not available. | 151 // Return -1 if Peerconnection is not available. |
| 115 public int GetUniqueId() { | 152 public int GetUniqueId() { |
| 116 return peer_connection_id_; | 153 return mPeerConnectionId; |
| 117 } | 154 } |
| 118 | 155 |
| 119 public void AddStreamM(bool audio_only) { | 156 public void AddStream(bool audioOnly) { |
| 120 AddStream(peer_connection_id_, audio_only); | 157 AddStream(mPeerConnectionId, audioOnly); |
| 121 } | 158 } |
| 122 | 159 |
| 123 public void AddDataChannelM() { | 160 public void AddDataChannel() { |
| 124 AddDataChannel(peer_connection_id_); | 161 AddDataChannel(mPeerConnectionId); |
| 125 } | 162 } |
| 126 | 163 |
| 127 public void CreateOfferM() { | 164 public void CreateOffer() { |
| 128 CreateOffer(peer_connection_id_); | 165 CreateOffer(mPeerConnectionId); |
| 129 } | 166 } |
| 130 | 167 |
| 131 public void CreateAnswerM() { | 168 public void CreateAnswer() { |
| 132 CreateAnswer(peer_connection_id_); | 169 CreateAnswer(mPeerConnectionId); |
| 133 } | 170 } |
| 134 | 171 |
| 135 public void SendDataViaDataChannelM(string data) { | 172 public void SendDataViaDataChannel(string data) { |
| 136 SendDataViaDataChannel(peer_connection_id_, data); | 173 SendDataViaDataChannel(mPeerConnectionId, data); |
| 137 } | 174 } |
| 138 | 175 |
| 139 public void SetAudioControl(bool is_mute, bool is_record) { | 176 public void SetAudioControl(bool isMute, bool isRecord) { |
| 140 SetAudioControl(peer_connection_id_, is_mute, is_record); | 177 SetAudioControl(mPeerConnectionId, isMute, isRecord); |
| 141 } | 178 } |
| 142 | 179 |
| 143 public void ReceivedSdpM(string sdp) { | 180 public void SetRemoteDescription(string type, string sdp) { |
| 144 peer_connection_id_ = ReceivedSdp(peer_connection_id_, sdp); | 181 SetRemoteDescription(mPeerConnectionId, type, sdp); |
| 145 RegisterCallbacks(); | 182 } |
| 146 } | 183 |
| 147 | 184 public void AddIceCandidate(string candidate, int sdpMlineindex, string sdpM
id) { |
| 148 public void ReceivedIceCandidateM(string ice_candidate) { | 185 AddIceCandidate(mPeerConnectionId, candidate, sdpMlineindex, sdpMid); |
| 149 ReceivedIceCandidate(peer_connection_id_, ice_candidate); | 186 } |
| 187 |
| 188 private void RegisterCallbacks() { |
| 189 localDataChannelReadyDelegate = new LocalDataChannelReadyInternalDelegate( |
| 190 RaiseLocalDataChannelReady); |
| 191 RegisterOnLocalDataChannelReady(mPeerConnectionId, localDataChannelReadyDe
legate); |
| 192 |
| 193 dataFromDataChannelReadyDelegate = new DataFromDataChannelReadyInternalDel
egate( |
| 194 RaiseDataFromDataChannelReady); |
| 195 RegisterOnDataFromDataChannelReady(mPeerConnectionId, dataFromDataChannelR
eadyDelegate); |
| 196 |
| 197 failureMessageDelegate = new FailureMessageInternalDelegate(RaiseFailureMe
ssage); |
| 198 RegisterOnFailure(mPeerConnectionId, failureMessageDelegate); |
| 199 |
| 200 audioBusReadyDelegate = new AudioBusReadyInternalDelegate(RaiseAudioBusRea
dy); |
| 201 RegisterOnAudioBusReady(mPeerConnectionId, audioBusReadyDelegate); |
| 202 |
| 203 localI420FrameReadyDelegate = new I420FrameReadyInternalDelegate( |
| 204 RaiseLocalVideoFrameReady); |
| 205 RegisterOnLocalI420FrameReady(mPeerConnectionId, localI420FrameReadyDelega
te); |
| 206 |
| 207 remoteI420FrameReadyDelegate = new I420FrameReadyInternalDelegate( |
| 208 RaiseRemoteVideoFrameReady); |
| 209 RegisterOnRemoteI420FrameReady(mPeerConnectionId, remoteI420FrameReadyDele
gate); |
| 210 |
| 211 localSdpReadytoSendDelegate = new LocalSdpReadytoSendInternalDelegate( |
| 212 RaiseLocalSdpReadytoSend); |
| 213 RegisterOnLocalSdpReadytoSend(mPeerConnectionId, localSdpReadytoSendDelega
te); |
| 214 |
| 215 iceCandiateReadytoSendDelegate = |
| 216 new IceCandiateReadytoSendInternalDelegate(RaiseIceCandiateReadytoSend
); |
| 217 RegisterOnIceCandiateReadytoSend( |
| 218 mPeerConnectionId, iceCandiateReadytoSendDelegate); |
| 150 } | 219 } |
| 151 | 220 |
| 152 private void RaiseLocalDataChannelReady() { | 221 private void RaiseLocalDataChannelReady() { |
| 153 if (OnLocalDataChannelReady != null) | 222 if (OnLocalDataChannelReady != null) |
| 154 OnLocalDataChannelReady(peer_connection_id_); | 223 OnLocalDataChannelReady(mPeerConnectionId); |
| 155 } | 224 } |
| 156 | 225 |
| 157 private void RaiseDataFromDataChannelReady(string data) { | 226 private void RaiseDataFromDataChannelReady(string data) { |
| 158 if (OnDataFromDataChannelReady != null) | 227 if (OnDataFromDataChannelReady != null) |
| 159 OnDataFromDataChannelReady(peer_connection_id_, data); | 228 OnDataFromDataChannelReady(mPeerConnectionId, data); |
| 160 } | 229 } |
| 161 | 230 |
| 162 private void RaiseFailureMessage(string msg) { | 231 private void RaiseFailureMessage(string msg) { |
| 163 if (OnFailureMessage != null) | 232 if (OnFailureMessage != null) |
| 164 OnFailureMessage(peer_connection_id_, msg); | 233 OnFailureMessage(mPeerConnectionId, msg); |
| 165 } | 234 } |
| 166 | 235 |
| 167 private void RaiseAudioBusReady(IntPtr data, int bits_per_sample, | 236 private void RaiseAudioBusReady(IntPtr data, int bitsPerSample, |
| 168 int sample_rate, int number_of_channels, int number_of_frames) { | 237 int sampleRate, int numberOfChannels, int numberOfFrames) { |
| 169 if (OnAudioBusReady != null) | 238 if (OnAudioBusReady != null) |
| 170 OnAudioBusReady(peer_connection_id_, data, bits_per_sample, sample_rate, | 239 OnAudioBusReady(mPeerConnectionId, data, bitsPerSample, sampleRate, |
| 171 number_of_channels, number_of_frames); | 240 numberOfChannels, numberOfFrames); |
| 172 } | 241 } |
| 173 | 242 |
| 174 private void RaiseLocalSdpReadytoSend(string msg) { | 243 private void RaiseLocalVideoFrameReady( |
| 244 IntPtr dataY, IntPtr dataU, IntPtr dataV, |
| 245 int strideY, int strideU, int strideV, |
| 246 uint width, uint height) { |
| 247 if (OnLocalVideoFrameReady != null) |
| 248 OnLocalVideoFrameReady(mPeerConnectionId, dataY, dataU, dataV, strideY,
strideU, strideV, |
| 249 width, height); |
| 250 } |
| 251 |
| 252 private void RaiseRemoteVideoFrameReady( |
| 253 IntPtr dataY, IntPtr dataU, IntPtr dataV, |
| 254 int strideY, int strideU, int strideV, |
| 255 uint width, uint height) { |
| 256 if (OnRemoteVideoFrameReady != null) |
| 257 OnRemoteVideoFrameReady(mPeerConnectionId, dataY, dataU, dataV, strideY,
strideU, strideV, |
| 258 width, height); |
| 259 } |
| 260 |
| 261 |
| 262 private void RaiseLocalSdpReadytoSend(string type, string sdp) { |
| 175 if (OnLocalSdpReadytoSend != null) | 263 if (OnLocalSdpReadytoSend != null) |
| 176 OnLocalSdpReadytoSend(peer_connection_id_, msg); | 264 OnLocalSdpReadytoSend(mPeerConnectionId, type, sdp); |
| 177 } | 265 } |
| 178 | 266 |
| 179 private void RaiseIceCandiateReadytoSend(string msg) { | 267 private void RaiseIceCandiateReadytoSend(string candidate, int sdpMlineIndex
, string sdpMid) { |
| 180 if (OnIceCandiateReadytoSend != null) | 268 if (OnIceCandiateReadytoSend != null) |
| 181 OnIceCandiateReadytoSend(peer_connection_id_, msg); | 269 OnIceCandiateReadytoSend(mPeerConnectionId, candidate, sdpMlineIndex, sd
pMid); |
| 182 } | 270 } |
| 183 | 271 |
| 184 private LocalDataChannelReadyInternalDelegate localDataChannelReadyDelegate_
= null; | 272 public void AddQueuedIceCandidate(List<IceCandidate> iceCandidateQueue) { |
| 273 if (iceCandidateQueue != null) { |
| 274 foreach (IceCandidate ic in iceCandidateQueue) { |
| 275 AddIceCandidate(mPeerConnectionId, ic.Candidate, ic.SdpMlineIndex, ic.
SdpMid); |
| 276 } |
| 277 } |
| 278 } |
| 279 |
| 280 private LocalDataChannelReadyInternalDelegate localDataChannelReadyDelegate
= null; |
| 185 public event LocalDataChannelReadyDelegate OnLocalDataChannelReady; | 281 public event LocalDataChannelReadyDelegate OnLocalDataChannelReady; |
| 186 | 282 |
| 187 private DataFromDataChannelReadyInternalDelegate dataFromDataChannelReadyDel
egate_ = null; | 283 private DataFromDataChannelReadyInternalDelegate dataFromDataChannelReadyDel
egate = null; |
| 188 public event DataFromDataChannelReadyDelegate OnDataFromDataChannelReady; | 284 public event DataFromDataChannelReadyDelegate OnDataFromDataChannelReady; |
| 189 | 285 |
| 190 private FailureMessageInternalDelegate failureMessageDelegate_ = null; | 286 private FailureMessageInternalDelegate failureMessageDelegate = null; |
| 191 public event FailureMessageDelegate OnFailureMessage; | 287 public event FailureMessageDelegate OnFailureMessage; |
| 192 | 288 |
| 193 private AudioBusReadyInternalDelegate audioBusReadyDelegate_ = null; | 289 private AudioBusReadyInternalDelegate audioBusReadyDelegate = null; |
| 194 public event AudioBusReadyDelegate OnAudioBusReady; | 290 public event AudioBusReadyDelegate OnAudioBusReady; |
| 195 | 291 |
| 196 private LocalSdpReadytoSendInternalDelegate localSdpReadytoSendDelegate_ = n
ull; | 292 private I420FrameReadyInternalDelegate localI420FrameReadyDelegate = null; |
| 293 public event I420FrameReadyDelegate OnLocalVideoFrameReady; |
| 294 |
| 295 private I420FrameReadyInternalDelegate remoteI420FrameReadyDelegate = null; |
| 296 public event I420FrameReadyDelegate OnRemoteVideoFrameReady; |
| 297 |
| 298 private LocalSdpReadytoSendInternalDelegate localSdpReadytoSendDelegate = nu
ll; |
| 197 public event LocalSdpReadytoSendDelegate OnLocalSdpReadytoSend; | 299 public event LocalSdpReadytoSendDelegate OnLocalSdpReadytoSend; |
| 198 | 300 |
| 199 private IceCandiateReadytoSendInternalDelegate iceCandiateReadytoSendDelegat
e_ = null; | 301 private IceCandiateReadytoSendInternalDelegate iceCandiateReadytoSendDelegat
e = null; |
| 200 public event IceCandiateReadytoSendDelegate OnIceCandiateReadytoSend; | 302 public event IceCandiateReadytoSendDelegate OnIceCandiateReadytoSend; |
| 201 | 303 |
| 202 private int peer_connection_id_ = -1; | 304 private int mPeerConnectionId = -1; |
| 203 } | 305 } |
| 204 } | 306 } |
| OLD | NEW |