本文整理汇总了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);
}
示例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();
}
}
}