Exemple #1
0
        /// <summary>
        /// Sends an RTCP report to the remote agent.
        /// </summary>
        /// <param name="rtcpReport"></param>
        public void SendRTCPReport(RTCPReportTypesEnum reportType, byte[] reportData)
        {
            try
            {
                RTCPPacket rtcpPacket = new RTCPPacket(0, 0, 0, 0, 0);

                RTCPReportPacket rtcpReportPacket      = new RTCPReportPacket(reportType, reportData);
                byte[]           rtcpReportPacketBytes = rtcpReportPacket.GetBytes();
                byte[]           rtcpReportBytes       = rtcpPacket.GetBytes(rtcpReportPacketBytes);

                m_udpListener.Send(rtcpReportBytes, rtcpReportBytes.Length, m_streamEndPoint);
            }
            catch (Exception excp)
            {
                logger.Error("Exception SendRTCPReport. " + excp.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// Extract and load the RTCPReportHeader from packet.
        /// </summary>
        /// <param name="packet"></param>
        public RTCPReportHeader(byte[] packet)
        {
            if (packet.Length < HEADER_BYTES_LENGTH)
            {
                throw new ApplicationException("The packet did not contain the minimum number of bytes for an RTCP Report Header packet.");
            }

            if (BitConverter.IsLittleEndian)
            {
                ReportType = RTCPReportTypes.GetRTCPReportTypeForId(NetConvert.DoReverseEndian(BitConverter.ToUInt16(packet, 0)));
                Length     = NetConvert.DoReverseEndian(BitConverter.ToUInt16(packet, 2));
            }
            else
            {
                ReportType = RTCPReportTypes.GetRTCPReportTypeForId(BitConverter.ToUInt16(packet, 0));
                Length     = BitConverter.ToUInt16(packet, 2);
            }
        }
		/// <summary>
		/// Extract and load the RTCPReportHeader from packet.
		/// </summary>
		/// <param name="packet"></param>
		public RTCPReportHeader(byte[] packet)
		{
            if (packet.Length < HEADER_BYTES_LENGTH)
			{
				throw new ApplicationException("The packet did not contain the minimum number of bytes for an RTCP Report Header packet.");
			}

            if (BitConverter.IsLittleEndian)
            {
                ReportType = RTCPReportTypes.GetRTCPReportTypeForId(NetConvert.DoReverseEndian(BitConverter.ToUInt16(packet, 0)));
                Length = NetConvert.DoReverseEndian(BitConverter.ToUInt16(packet, 2));
            }
            else
            {
                ReportType = RTCPReportTypes.GetRTCPReportTypeForId(BitConverter.ToUInt16(packet, 0));
                Length = BitConverter.ToUInt16(packet, 2);
            }
		}
 public RTCPReportPacket(RTCPReportTypesEnum reportType, byte[] report)
 {
     Header = new RTCPReportHeader(reportType, Convert.ToUInt16(report.Length));
     Report = report;
 }
Exemple #5
0
        public UInt16 Length;                       // 16 bits.

        public RTCPReportHeader(RTCPReportTypesEnum reportType, ushort payloadLength)
        {
            ReportType = reportType;
            Length     = payloadLength;
        }
        }                                          // 16 bits.

        public RTCPHeader(RTCPReportTypesEnum packetType, int reportCount)
        {
            PacketType           = (ushort)packetType;
            ReceptionReportCount = reportCount;
        }
        public UInt16 Length;                       // 16 bits.

        public RTCPReportHeader(RTCPReportTypesEnum reportType, ushort payloadLength)
		{
            ReportType = reportType;
            Length = payloadLength;
        }
        public RTCPReportPacket(RTCPReportTypesEnum reportType, byte[] report)
		{
            Header = new RTCPReportHeader(reportType, Convert.ToUInt16(report.Length));
            Report = report;
		}
        /// <summary>
        /// Sends an RTCP report to the remote agent.
        /// </summary>
        /// <param name="rtcpReport"></param>
        public void SendRTCPReport(RTCPReportTypesEnum reportType, byte[] reportData)
        {
            try
            {
                RTCPPacket rtcpPacket = new RTCPPacket(0, 0, 0, 0, 0);

                RTCPReportPacket rtcpReportPacket = new RTCPReportPacket(reportType, reportData);
                byte[] rtcpReportPacketBytes = rtcpReportPacket.GetBytes();
                byte[] rtcpReportBytes = rtcpPacket.GetBytes(rtcpReportPacketBytes);

                m_udpListener.Send(rtcpReportBytes, rtcpReportBytes.Length, m_streamEndPoint);
            }
            catch (Exception excp)
            {
                logger.Error("Exception SendRTCPReport. " + excp.Message);
            }
        }