本文整理汇总了C#中System.Net.TransportContext.ResetState方法的典型用法代码示例。如果您正苦于以下问题:C# TransportContext.ResetState方法的具体用法?C# TransportContext.ResetState怎么用?C# TransportContext.ResetState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.TransportContext
的用法示例。
在下文中一共展示了TransportContext.ResetState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleCollision
protected internal virtual void HandleCollision(TransportContext transportContext)
{
if (transportContext == null) throw new ArgumentNullException("transportContext");
if (transportContext.IsDisposed) throw new ObjectDisposedException("transportContext");
Media.Common.ILoggingExtensions.Log(Logger, InternalId + "HandleCollision - Ssrc=" + transportContext.SynchronizationSourceIdentifier + " - RSsrc=" + transportContext.RemoteSynchronizationSourceIdentifier);
//Send a goodbye and indicate why.
SendGoodbye(transportContext, System.Text.Encoding.UTF8.GetBytes("ssrc"));
//Assign a new random ssrc which is not equal to the remote parties.
//Noting that you could use the same ssrc +/-N here also or a base from the number of parties etc.
//This may deserve an event, 'OnCollision'
do transportContext.SynchronizationSourceIdentifier = RFC3550.Random32(transportContext.SynchronizationSourceIdentifier);
while (transportContext.SynchronizationSourceIdentifier == transportContext.RemoteSynchronizationSourceIdentifier);
//Reset counters from this point forward
transportContext.ResetState();
}