Esempio n. 1
0
        public static string Decode(byte[] bytes, ref int startIndex, int length, out int prefixLength)
        {
            int stringLength = bytes[startIndex++];

            prefixLength = bytes[startIndex++];

            return(RtcpString.Decode(stringLength, bytes, ref startIndex, length));
        }
Esempio n. 2
0
        public void Parse(byte[] bytes, ref int startIndex, int length, int count)
        {
            Ssrcs = new UInt32[count];
            for (int i = 0; i < Ssrcs.Length; i++)
            {
                Ssrcs[i] = bytes.BigendianToUInt32(ref startIndex);
            }

            if (startIndex < length)
            {
                Reason = RtcpString.Decode(bytes, ref startIndex, length);
            }
        }
Esempio n. 3
0
        public void Parse(byte[] bytes, ref int startIndex, int length, int count)
        {
            Chunks = new SourceDescriptionPacketChunk[count];

            for (int i = 0; i < Chunks.Length; i++)
            {
                UInt32 ssrc = bytes.BigendianToUInt32(ref startIndex);

                if (Enum.IsDefined(typeof(SourceDescriptionPacketChunk.ItemType), (int)bytes[startIndex]) == false)
                {
                    throw new ParseException(@"Invalid SourceDescriptionPacketChunk.ItemType value");
                }
                var itemType = (SourceDescriptionPacketChunk.ItemType)bytes[startIndex++];

                string value        = null;
                int    prefixLength = 0;
                if (itemType == SourceDescriptionPacketChunk.ItemType.Priv)
                {
                    value = RtcpString.Decode(bytes, ref startIndex, length, out prefixLength);
                }
                else
                {
                    value = RtcpString.Decode(bytes, ref startIndex, length);
                }

                Chunks[i] = new SourceDescriptionPacketChunk()
                {
                    Ssrc         = ssrc,
                    Type         = itemType,
                    Value        = value,
                    PrefixLength = prefixLength,
                };

                // Each chunk starts on a 32-bit boundary.
                startIndex += (startIndex % 4 > 0) ? 4 - startIndex % 4 : 0;
            }
        }
Esempio n. 4
0
 public static string Decode(byte[] bytes, ref int startIndex, int length)
 {
     return(RtcpString.Decode(bytes[startIndex++], bytes, ref startIndex, length));
 }