SIPSorcery.Net.RTPChannel.Start C# (CSharp) 메소드

Start() 공개 메소드

Starts listenting on the RTP and control ports.
public Start ( ) : void
리턴 void
        public void Start()
        {
            if (_rtpSocket != null && _controlSocket != null)
            {
                _startedAt = DateTime.Now;

                ThreadPool.QueueUserWorkItem(delegate { RTPReceive(); });
                ThreadPool.QueueUserWorkItem(delegate { ProcessRTPPackets(); });

                _controlSocketBuffer = new byte[RECEIVE_BUFFER_SIZE];
                _controlSocket.BeginReceive(_controlSocketBuffer, 0, _controlSocketBuffer.Length, SocketFlags.None, out _controlSocketError, ControlSocketReceive, null);
            }
            else
            {
                logger.Warn("An RTPChannel could not start as either RTP or control sockets were not available.");
            }
        }

Usage Example

예제 #1
0
        /// <summary>
        /// Initialises the RTP session state and starts the RTP channel UDP sockets.
        /// </summary>
        /// <param name="addrFamily">Whether the RTP channel should use IPv4 or IPv6.</param>
        /// <param name="isRtcpMultiplexed">If true RTCP reports will be multiplexed with RTP on a single channel.
        /// If false (standard mode) then a separate socket is used to send and receive RTCP reports.</param>
        private void InitialiseRtpChannel(AddressFamily addrFamily, bool isRtcpMultiplexed)
        {
            var channelAddress = (addrFamily == AddressFamily.InterNetworkV6) ? IPAddress.IPv6Any : IPAddress.Any;

            RtpChannel = new RTPChannel(channelAddress, !isRtcpMultiplexed);

            RtpChannel.OnRTPDataReceived += RtpPacketReceived;
            RtpChannel.OnClosed          += OnRTPChannelClosed;

            RtcpSession          = new RTCPSession(m_sessionStreams.First().Ssrc, RtpChannel, isRtcpMultiplexed);
            OnRtpPacketReceived += RtcpSession.RtpPacketReceived;
            RtpChannel.OnControlDataReceived += RtcpSession.ControlDataReceived;
            OnRtpPacketSent += RtcpSession.RtpPacketSent;

            // Start the RTP and Control socket receivers and the RTCP session.
            RtpChannel.Start();
            RtcpSession.Start();
        }
All Usage Examples Of SIPSorcery.Net.RTPChannel::Start