• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LST.BufferChunk类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MUDEngine.CharData类代码示例发布时间:2022-05-26
下一篇:
C# Win32.UnsafeNativeMethods类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap