本文整理汇总了C#中System.Net.TransportContext.AssignIdentity方法的典型用法代码示例。如果您正苦于以下问题:C# TransportContext.AssignIdentity方法的具体用法?C# TransportContext.AssignIdentity怎么用?C# TransportContext.AssignIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.TransportContext
的用法示例。
在下文中一共展示了TransportContext.AssignIdentity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendSendersReport
protected internal virtual int SendSendersReport(TransportContext context, bool force = false)
{
//Determine if the SendersReport can be sent.
if (IsDisposed //If the context is disposed
&& //AND the call has not been forced AND the context IsRtcpEnabled
(false == force && true == context.IsRtcpEnabled)
// OR there is no RtcpSocket
|| context.RtcpSocket == null)
{
//Indicate nothing was sent
return 0;
}
//Ensure the SynchronizationSourceIdentifier of the transportChannel is assigned
context.AssignIdentity();
//First report include no blocks (No last senders report), store the report being sent
context.SendersReport = TransportContext.CreateSendersReport(context, false);
//Always send compound with SourceDescription for now
return SendRtcpPackets(Media.Common.Extensions.Linq.LinqExtensions.Yield<RtcpPacket>(context.SendersReport).Concat(Media.Common.Extensions.Linq.LinqExtensions.Yield((context.SourceDescription = TransportContext.CreateSourceDescription(context)))));
}
示例2: SendReceiversReport
/// <summary>
/// Send any <see cref="ReceiversReports"/>'s required by the given context immediately reguardless <see cref="MaximumRtcpBandwidth"/>
/// Return the amount of bytes sent when sending the reports.
/// </summary>
/// <param name="context">The context</param>
protected internal virtual int SendReceiversReport(TransportContext context, bool force = false)
{
//Determine if the ReceiversReport can be sent.
if (IsDisposed //If the context is disposed
&& //AND the call has not been forced AND the context IsRtcpEnabled
(false == force && true == context.IsRtcpEnabled)
// OR there is no RtcpSocket
|| context.RtcpSocket == null)
{
//Indicate nothing was sent
return 0;
}
//Ensure the SynchronizationSourceIdentifier of the transportContext is assigned
context.AssignIdentity();
//create and store the receivers report sent
context.ReceiversReport = TransportContext.CreateReceiversReport(context, false);
//If the bandwidth is not exceeded also send a SourceDescription
if (false == AverageRtcpBandwidthExceeded)
{
return SendRtcpPackets(Media.Common.Extensions.Linq.LinqExtensions.Yield<RtcpPacket>(context.ReceiversReport).Concat(Media.Common.Extensions.Linq.LinqExtensions.Yield((context.SourceDescription = TransportContext.CreateSourceDescription(context)))));
}
//Just send the ReceiversReport
return SendRtcpPackets(Media.Common.Extensions.Linq.LinqExtensions.Yield(context.ReceiversReport));
}