示例#1
0
        protected virtual void SelectReadSockets()
        {
            byte[] array  = null;
            byte[] buffer = null;
            try
            {
                if (this.AddRtpPacket != null)
                {
                    Socket.Select(this.RTPsockets, null, null, 1);
                    if (this.RTPsockets.Length != 0)
                    {
                        for (int i = 0; i < this.RTPsockets.Length; i++)
                        {
                            Socket socket = this.RTPsockets[i];
                            if (socket != null)
                            {
                                array = new byte[4096];
                                int newSize = socket.Receive(array);
                                Array.Resize <byte>(ref array, newSize);
                                RtpPacket packet = new RtpPacket(array);
                                this.AddRtpPacket(packet);
                            }
                        }
                    }
                }


                if (this.AddRTCPPacket != null)
                {
                    if (this.RTCPsockets != null)
                    {
                        Socket.Select(this.RTCPsockets, null, null, 1);
                        if (this.RTCPsockets.Length != 0)
                        {
                            for (int j = 0; j < this.RTCPsockets.Length; j++)
                            {
                                Socket socket2 = this.RTCPsockets[j];
                                if (socket2 != null)
                                {
                                    buffer = new byte[4096];
                                    int newSize2 = socket2.Receive(buffer);
                                    Array.Resize <byte>(ref buffer, newSize2);
                                    RtcpCompoundPacket rTCPCompoundPacket = new RtcpCompoundPacket();
                                    uint num = 0u;
                                    rTCPCompoundPacket.ParseData(buffer, ref num);
                                    this.AddRTCPPacket(rTCPCompoundPacket);
                                }
                            }
                        }
                    }
                }

                this.CreateSocketArrays();
            }
            catch
            {
                throw;
            }
        }
示例#2
0
        private void AddReceivedRTCPPacket(RtcpCompoundPacket packet)
        {
            string value = packet.ToString();

            Console.WriteLine(value);
        }