Exemple #1
0
        static void Main(string[] args)
        {
            RtpParticipant part = new RtpParticipant("*****@*****.**", "SENDER");

            RtpSession session = new RtpSession(ip, part, true, true);
            session.PacketTransform = new EncryptionTransform("You are a big freak!");
            //session.PacketTransform = new XorTransform();


            RtpSender sender = session.CreateRtpSender("My sender", PayloadType.Test, null);

            Stream fs = File.OpenRead("data.txt");
            int length = (int)fs.Length;
            Console.Out.WriteLine("Opening file of length: " + length);

            byte[] buffer = new byte[length];

            int bytesRead = 0;
            while (bytesRead < length)
            {
                bytesRead += fs.Read(buffer, bytesRead, Math.Min(16384, (length - bytesRead)));
            }

            for (int i = 0; i < 5; i++)
            {
                Console.Out.WriteLine("Sending buffer to address: " + ip);

                sender.Send(buffer);

                Thread.Sleep(1000);
            }

        }
 public RTPReceiveConnection(IPEndPoint ip, NetworkArchiver na)
 {
     RtpEvents.RtpStreamAdded += new MSR.LST.Net.Rtp.RtpEvents.RtpStreamAddedEventHandler(this.handleRtpStreamAdded);
     RtpEvents.RtpStreamRemoved += new MSR.LST.Net.Rtp.RtpEvents.RtpStreamRemovedEventHandler(this.handleRtpStreamRemoved);
     this.m_Participant = new RtpParticipant("Recorder", "Recorder");
     this.m_Session = new RtpSession(ip, this.m_Participant, true, true);
     this.m_archiver = na;
 }
Exemple #3
0
        private void InitializeNetwork()
        {
            RtpEvents.ReceiverReport         += new RtpEvents.ReceiverReportEventHandler(RtpReceiverReport);
            RtpEvents.DuplicateCNameDetected += new RtpEvents.DuplicateCNameDetectedEventHandler(DuplicateCNameDetected);

            // Create participant
            rtpParticipant = new RtpParticipant(cName, name);
            rtpParticipant.SetTool(true);

            // Create session with Participant and Rtp data
            rtpSession = new RtpSession(new IPEndPoint(IPAddress.Parse(ipAddress), port), rtpParticipant, true, true);

            // Create RtpSender
            rtpSender = rtpSession.CreateRtpSender(HostName, PayloadType.PipecleanerSignal, null);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            RtpEvents.RtpStreamAdded += new RtpEvents.RtpStreamAddedEventHandler(OnNewRtpStream);


            RtpParticipant part = new RtpParticipant("*****@*****.**", "Receiver");

            session = new RtpSession(ip, part, true, true);
            //session.PacketTransform = new XorTransform();
            session.PacketTransform = new EncryptionTransform("You are a big freak!");

            // make sure this thing doesn't terminate
            while (true)
            {
                Thread.Sleep(10000);
            }
        }
        public void Play( IPEndPoint venue, int[] streams, bool receiveData )
        {
            if( this.playing )
                throw new InvalidOperationException("ConferencePlayer::Play called when the player is already playing.");
            if( streams == null )
                throw new ArgumentNullException("streams cannot be null");

            venueIPE = venue;

            // Create an RtpSession
            RtpParticipant me = new RtpParticipant(Constants.PersistenceCName, Constants.PersistenceName + " (Playing)");
            rtpSession = new RtpSession(venue, me, true, receiveData);

            // Hook the static stream-ended event
            StreamPlayer.EndOfStreamReached += new EventHandler(EndOfStreamReached);

            // Create a new perf counter for this ConferencePlayer instance
            this.perfCounter = new ConferencePlayerPC(venue.ToString());

            // Keep track of the streamPlayers
            ArrayList avStreams = new ArrayList();
            ArrayList otherStreams = new ArrayList();

            // Find the first stored ticks of all the streams while creating them...
            this.firstStoredTick = long.MaxValue;

            // Create all of our StreamPlayers (one per stream...)
            for ( int i = 0; i < streams.Length; i++)
            {
                StreamPlayer newStream = null;

                try
                {
                    newStream = new StreamPlayer(rtpSession, streams[i], perfCounter);
                }
                catch( Exception ex )
                {
                    eventLog.WriteEntry(String.Format("Stream with bad data reached.  Continuing playback of all other streams."
                        + "  Stream ID: {0}.  Exception: \n {1}", streams[i], ex.ToString()),
                        EventLogEntryType.Warning, ArchiveServiceEventLog.ID.BadStreamInDB);
                }

                if( newStream != null )
                {
                    perfCounter.AddInstanceForCollection( newStream );

                    if( newStream.FirstStreamsTicks < this.firstStoredTick )
                        this.firstStoredTick = newStream.FirstStreamsTicks;

                    // Add the new StreamPlayer to the right collection
                    // Pri3: Consider other methods here.  Maybe a smarter detection of large frame sizes,
                    //  or initializing the stream so it has enough packets ahead of time?
                    if( newStream.Payload == PayloadType.dynamicAudio || newStream.Payload == PayloadType.dynamicVideo )
                        avStreams.Add(newStream);
                    else // RTDocs stream or other large-payload stream, most likely
                        otherStreams.Add(newStream);
                }
            }

            // Start the StreamsGroupPlayers
            // Pri2: Change this to be compatable with use of the "playback speed" feature.
            long startTime = DateTime.Now.Ticks + 1500*Constants.TicksPerMs; // we'll start in 1.5 seconds (for init time)

            // Create the StreamsGroupPlayer(s)
            avPlayer = new StreamsGroupPlayer(avStreams, this.firstStoredTick, startTime);
            otherPlayer = new StreamsGroupPlayer(otherStreams, this.firstStoredTick, startTime);

            this.playing = true;
        }
