Пример #1
0
 public void InsertMessage(RtpMessage message)
 {
     if (JitterBuffers[message.PayloadType] != null)
     {
         JitterBuffers[message.PayloadType].Insert(message);
     }
 }
Пример #2
0
        public static RtpMessage Parse(byte[] bytes, int startIndex, int length)
        {
            var message = new RtpMessage();

            message.Parse2(bytes, startIndex, length);

            return(message);
        }
Пример #3
0
        public void InsertMessage(RtpMessage message)
        {
            var ssrc = FindSsrc(message.Ssrc);

            if (ssrc == null)
            {
                ssrc = AddSsrc(message.Ssrc, 0x000fffffffffffff, message.Timestamp);
            }

            ssrc.InsertMessage(message);
        }
Пример #4
0
        public void EnqueueMessage(byte[] bytes, int startIndex, int length)
        {
            if (RtpMessage.IsRtpMessage(bytes, startIndex, length))
            {
                var rtpMessage = RtpMessage.Parse(bytes, startIndex, length);

                if (rtpMessage.PayloadType == dtmfEventPayloadType)
                {
                    rtpMessage.Payload = DtmfEventMessage.Parse(bytes,
                                                                rtpMessage.GetPayloadOffset(startIndex), length);
                }

                rtpReceiver.InsertMessage(rtpMessage);
            }
            else if (RtcpMessage.IsRtcpMessage(bytes, startIndex, length))
            {
                rtpReceiver.ProcessMessages(
                    RtcpMessage.Parse(bytes, startIndex, length));
            }
        }
Пример #5
0
        public void Insert(RtpMessage message)
        {
            if (message.SequenceNumber > dequeuedSequenceNumber)
            {
                int index = messages.FindIndex(
                    (oldMessage) => { return(message.SequenceNumber <= oldMessage.SequenceNumber); });

                if (index < 0)
                {
                    messages.Add(message);
                }
                else
                {
                    if (messages[index].SequenceNumber != message.SequenceNumber)
                    {
                        messages.Insert(index, message);
                    }
                }
            }
        }
Пример #6
0
        public UInt64 GetNtpTimestamp(RtpMessage message, int rate)
        {
            if (rate != 0)
            {
                UInt32 delta1 = message.Timestamp - baseRtpTimestamp;
                UInt32 delta2 = baseRtpTimestamp - message.Timestamp;

                if (delta1 <= delta2)
                {
                    return(baseNtpTimestamp +
                           ((UInt64)delta1 << 32) / (UInt64)rate);
                }
                else
                {
                    return(baseNtpTimestamp -
                           ((UInt64)delta2 << 32) / (UInt64)rate);
                }
            }

            return(0);
        }
Пример #7
0
 public UInt64 GetNtpTimestamp(RtpMessage message)
 {
     return(GetNtpTimestamp(message, JitterBuffers[message.PayloadType].Rate));
 }
Пример #8
0
        public bool DequeueAvailable(UInt64 maxNtpTimestamp, out RtpMessage message)
        {
            message = DequeueAvailable(maxNtpTimestamp);

            return(message != null);
        }