当前位置: 首页>>代码示例>>C#>>正文


C# BufferChunk.Peek方法代码示例

本文整理汇总了C#中BufferChunk.Peek方法的典型用法代码示例。如果您正苦于以下问题:C# BufferChunk.Peek方法的具体用法?C# BufferChunk.Peek怎么用?C# BufferChunk.Peek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BufferChunk的用法示例。


在下文中一共展示了BufferChunk.Peek方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteToBuffer

        public void WriteToBuffer(BufferChunk buffer)
        {
            // Grab space for the header
            buffer += RtcpHeader.PlaceHolder;
            BufferChunk hBuffer = buffer.Peek(buffer.Length - RtcpHeader.SIZE, RtcpHeader.SIZE);

            // Write the data to the buffer
            WriteDataToBuffer(buffer);

            // Leave the buffer 32 bit aligned
            int padding = AddPadding(buffer);

            // Update the Header's length
            Debug.Assert((Size) % 4 == 0);
            header.Length = (short)((Size - RtcpHeader.SIZE) / 4);
            
            // Write the header to the buffer
            header.WriteDataToBuffer(hBuffer);
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:19,代码来源:RtcpPacket.cs

示例2: OnFrameReceivedEvent

        internal void OnFrameReceivedEvent(BufferChunk frame)
        {
            framesReceived++;

            // Don't trigger the event if it isn't hooked
            // Although RtpEvents.FireEvent does this same check, we add it here for efficiency
            // As audio / video streams create alot of data, but don't use the FrameReceived event
            if(FrameReceived != null)
            {
                if(framesReceived == 1)
                {
                    OnFirstFrameReceivedEvent();
                }

                object[] args = {this, new FrameReceivedEventArgs(this, frame)};
                EventThrower.QueueUserWorkItem(new RtpEvents.RaiseEvent(RaiseFrameReceivedEvent), args);
            }
            else // Audio and Video
            {
                if(frameReceived)
                {
                    if(framesReceived == 1)
                    {
                        firstFrame = frame.Peek(frame.Index, frame.Length);
                        OnFirstFrameReceivedEvent();
                    }

                    lastFrame = frame;
                    
                    
                    frameReceived = false;
                    nextFrameEvent.Set();
                }
            }
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:35,代码来源:RtpStream.cs


注:本文中的BufferChunk.Peek方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。