Пример #1
0
        /// <summary>
        /// Event handler for an RTCP packet being received from the remote party.
        /// </summary>
        /// <param name="remoteEndPoint">The end point the packet was received from.</param>
        /// <param name="buffer">The data received.</param>
        internal void ControlDataReceived(IPEndPoint remoteEndPoint, byte[] buffer)
        {
            try
            {
                var rtcpCompoundPacket = new RTCPCompoundPacket(buffer);

                if (rtcpCompoundPacket != null && rtcpCompoundPacket.SenderReport != null)
                {
                    if (m_receptionReport == null)
                    {
                        m_receptionReport = new ReceptionReport(rtcpCompoundPacket.SenderReport.SSRC);
                    }

                    m_receptionReport.RtcpSenderReportReceived(rtcpCompoundPacket.SenderReport.NtpTimestamp);

                    var sr = rtcpCompoundPacket.SenderReport;

                    logger.LogDebug($"Received RtcpSenderReport from {remoteEndPoint} pkts {sr.PacketCount} bytes {sr.OctetCount}");
                }
            }
            catch (Exception excp)
            {
                logger.LogError($"Exception RTCPSession.ControlDataReceived. {excp.Message}");
            }
        }
Пример #2
0
        /// <summary>
        /// Event handler for an RTCP packet being received from the remote party.
        /// </summary>
        /// <param name="remoteEndPoint">The end point the packet was received from.</param>
        /// <param name="buffer">The data received.</param>
        internal void ReportReceived(IPEndPoint remoteEndPoint, RTCPCompoundPacket rtcpCompoundPacket)
        {
            try
            {
                LastActivityAt = DateTime.Now;
                IsTimedOut     = false;

                if (rtcpCompoundPacket != null)
                {
                    if (rtcpCompoundPacket.SenderReport != null && m_receptionReport != null)
                    {
                        m_receptionReport.RtcpSenderReportReceived(DateTimeToNtpTimestamp(DateTime.Now));
                    }

                    // TODO: Apply information from report.
                    //if (rtcpCompoundPacket.SenderReport != null)
                    //{
                    //    if (m_receptionReport == null)
                    //    {
                    //        m_receptionReport = new ReceptionReport(rtcpCompoundPacket.SenderReport.SSRC);
                    //    }

                    //    m_receptionReport.RtcpSenderReportReceived(rtcpCompoundPacket.SenderReport.NtpTimestamp);

                    //    var sr = rtcpCompoundPacket.SenderReport;
                    //}

                    //if (rtcpCompoundPacket.ReceiverReport != null)
                    //{
                    //    var rr = rtcpCompoundPacket.ReceiverReport.ReceptionReports.First();
                    //}
                }
            }
            catch (Exception excp)
            {
                logger.LogError($"Exception RTCPSession.ReportReceived. {excp.Message}");
            }
        }