Exemple #6
0
        private void AddParticipant(uint ssrc, RtpParticipant participant)
        {
            lock(participants)
            {
                // Update collections
                participants.Add(participant.CName, participant);
                participant.SSRC = ssrc;
                ssrcToParticipant.Add(ssrc, participant);

                // Raise event
                RaiseParticipantAddedEvent(participant);
            }
        }
Exemple #7
0
        /// <summary>
        /// This constructor is the same as "RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData)",
        /// except that it is capable of using a Unicast-Multicast reflector.
        /// </summary>
        /// <param name="multicastEP"></param>
        /// <param name="participant"></param>
        /// <param name="rtpTraffic"></param>
        /// <param name="reflectorEPArg">The IP address and port number of the reflector</param>
        public RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData, IPEndPoint reflectorEP)
        {
            #region Parameter Validation

            if(multicastEP == null)
            {
                throw new ArgumentNullException("multicastEP");
            }

            // A null participant is a special state for diagnostic purposes
            // The rtpTraffic flag must be false in order to be consistent
            if(participant == null && rtpTraffic)
            {
                throw new ArgumentException("Incompatible arguments - participant(null), rtpTraffic(true)");
            }

            if(!receiveData && (participant != null || !rtpTraffic))
            {
                throw new ArgumentException("Incompatible arguemtns; you must specify a participant and"
                    + "intend to send RTP traffic if you are not receiving data.");
            }

            if (reflectorEP == null)
            {
                throw new ArgumentNullException("ReflectorEP not set properly");
            }

            #endregion Parameter Validation

            Utility.multicastIP = multicastEP.Address;

            // Use the reflector as a Unicast EndPoint
            this.multicastEP = reflectorEP;

            // Same as the "old" three argument constructor ...
            this.participant = participant;
            this.rtpTraffic = rtpTraffic;
            this.receiveData = receiveData;

            // Initialize threads, perf counters, network, etc.
            Initialize();
        }
Exemple #8
0
        /// <summary>
        /// Removes a participant and does all the necessary cleanup of streams and associations
        /// </summary>
        /// <param name="participant"></param>
        private void RemoveParticipant(RtpParticipant participant)
        {
            lock(participants)
            {
                if(participants.Contains(participant.CName))
                {
                    foreach(uint ssrc in participant.SSRCs)
                    {
                        if(streamsAndIPs.GetStream(ssrc) != null)
                        {
                            RemoveSSRC(ssrc);
                        }

                        participant.RemoveSSRC(ssrc);
                        ssrcToParticipant.Remove(ssrc);
                    }

                    participants.Remove(participant.CName);
                    ssrcToParticipant.Remove(participant.SSRC);

                    RaiseParticipantRemovedEvent(participant);
                }
            }
        }
        private void InitializeNetwork()
        {
            RtpEvents.ReceiverReport            += new RtpEvents.ReceiverReportEventHandler(RtpReceiverReport);
            RtpEvents.DuplicateCNameDetected    += new RtpEvents.DuplicateCNameDetectedEventHandler(DuplicateCNameDetected);

            // Create participant
            rtpParticipant = new RtpParticipant(cName, name);
            rtpParticipant.SetTool(true);

            // Create session with Participant and Rtp data
            rtpSession = new RtpSession(new IPEndPoint(IPAddress.Parse(ipAddress), port), rtpParticipant, true, true);

            // Create RtpSender
            rtpSender = rtpSession.CreateRtpSender(HostName, PayloadType.PipecleanerSignal, null, null);
        }
 public ParticipantWrapper( RtpParticipant participant, int id)
 {
     this.participant = participant;
     participantID = id;
 }
 private void JoinRtpSession()
 {
     RtpParticipant participant = new RtpParticipant("Video" + pb1.Handle.ToInt32(), "Video");
     rtpSession = new RtpSession(ep, participant, true, true);
 }
        internal void Receive(object data, RtpParticipant rtpParticipant)
        {
            //Drop messages received from the local node
            if (this.m_Capability.RtpSender.RtcpProperties.CName.Equals(rtpParticipant.CName)) {
                return;
            }

            //If this is the first message from a given node, attempt to create the receiver for it.
            if (!this.m_Receivers.ContainsKey(rtpParticipant.CName)) {
                if (data is CapabilityMessageWrapper) {
                    Guid sender_id = ((CapabilityMessageWrapper)data).SenderId;
                    bool sender_is_instructor = ((CapabilityMessageWrapper)data).SenderIsInstructor;
                    ParticipantModel participant = new ParticipantModel(sender_id, rtpParticipant.Name);
                    m_Participants.Add(rtpParticipant.CName, participant);

                    //Add to classroom if the local node is instructor
                    if (m_Capability.IsSender) {
                        using (Synchronizer.Lock(m_Classroom.SyncRoot)) {
                            this.m_Classroom.Participants.Add(participant);
                        }
                    }
                    this.m_SsrcToSenderId.Add(rtpParticipant.SSRC, sender_id);
                    this.m_Receivers.Add(rtpParticipant.CName, new CXPCapabilityMessageReceiver(this, rtpParticipant.SSRC, m_Model, m_Classroom, participant));

                    //Set the Network Association only if local node is not an instructor, and the remote node is Instructor.
                    if ((!m_Capability.IsSender) && (sender_is_instructor)) {
                        m_AssociationCname = rtpParticipant.CName;
                        using (Synchronizer.Lock(this.m_Model.Network.SyncRoot)) {
                            this.m_Model.Network.Association = participant;
                        }
                    }

                    //Debug.WriteLine("Created new receiver on message receipt: ssrc=" + rtpParticipant.SSRC.ToString() + ";cname=" + rtpParticipant.CName);
                }
                else {
                    //Trace.WriteLine("Dropping message of type " + data.GetType().ToString() + " from " + rtpParticipant.CName + " because we don't yet have the sender's Guid.");
                    return;
                }
            }
            this.m_Receivers[rtpParticipant.CName].Receive(data);
        }
Exemple #13
0
        /// <summary>
        /// This constructor is the same as "RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData)",
        /// except that it is capable of using a Unicast-Multicast reflector.
        /// </summary>
        /// <param name="multicastEP"></param>
        /// <param name="participant"></param>
        /// <param name="rtpTraffic"></param>
        /// <param name="reflectorEPArg">The IP address and port number of the reflector</param>
        public RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData, IPEndPoint reflectorEP)
        {
            #region Parameter Validation

            if(multicastEP == null)
            {
                throw new ArgumentNullException("multicastEP");
            }

            // A null participant is a special state for diagnostic purposes
            // The rtpTraffic flag must be false in order to be consistent
            if(participant == null && rtpTraffic)
            {
                throw new ArgumentException(Strings.IncompatibleArgumentsStatus);
            }

            if(!receiveData && (participant != null || !rtpTraffic))
            {
                throw new ArgumentException(Strings.IncompatibleArgumentsMessageShort);
            }
            
            if (reflectorEP == null)
            {
                throw new ArgumentNullException(Strings.ReflectorEPNotSetProperly);
            }

            #endregion Parameter Validation

            Utility.multicastIP = multicastEP.Address;

            // Use the reflector as a Unicast EndPoint
            this.nextHopEP = reflectorEP;
            this.groupEP = multicastEP;

            // Same as the "old" three argument constructor ...
            this.participant = participant;
            this.rtpTraffic = rtpTraffic;
            this.receiveData = receiveData;
                       
            // Initialize threads, perf counters, network, etc.
            Initialize();
        }
