Exemplo n.º 1
0
        public static string GetCodec(this SDP sdp, string MediaType)
        {
            string codec = string.Empty;

            MediaDescription description = sdp.Session.GetMediaDescriptionByName(MediaType);

            string attribute = description.GetAttributeValueByName("rtpmap");

            if (string.IsNullOrEmpty(attribute) == false)
            {
                string[] split = attribute.Split(' ');
                if (split.Length == 2)
                {
                    string[] values = split[1].Split('/');
                    codec = values[0];
                }
            }
            return(codec);
        }
Exemplo n.º 2
0
        public static int GetSampleRate(this SDP sdp, string MediaType)
        {
            int result = int.MaxValue;

            MediaDescription description = sdp.Session.GetMediaDescriptionByName(MediaType);

            string attribute = description.GetAttributeValueByName("rtpmap");

            if (string.IsNullOrEmpty(attribute) == false)
            {
                string[] split = attribute.Split(' ');
                if (split.Length == 2)
                {
                    string[] values = split[1].Split('/');
                    string   str    = values[1];

                    int.TryParse(str, out result);
                }
            }

            return(result);
        }