コード例 #1
0
        /// <summary>
        /// Gets the RTCP compound packet containing the RTCP reports we send.
        /// </summary>
        /// <returns>An RTCP compound packet.</returns>
        private RTCPCompoundPacket GetRtcpReport()
        {
            ReceptionReportSample rr = (m_receptionReport != null)
                ? m_receptionReport.GetSample(DateTimeToNtpTimestamp32(DateTime.Now))
                : null;
            var sdesReport = new RTCPSDesReport(Ssrc, Cname);

            if (PacketsSentCount > m_previousPacketsSentCount)
            {
                // If we have sent a packet since the last report then we send an RTCP Sender Report.
                var senderReport = new RTCPSenderReport(Ssrc, LastNtpTimestampSent, LastRtpTimestampSent,
                                                        PacketsSentCount, OctetsSentCount, (rr != null) ? new List <ReceptionReportSample> {
                    rr
                } : null);
                return(new RTCPCompoundPacket(senderReport, sdesReport));
            }
            else
            {
                // If we have NOT sent a packet since the last report then we send an RTCP Receiver Report.
                if (rr != null)
                {
                    var receiverReport = new RTCPReceiverReport(Ssrc, new List <ReceptionReportSample> {
                        rr
                    });
                    return(new RTCPCompoundPacket(receiverReport, sdesReport));
                }
                else
                {
                    var receiverReport = new RTCPReceiverReport(Ssrc, null);
                    return(new RTCPCompoundPacket(receiverReport, sdesReport));
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the RTCP compound packet containing the RTCP reports we send.
        /// </summary>
        /// <returns>An RTCP compound packet.</returns>
        private RTCPCompoundPacket GetRtcpReport()
        {
            ReceptionReportSample rr = (m_receptionReport != null) ? m_receptionReport.GetSample(DateTimeToNtpTimestamp32(DateTime.Now)) : null;
            var senderReport         = new RTCPSenderReport(Ssrc, LastNtpTimestampSent, LastRtpTimestampSent, PacketsSentCount, OctetsSentCount, (rr != null) ? new List <ReceptionReportSample> {
                rr
            } : null);
            var sdesReport = new RTCPSDesReport(Ssrc, Cname);

            return(new RTCPCompoundPacket(senderReport, sdesReport));
        }