Exemple #14
0
        /// <summary>
        /// The RtpSession can be in 1 of 4 states:
        /// 
        /// 1. Sending/Receiving Rtp + Rtcp traffic - this is what most users want
        /// 2. Sending/Receiving Rtcp traffic - used mainly by diagnostic tools for discovery of 
        ///     people while also announcing the local user
        /// 3. Receiving Rtcp traffic only - a special diagnostic case used by Pipecleaner to 
        ///     discover if an Agent is already running.
        /// 4. Sending Rtp + Rtcp traffic - a rare case only used for sending test data or
        ///     for "playback" of data in a scenario where SSRC and CNAME conflicts aren't of
        ///     interest to the sender.  THIS SHOULD ONLY BE USED IN EXCEPTIONAL CASES.
        /// 
        /// -If no participant is provided (null), then RtpSession cannot send Rtp or Rtcp data (state 3)
        /// -Else a valid participant is provided and Rtcp traffic can be sent (states 1, 2, or 4)
        ///    -If rtpTraffic is true, then Rtp traffic is sent and/or received (state 1 or 4)
        ///       -If receiveData is true, then Rtp traffic is received as well as sent (state 1)
        ///       -Else Rtp and Rtcp traffic are not received (state 4)
        ///    -Else rtpTraffic is neither sent nor received (state 2)
        /// </summary>
        /// <remarks>
        /// Note that receiving Rtp data without sending Rtcp data is seen as a privacy concern and is not allowed.
        /// </remarks>
        /// <param name="multicastEP">Rtp endpoint, Rtcp endpoint will be derived from it</param>
        /// <param name="participant">Person joining the session</param>
        /// <param name="rtpTraffic">Flag indicating whether or not to monitor or allow sending of Rtp traffic</param>
        /// <param name="receiveData">Flag indicating whether or not to monitor any incoming data</param>
        public RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData)
        {
            #region Parameter Validation

            if(multicastEP == null)
            {
                throw new ArgumentNullException("multicastEP");
            }

            // A null participant is a special state for diagnostic purposes
            // The rtpTraffic flag must be false in order to be consistent
            if(participant == null && rtpTraffic)
            {
                throw new ArgumentException(Strings.IncompatibleArgumentsStatus);
            }

            if(!receiveData && (participant == null || !rtpTraffic))
            {
                throw new ArgumentException(Strings.IncompatibleArgumentsMessageLong);
            }

            #endregion Parameter Validation

            Utility.multicastIP = multicastEP.Address;

            // Store parameters
            this.nextHopEP = multicastEP;
            this.groupEP = multicastEP;
            this.participant = participant;
            this.rtpTraffic = rtpTraffic;
            this.receiveData = receiveData;
            
            // Initialize threads, perf counters, network, etc.
            Initialize();
        }
