示例#1
0
        private static RtcpSenderReportPacket ParseRtcpSenderReportPacket(byte sourceCount, Span <byte> bytes, ref int idx)
        {
            var rtcpPacket = new RtcpSenderReportPacket();

            rtcpPacket.SynchronizationSource = BinaryPrimitives.ReadUInt32BigEndian(bytes.Slice(idx));

            idx += 4;

            rtcpPacket.NtpTimestamp = BinaryPrimitives.ReadUInt64BigEndian(bytes.Slice(idx));

            idx += 8;

            rtcpPacket.RtpTimestamp = BinaryPrimitives.ReadUInt32BigEndian(bytes.Slice(idx));

            idx += 4;

            rtcpPacket.SenderPacketCount = BinaryPrimitives.ReadUInt32BigEndian(bytes.Slice(idx));

            idx += 4;

            rtcpPacket.SenderOctetCount = BinaryPrimitives.ReadUInt32BigEndian(bytes.Slice(idx));

            idx += 4;

            rtcpPacket.ReceptionReports = new List <RtcpReceptionReport>(sourceCount);

            for (var i = 0; i < sourceCount; i++)
            {
                var rtcpReceptionReport = ParseRtcpReceptionReport(bytes, ref idx);

                rtcpPacket.ReceptionReports.Add(rtcpReceptionReport);
            }

            return(rtcpPacket);
        }
示例#2
0
 public void SetSenderReport(RtcpSenderReportPacket senderReportRtcpPacket)
 {
     _senderReports.AddOrUpdate(senderReportRtcpPacket.SynchronizationSource, k => senderReportRtcpPacket,
                                (k, v) => senderReportRtcpPacket);
 }