Exemplo n.º 1
0
 public virtual void AddParticipant(RtpParticipant participant)
 {
     lock (_objLock)
     {
         try
         {
             Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
             socket.Bind(participant.RTPEndpoint);
             ParticipantContainer participantContainer = new ParticipantContainer(participant, socket);
             this.participants.Add(participantContainer);
             this.CreateSocketArrays();
             if (participant.IsRTCPActive)
             {
                 Socket socket2 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                 socket2.Bind(participant.RTCPEndpoint);
                 participantContainer.RtcpSocket = socket2;
             }
         }
         catch
         {
         }
     }
 }
Exemplo n.º 2
0
        private void CreateSocketArrays()
        {
            if (this.RTPsockets != null)
            {
                this.RTPsockets = null;
            }
            this.RTPsockets = new Socket[this.participants.Count];
            if (this.RTCPsockets != null)
            {
                this.RTCPsockets = null;
            }
            this.RTCPsockets = new Socket[this.participants.Count];
            int num  = 0;
            int num2 = 0;

            foreach (var item in this.participants)
            {
                ParticipantContainer current = item;
                this.RTPsockets[(int)num] = current.RTPSocket;
                if (current.RtcpSocket != null)
                {
                    this.RTCPsockets[(int)num2] = current.RtcpSocket;
                    num2 += 1;
                }
                num += 1;
            }
            if (num2 == 0)
            {
                this.RTCPsockets = null;
                this.RTCPsockets = null;
            }
            else
            {
                Array.Resize <Socket>(ref this.RTCPsockets, (int)num2);
            }
        }