Exemple #15
0
 public RtpParticipantEventArgs(RtpParticipant participant)
 {
     RtpParticipant = participant;
 }
        /// <summary>
        /// Starts recording a conference. Sets up the conference data and then records all streams received until told to stop.
        /// </summary>
        public void RecordConference( string conferenceDescription, string venueIdentifier, IPEndPoint venue )
        {
            if( conferenceDescription.Length >= Constants.MaxDBStringSize || venueIdentifier.Length >= Constants.MaxDBStringSize )
                throw new ArgumentException("String longer than accepted by database.");

            recording = true;
            venueIPE = venue;

            streams = new Hashtable(Constants.InitialStreams);
            participants = new Hashtable();

            conferenceID = DBHelper.CreateConference( conferenceDescription, venueIdentifier, DateTime.Now);

            // Store info about this conference to the instance, for debugging reference (mostly)
            this.conferenceDescription  = conferenceDescription;
            this.venueIdentifier = venueIdentifier;
            this.venue = venue;

            // Create our performance counter
            perfCounter = new ConferenceRecorderPC( venueIdentifier + " : " + conferenceDescription );

            // Set up RTCP properties
            RtpEvents.RtpParticipantAdded += new MSR.LST.Net.Rtp.RtpEvents.RtpParticipantAddedEventHandler(this.OnNewRtpParticipant);
            RtpEvents.RtpStreamAdded += new MSR.LST.Net.Rtp.RtpEvents.RtpStreamAddedEventHandler(this.OnNewRtpStream);
            RtpEvents.RtpStreamRemoved += new MSR.LST.Net.Rtp.RtpEvents.RtpStreamRemovedEventHandler(this.OnRtpStreamRemoved);

            // Start listening
            RtpParticipant rtpMe = new RtpParticipant(Constants.PersistenceCName, Constants.PersistenceName + " (RECORDING)");
            rtpSession = new RtpSession(venue, rtpMe, true, true);
        }
 public RTPSendConnection(IPEndPoint ipe)
 {
     this.m_Participant = new RtpParticipant(Guid.NewGuid().ToString(), "Classroom Playback");
     this.m_Session = new RtpSession(ipe, this.m_Participant, true, false);
     this.m_Sender = this.m_Session.CreateRtpSenderFec("Classroom Presenter", PayloadType.dynamicPresentation, null, 0, 100);
     this.m_Queue = new SendingQueue(this);
 }
Exemple #18
0
        /// <summary>
        /// Join the Venue and start participating.  AutoSend default devices if AutoSend == true
        /// </summary>
        public static void JoinVenue(IVenue venue)
        {
            lock(venue)
            {
                if (Conference.ActiveVenue != null)
                {
                    throw new InvalidOperationException("Cannot join a venue when already joined to a venue.");
                }

                if (venue.VenueData.VenueType == VenueType.Invalid)
                {
                    throw new ArgumentException("Can not join a venue that is of type Invalid");
                }

                // (pfb) Why are we checking this here?  When would it happen?
                if (rtpSession == null)
                {
                    // Do this first, or else the locks in the eventHandlers will throw, due to null argument
                    Conference.activeVenue = venue;

                    HookRtpEvents();

                    #region Start the RtpSession
                    try
                    {
                        // Pri3: Add casting of a Participant to an RtpParticipant
                        Participant p = Conference.LocalParticipant;
                        RtpParticipant rp = new RtpParticipant(p.Identifier, p.Name);
                        rp.Email = p.Email;
                        rp.Location = Conference.Location;
                        rp.Phone = p.Phone;

                        if (Conference.ReflectorEnabled && MSR.LST.Net.Utility.IsMulticast(venue.EndPoint))
                        {
                            IPEndPoint refEP;
                            IPAddress reflectorIP;
                            int unicastPort;

                            // Resolve the reflector address
                            try
                            {
                                reflectorIP = System.Net.Dns.GetHostEntry(
                                    Conference.ReflectorAddress).AddressList[0];
                            }
                            catch(Exception e)
                            {
                                throw new Exception("Reflector address not found - "
                                    + Conference.ReflectorAddress, e);
                            }

                            // Send a join request to the reflector and receive the RTP unicast port back
                            regClient = new RegistrarClient(reflectorIP, Conference.ReflectorJoinPort);
                            try
                            {
                                unicastPort = regClient.join(venue.EndPoint.Address, venue.EndPoint.Port);
                            }
                            catch(Exception e)
                            {
                                throw new Exception("Reflector join request failed", e);
                            }

                            refEP = new IPEndPoint(reflectorIP, unicastPort);

                            rtpSession = new RtpSession(venue.EndPoint, rp, true, true, refEP);
                        }
                        else
                        {
                            rtpSession = new RtpSession(venue.EndPoint, rp, true, true);
                        }
                    }
                    catch (System.Net.Sockets.SocketException se)
                    {
                        eventLog.WriteEntry(se.ToString(), EventLogEntryType.Error, 99);
                        LeaveVenue();

                        if (se.ErrorCode == 10013)
                        {
                            throw new Exception("A security error occurred connecting to the network "
                                + "(WSAEACCES).  Common causes of this error are; no network "
                                + "connection can be found, a change to the .NET Framework or "
                                + "Winsock without a reboot, or recently disconnecting from a "
                                + "VPN session which leaves Winsock in an indeterminate state.  "
                                + "Check your network connectivity or reboot your computer and try "
                                + "again.");
                        }
                        else
                        {
                            throw;
                        }
                    }
                    catch (Exception e)
                    {
                        eventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 99);
                        LeaveVenue();
                        throw;
                    }

                    #endregion
                }
            }
        }
