コード例 #1
0
ファイル: RtcpData.cs プロジェクト: tdhieu/openvss
        private void WritePropertyToBuffer(Rtcp.SDESType type, byte[] data, BufferChunk buffer)
        {
            if(data != null)
            {
                // Type
                buffer += (byte)type;

                // Length
                buffer += (byte)data.Length;

                // Data
                if(data.Length != 0)
                {
                    buffer += data;
                }
            }
        }
コード例 #2
0
ファイル: RtcpData.cs プロジェクト: tdhieu/openvss
        private string GetProperty(Rtcp.SDESType type)
        {
            string ret = null;

            if(data[(int)type] != null)
            {
                lock(utf8)
                {
                    ret = utf8.GetString(data[(int)type]);
                }
            }

            return ret;
        }
コード例 #3
0
ファイル: RtpSession.cs プロジェクト: tdhieu/openvss
        /// <summary>
        /// SendAppPacket is used to send application specific data to all other RtpListeners on the network.
        /// </summary>
        /// <param name="name">4 ASCII characters</param>
        /// <param name="subtype">0 to 31, app specific "type of data"</param>
        /// <param name="data">data is size sensitive, the total size of the packet cannot exceed 255 bytes</param>
        public void SendAppPacket(uint ssrc, string name, byte subtype, byte[] data, Rtcp.RtcpInterval when)
        {
            if(participant == null)
            {
                throw new RtcpSendingDisabledException("SendAppPacket not allowed in Rtcp " +
                    "listening only mode.");
            }

            // Add the packet to the AppPacket queue
            cpb.Add_APPReport(ssrc, name, subtype, data);

            if(when == Rtcp.RtcpInterval.Now)
            {
                rtcpSender.SendRtcpDataNow();
            }
        }
コード例 #4
0
ファイル: RtcpData.cs プロジェクト: tdhieu/openvss
        /// <summary>
        /// ---------------------------------------------------------------------------------------
        /// Purpose:
        /// ---------------------------------------------------------------------------------------
        /// Make sure the data will fit in the 255 bytes (length == 1 byte == byte.MaxValue) 
        /// available to it when converted to UTF8 for transmission across the wire
        /// 
        /// ---------------------------------------------------------------------------------------
        /// General structure of an SDES property:
        /// ---------------------------------------------------------------------------------------
        ///  0                   1                   2                   3
        ///  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
        /// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        /// |     SDES=N    |     length    |        data                 ...
        /// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        /// </summary>
        /// <param name="data"></param>
        private void SetProperty(string data, Rtcp.SDESType type)
        {
            byte[] bytes = null;

            if(data != null)
            {
                lock(utf8)
                {
                    bytes = utf8.GetBytes(data);
                }

                // Check to see if it is too long
                if (bytes.Length > MAX_PROPERTY_LENGTH)
                {
                    throw new ArgumentException(string.Format("An SDES item's data can not exceed " +
                        "{0} UTF8 bytes: {1}, {2}",
                        MAX_PROPERTY_LENGTH, bytes.Length, data));
                }
            }

            this.data[(int)type] = bytes;
        }
コード例 #5
0
ファイル: RtcpPacket.cs プロジェクト: tdhieu/openvss
 /// <summary>
 /// Constructor which initializes header for use by derived packets
 /// </summary>
 protected RtcpPacket(Rtcp.PacketType type)
 {
     header = new RtcpHeader((byte)type);
 }