Start() public méthode

Starts listenting on the RTP and control ports.
public Start ( ) : void
Résultat void
Exemple #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();
        }
Exemple #2
0
        /// <summary>
        /// Initialises the RTP session state and starts the RTP channel UDP sockets.
        /// </summary>
        private void Initialise(AddressFamily addrFamily, ProtectRtpPacket srtcpProtect)
        {
            Ssrc   = Convert.ToUInt32(Crypto.GetRandomInt(0, Int32.MaxValue));
            SeqNum = Convert.ToUInt16(Crypto.GetRandomInt(0, UInt16.MaxValue));

            RtpChannel = new RTPChannel((addrFamily == AddressFamily.InterNetworkV6) ? IPAddress.IPv6Any : IPAddress.Any, true);

            MediaAnnouncement.Port        = RtpChannel.RTPPort;
            RtpChannel.OnRTPDataReceived += RtpPacketReceived;
            RtpChannel.OnClosed          += OnRTPChannelClosed;

            RtcpSession          = new RTCPSession(Ssrc, RtpChannel, srtcpProtect);
            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();
        }
Exemple #3
0
        /// <summary>
        /// Creates a new RTP session. The synchronisation source and sequence number are initialised to
        /// pseudo random values.
        /// </summary>
        /// <param name="mediaType">The default media type for this RTP session. If media multiplexing
        /// is being used additional streams can be added by calling AddStream.</param>
        /// <param name="payloadTypeID">The payload type ID for this RTP stream. It's what gets set in the payload
        /// type ID field in the RTP header.</param>
        /// <param name="addrFamily">Determines whether the RTP channel will use an IPv4 or IPv6 socket.</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>
        /// <param name="isSecure">If true indicated this session is using SRTP to encrypt and authorise
        /// RTP and RTCP packets. No communications or reporting will commence until the
        /// is explicitly set as complete.</param>
        public RTPSession(
            SDPMediaTypesEnum mediaType,
            int payloadTypeID,
            AddressFamily addrFamily,
            bool isRtcpMultiplexed,
            bool isSecure)
        {
            m_isRtcpMultiplexed = isRtcpMultiplexed;
            IsSecure            = isSecure;

            var channelAddress = (addrFamily == AddressFamily.InterNetworkV6) ? IPAddress.IPv6Any : IPAddress.Any;

            RtpChannel = new RTPChannel(channelAddress, !isRtcpMultiplexed);

            RtpChannel.OnRTPDataReceived     += OnReceive;
            RtpChannel.OnControlDataReceived += OnReceive; // RTCP packets could come on RTP or control socket.
            RtpChannel.OnClosed += OnRTPChannelClosed;

            // Start the RTP, and if required the Control, socket receivers and the RTCP session.
            RtpChannel.Start();

            AddStream(mediaType, payloadTypeID, null);
        }