Exemple #19
0
 public void ParticipantData(RtpParticipant participant)
 {
     this.participant = participant;
 }
Exemple #20
0
 public void Add(string cName, RtpParticipant rtpParticipant)
 {
     Dictionary.Add(cName, rtpParticipant);
 }
Exemple #21
0
 private void RaiseParticipantTimeoutEvent(RtpParticipant participant)
 {
     object[] args = {this, new RtpEvents.RtpParticipantEventArgs(participant)};
     EventThrower.QueueUserWorkItem(new RtpEvents.RaiseEvent(RtpEvents.RaiseRtpParticipantTimeoutEvent), args);
 }
Exemple #22
0
 public void Add(uint ssrc, RtpParticipant participant)
 {
     Dictionary.Add(ssrc, participant);
 }
Exemple #23
0
        /// <summary>
        /// The RtpSession can be in 1 of 4 states:
        /// 
        /// 1. Sending/Receiving Rtp + Rtcp traffic - this is what most users want
        /// 2. Sending/Receiving Rtcp traffic - used mainly by diagnostic tools for discovery of 
        ///     people while also announcing the local user
        /// 3. Receiving Rtcp traffic only - a special diagnostic case used by Pipecleaner to 
        ///     discover if an Agent is already running.
        /// 4. Sending Rtp + Rtcp traffic - a rare case only used for sending test data or
        ///     for "playback" of data in a scenario where SSRC and CNAME conflicts aren't of
        ///     interest to the sender.  THIS SHOULD ONLY BE USED IN EXCEPTIONAL CASES.
        /// 
        /// -If no participant is provided (null), then RtpSession cannot send Rtp or Rtcp data (state 3)
        /// -Else a valid participant is provided and Rtcp traffic can be sent (states 1, 2, or 4)
        ///    -If rtpTraffic is true, then Rtp traffic is sent and/or received (state 1 or 4)
        ///       -If receiveData is true, then Rtp traffic is received as well as sent (state 1)
        ///       -Else Rtp and Rtcp traffic are not received (state 4)
        ///    -Else rtpTraffic is neither sent nor received (state 2)
        /// </summary>
        /// <remarks>
        /// Note that receiving Rtp data without sending Rtcp data is seen as a privacy concern and is not allowed.
        /// </remarks>
        /// <param name="multicastEP">Rtp endpoint, Rtcp endpoint will be derived from it</param>
        /// <param name="participant">Person joining the session</param>
        /// <param name="rtpTraffic">Flag indicating whether or not to monitor or allow sending of Rtp traffic</param>
        /// <param name="receiveData">Flag indicating whether or not to monitor any incoming data</param>
        public RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData)
        {
            #region Parameter Validation

            if(multicastEP == null)
            {
                throw new ArgumentNullException("multicastEP");
            }

            // A null participant is a special state for diagnostic purposes
            // The rtpTraffic flag must be false in order to be consistent
            if(participant == null && rtpTraffic)
            {
                throw new ArgumentException("Incompatible arguments - participant(null), rtpTraffic(true)");
            }

            if(!receiveData && (participant == null || !rtpTraffic))
            {
                throw new ArgumentException("Incompatible arguments; you must specify a participant and "
                    + "intend to send RTP traffic if you are not receiving data.  Sending Rtcp data only "
                    + "is not a valid use case.");
            }

            #endregion Parameter Validation

            Utility.multicastIP = multicastEP.Address;

            // Store parameters
            this.multicastEP = multicastEP;
            this.participant = participant;
            this.rtpTraffic = rtpTraffic;
            this.receiveData = receiveData;

            // Initialize threads, perf counters, network, etc.
            Initialize();
        }
Exemple #24
0
 public void Add(uint ssrc, RtpParticipant participant)
 {
     Dictionary.Add(ssrc, participant);
 }
Exemple #25
0
 internal void RaiseParticipantRemovedEvent(RtpParticipant participant)
 {
     object[] args = {this, new RtpEvents.RtpParticipantEventArgs(participant)};
     EventThrower.QueueUserWorkItem(new RtpEvents.RaiseEvent(RtpEvents.RaiseRtpParticipantRemovedEvent), args);
 }
