Example #1
0
        /// <summary>
        /// This method is called to update the local data from another SdesData
        /// </summary>
        /// <param name="data">what we want to update our data to</param>
        /// <returns>true if the local data was updated, otherwise false</returns>
        internal bool UpdateData(SdesData sdes)
        {
            bool ret = false;

            // Well-known properties
            // CName can never be updated, so start with Name
            for (int id = (int)Rtcp.SDESType.NAME; id <= (int)Rtcp.SDESType.NOTE; id++)
            {
                if (!BufferChunk.Compare(data[id], sdes.data[id]))
                {
                    data[id] = BufferChunk.Copy(sdes.data[id]);
                    ret      = true;
                }
            }

            // Write private properties
            foreach (DictionaryEntry de in sdes.privs)
            {
                byte[] key  = (byte[])de.Key;
                byte[] data = (byte[])de.Value;

                if (!privs.Contains(key) || !BufferChunk.Compare(data, privs[key]))
                {
                    privs[BufferChunk.Copy(key)] = BufferChunk.Copy(data);
                    ret = true;
                }
            }

            return(ret);
        }