private void OfferIceConnectionStateChangeEventHandler(object s, WebRTCIceConnectionStateChangedEventArgs e)
{
- if (e.State == WebRTCIceConnectionState.Completed)
+ if (e.State == WebRTCIceConnectionState.Connected || e.State == WebRTCIceConnectionState.Completed)
{
Log.Info(WebRTCTestLog.Tag, "[START] _tcsOfferIceConnectionState.TrySetResult(true)");
_tcsOfferIceConnectionState.TrySetResult(true);
private void AnswerIceConnectionStateChangeEventHandler(object s, WebRTCIceConnectionStateChangedEventArgs e)
{
- if (e.State == WebRTCIceConnectionState.Completed)
+ if (e.State == WebRTCIceConnectionState.Connected || e.State == WebRTCIceConnectionState.Completed)
{
Log.Info(WebRTCTestLog.Tag, "[START] _tcsAnswerIceConnectionState.TrySetResult(true)");
_tcsAnswerIceConnectionState.TrySetResult(true);
var tasks = new List<Task>();
- var tcsOfferIceConnectionState = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
- var tcsAnswerIceConnectionState = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
var tcsOfferPeeronnectionState = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
var tcsAnswerPeeronnectionState = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
- tasks.Add(tcsOfferIceConnectionState.Task);
- tasks.Add(tcsAnswerIceConnectionState.Task);
tasks.Add(tcsOfferPeeronnectionState.Task);
tasks.Add(tcsAnswerPeeronnectionState.Task);
- EventHandler<WebRTCIceConnectionStateChangedEventArgs> offerIceConnectionEventHandler = (s, e) =>
- {
- if (e.State == WebRTCIceConnectionState.Completed)
- {
- Log.Info(WebRTCTestLog.Tag, $"[START] tcsOfferIceConnectionState [{e.State}]");
- tcsOfferIceConnectionState.TrySetResult(true);
- Log.Info(WebRTCTestLog.Tag, $"[END] tcsOfferIceConnectionState [{e.State}]");
- }
- };
- EventHandler<WebRTCIceConnectionStateChangedEventArgs> answerIceConnectionEventHandler = (s, e) =>
- {
- if (e.State == WebRTCIceConnectionState.Completed)
- {
- Log.Info(WebRTCTestLog.Tag, $"[START] tcsAnswerIceConnectionState [{e.State}]");
- tcsAnswerIceConnectionState.TrySetResult(true);
- Log.Info(WebRTCTestLog.Tag, $"[END] tcsAnswerIceConnectionState [{e.State}]");
- }
- };
EventHandler<WebRTCPeerConnectionStateChangedEventArgs> offerPeerConnectionEventHandler = (s, e) =>
{
if (e.State == WebRTCPeerConnectionState.Connected)
}
};
- offerClient.IceConnectionStateChanged += offerIceConnectionEventHandler;
offerClient.PeerConnectionStateChanged += offerPeerConnectionEventHandler;
-
- answerClient.IceConnectionStateChanged += answerIceConnectionEventHandler;
answerClient.PeerConnectionStateChanged += answerPeerConnectionEventHandler;
if (stateChanged)
}
finally
{
- offerClient.IceConnectionStateChanged -= offerIceConnectionEventHandler;
offerClient.PeerConnectionStateChanged -= offerPeerConnectionEventHandler;
-
- answerClient.IceConnectionStateChanged -= answerIceConnectionEventHandler;
answerClient.PeerConnectionStateChanged -= answerPeerConnectionEventHandler;
if (stateChanged)