Exemple #26
0
 public void Add(string cName, RtpParticipant rtpParticipant)
 {
     Dictionary.Add(cName, rtpParticipant);
 }
Exemple #27
0
 public RtpParticipantEventArgs(RtpParticipant participant)
 {
     RtpParticipant = participant;
 }
Exemple #28
0
        /// <summary>
        /// Join the Venue and start participating.  AutoSend default devices if AutoSend == true
        /// The optional password is used generate a symmetric encryption key...
        /// </summary>
        public static void JoinVenue(IVenue venue,String password)
        {
            foreach (Participant p in participants.Values) {
                //If there was an active warning on the local particpant at the time of the 
                //previous venue leave, it needs to be cleaned up.
                p.ThroughputWarnings.Clear();
            }

            lock(venue)
            {
                if (Conference.ActiveVenue != null)
                {
                    throw new InvalidOperationException(Strings.AlreadyJoinedToVenue);
                }

                if (venue.VenueData.VenueType == VenueType.Invalid)
                {
                    throw new ArgumentException(Strings.InvalidVenueType);
                }

                // (pfb) Why are we checking this here?  When would it happen?
                if (rtpSession == null)
                {
                    // Do this first, or else the locks in the eventHandlers will throw, due to null argument
                    Conference.activeVenue = venue;
                    
                    HookRtpEvents();

                    #region Start the RtpSession
                    try
                    {
                        // Pri3: Add casting of a Participant to an RtpParticipant
                        Participant p = Conference.LocalParticipant;
                        RtpParticipant rp = new RtpParticipant(p.Identifier, p.Name);
                        rp.Email = p.Email;
                        rp.Location = Conference.Location;
                        rp.Phone = p.Phone;

                        if (Conference.ReflectorEnabled && MSR.LST.Net.Utility.IsMulticast(venue.EndPoint))
                        {
                            IPEndPoint refEP;
                            IPAddress reflectorIP;
                            
                            // Resolve the reflector address
                            try
                            {
                                reflectorIP = System.Net.Dns.GetHostEntry(
                                    Conference.ReflectorAddress).AddressList[0];
                            }
                            catch(Exception e)
                            {
                                //Starting with .Net 4, passing an IP address to GetHostEntry excepts.  We'll check
                                //here to see if the user entered an IP address before rethowing.
                                if (!IPAddress.TryParse(Conference.ReflectorAddress, out reflectorIP)) {
                                    throw new Exception(string.Format(CultureInfo.CurrentCulture,
                                        Strings.ReflectorAddressNotFound, Conference.ReflectorAddress), e);
                                }
                            }

                            // andrew: reflector registation is now done via UDP, and has been
                            // pushed down into UDPListener...

                            refEP = new IPEndPoint(reflectorIP, ReflectorRtpPort);

                            StartDiagnosticMonitor(venue.Name, venue.EndPoint);
                            
                            rtpSession = new RtpSession(venue.EndPoint, rp, true, true, refEP);
                            if (password != null)
                            {
                                PacketTransform xform = MakePacketTransform(password);
                                rtpSession.PacketTransform = xform;
                            }
                        } 
                        else
                        {
                            StartDiagnosticMonitor(venue.Name, venue.EndPoint);
                            
                            rtpSession = new RtpSession(venue.EndPoint, rp, true, true);
                            if (password != null)
                            {
                                PacketTransform xform = MakePacketTransform(password);
                                rtpSession.PacketTransform = xform;
                            }
                        }

                        // andrew: notify RTP of our venue name; this is for diagnostic purposes
                        rtpSession.VenueName = venue.Name;

                    }
                    catch (System.Net.Sockets.SocketException se)
                    {
                        eventLog.WriteEntry(se.ToString(), EventLogEntryType.Error, 99);
                        LeaveVenue();

                        if (se.ErrorCode == 10013)
                        {
                            throw new Exception(Strings.SecurityErrorOccurredConnecting);
                        }
                        else
                        {
                            throw;
                        }
                    }
                    catch (Exception e)
                    {
                        eventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 99);                        
                        LeaveVenue();
                        throw;
                    }

                    #endregion
                }
            }
        }