本文整理汇总了C#中MSR.LST.BufferChunk类的典型用法代码示例。如果您正苦于以下问题:C# BufferChunk类的具体用法?C# BufferChunk怎么用?C# BufferChunk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BufferChunk类属于MSR.LST命名空间,在下文中一共展示了BufferChunk类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Run
override public void Run()
{
BufferChunk bc = new BufferChunk(new byte[5], 2, 3);
if(bc.Index != 2)
{
throw new TestCaseException("unexpected index");
}
}
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:9,代码来源:TestCases.cs
示例2: ValidateBuffer
/// <summary>
/// Make sure the provided buffer might be a real Rtp Packet (version == 2)
/// </summary>
private void ValidateBuffer(BufferChunk buffer)
{
int version = buffer[VPXCC_INDEX] >> 6;
if (version != Rtp.VERSION)
throw new InvalidRtpPacketException(string.Format("Invalid version: {0}, current: {1}",
version, Rtp.VERSION));
}
开发者ID:tdhieu,项目名称:openvss,代码行数:11,代码来源:RtpPacket.cs
示例3: AppendPayload
internal void AppendPayload(BufferChunk data)
{
buffer += data;
}
开发者ID:tdhieu,项目名称:openvss,代码行数:4,代码来源:RtpPacket.cs
示例4: RtpSend
/// <summary>
/// Broadcasts a single chunk and stores it in the frame buffer.
/// </summary>
/// <param name="chunk">The chunk to send</param>
private void RtpSend(Chunk chunk, MessagePriority priority)
{
using(Synchronizer.Lock(this)) {
using(MemoryStream stream = new MemoryStream((int) (this.m_Encoder.MaximumChunkSize * 2))) {
// Store the sequence number of non-real-time chunks so they can be NACKed.
// Use "++this.m_FrameSequence" so that non-real-time chunks always have a
// FrameSequence that is greater than 0.
if (priority != MessagePriority.RealTime)
chunk.FrameSequence = ++this.m_FrameSequence;
// If the chunk is not real time (or it is being resent a second time),
// store the chunk in the buffer so a NACK request can resend it.
if (chunk.FrameSequence > ulong.MinValue)
this.m_FrameBuffer.Insert(chunk);
// Buffering the chunk probably evicted other chunks from the buffer,
// so get the oldest frame in the buffer so receivers don't waste time
// sending NACKs for chunks that are no longer available.
chunk.OldestRecoverableFrame = this.m_FrameBuffer.OldestRecoverableFrame;
chunk.OldestRecoverableMessage = this.m_FrameBuffer.OldestRecoverableMessage;
// Serialize the chunk (which itself contains a serialized message).
// TODO: see whether the wire protocol can be made more efficient.
stream.Position = 0;
this.m_Encoder.EncodeChunk(stream, chunk);
// Prepare the frame to be sent over RTP.
BufferChunk buffer = new BufferChunk(stream.GetBuffer(), 0, (int) stream.Length);
// Send it (or drop some percentage of packets if the debug option is enabled).
if(DEBUG_DROP_RANDOM_FRAMES <= 0 || new Random().Next(100) >= DEBUG_DROP_RANDOM_FRAMES) {
Debug.WriteLine(string.Format("Sending frame #{0} ({1} bytes, message #{2}, chunk #{3} of {4}, depending on #{5}, priority {6})",
chunk.FrameSequence,
chunk.Data.Length,
chunk.MessageSequence,
chunk.ChunkSequenceInMessage + 1,
chunk.NumberOfChunksInMessage,
chunk.MessageDependency,
priority),
this.GetType().ToString());
try {
this.m_RtpSender.Send( buffer );
} catch( Exception ) {
this.Reset();
}
}
else {
Debug.WriteLine(string.Format("DEBUG: Dropping frame #{0} ({1} bytes, message #{2}, chunk #{3} of {4}, depending on #{5}, priority {6})",
chunk.FrameSequence,
chunk.Data.Length,
chunk.MessageSequence,
chunk.ChunkSequenceInMessage + 1,
chunk.NumberOfChunksInMessage,
chunk.MessageDependency,
priority),
this.GetType().ToString());
}
}
}
}
开发者ID:ClassroomPresenter,项目名称:CP3,代码行数:67,代码来源:RTPMessageSender.cs
示例5: ReleaseBuffer
/// <summary>
/// Release the BufferChunk held by this packet so it can be reused outside the scope of this packet.
/// </summary>
/// <returns></returns>
internal BufferChunk ReleaseBuffer()
{
BufferChunk ret = buffer;
buffer = null;
return ret;
}
开发者ID:tdhieu,项目名称:openvss,代码行数:11,代码来源:RtpPacket.cs
示例6: RtpPacket
internal RtpPacket(BufferChunk buffer) : base(buffer){}
开发者ID:tdhieu,项目名称:openvss,代码行数:1,代码来源:RtpPacket.cs
示例7: RtpPacketBase
/// <summary>
/// Create a packet from an existing packet
/// </summary>
/// <param name="packet"></param>
internal RtpPacketBase(RtpPacketBase packet)
{
buffer = packet.buffer;
}
开发者ID:tdhieu,项目名称:openvss,代码行数:8,代码来源:RtpPacket.cs
注:本文中的MSR.LST.BufferChunk类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论