Example #1
0
        public void Dispose()
        {
            lock (classLock)
            {
                try
                {
                    disposed = true;

                    // Unhook events
                    RtpEvents.ReceiverReport         -= new RtpEvents.ReceiverReportEventHandler(RtpReceiverReport);
                    RtpEvents.DuplicateCNameDetected -= new RtpEvents.DuplicateCNameDetectedEventHandler(DuplicateCNameDetected);

                    if (updateThread != null)
                    {
                        updateThread.Dispose();
                        updateThread = null;
                    }

                    if (rtpSession != null)
                    {
                        rtpSession.Dispose();
                        rtpSession = null;
                        rtpSender  = null;
                    }
                }
                catch (Exception e)
                {
                    eventLog.WriteEntry(string.Format(CultureInfo.CurrentCulture,
                                                      Strings.ErrorDisposingConnectivityDetector, e.ToString()), EventLogEntryType.Error, 0);
                }
            }
        }
Example #2
0
        private void Teardown(RtpSession session, bool andRemove = true)
        {
            try
            {
                LOG.Debug($"Tearing RTSP session '{session.ID}' at '{session.Track.ControlUri}'");

                _client.Request().Uri(_currentUri).Session(session.ID).TeardownAsync((res) =>
                {
                    if (res.ResponseStatus.Code >= RtspResponse.Status.BadRequest.Code)
                    {
                        LOG.Error($"Failed to teardown session '{session.ID}' received {res.ResponseStatus}");
                    }
                });
            }
            catch (Exception e)
            {
                LOG.Error($"Failed to Teardown session '{session.ID}' for {session.Track.ControlUri}, reason: {e.Message}");
            }
            finally
            {
                session.Dispose();

                if (andRemove)
                {
                    _sessions.Remove(session); // Remove from the list of sessions.
                }
            }
        }
Example #3
0
        /// <summary>
        /// User clicks the Refresh button during encoding
        /// </summary>
        /// <param name="isConfListener"></param>
        public bool RestartListener(bool isConfListener)
        {
            if (isConfListener)
            {
                DisposeListener(ref confSession, presenterSession);
                confSession = CreateListener(presenterSession, confVenue);

                if (confSession == null)
                {
                    return(false);
                }

                // If conference and Presenter listeners are on the same venue, we don't actually restart.
                // Just refresh the streams in this case.
                if (confSession == presenterSession)
                {
                    AddConferenceStreams();
                }
            }
            else
            {
                Debug.WriteLine("Presenter Listener Restart not implemented");
                return(false);
            }
            return(true);
        }
Example #4
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);
            }
        }
Example #5
0
 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);
 }
Example #6
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         m_Disposing = true;
         m_SendQueueWait.Set();
         this.m_BeaconService.Dispose();
         if (m_RtpSender != null)
         {
             m_RtpSender.Dispose();
             m_RtpSender = null;
         }
         if (m_RtpSession != null)
         {
             try {
                 m_RtpSession.Dispose();
             }
             catch { }
             m_RtpSession = null;
         }
         m_RtpParticipant = null;
         if (m_SendThread != null)
         {
             if (!m_SendThread.Join(5000))
             {
                 m_SendThread.Abort();
             }
         }
     }
 }
        public void StopPlaying()
        {
            if (playing == false)
            {
                return;
            }

            if (avPlayer != null)
            {
                avPlayer.Stop();
                avPlayer = null;
            }

            if (otherPlayer != null)
            {
                otherPlayer.Stop();
                otherPlayer = null;
            }

            if (this.perfCounter != null)
            {
                perfCounter.Dispose();
            }

            lock (this)
            {
                if (rtpSession != null)
                {
                    rtpSession.Dispose();
                    rtpSession = null;
                }

                playing = false;
            }
        }
Example #8
0
        /// <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);
        }
Example #9
0
 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;
 }
Example #10
0
 private void LeaveRtpSession()
 {
     if (rtpSession != null)
     {
         rtpSession.Dispose();
         rtpSession = null;
         rtpSender  = null;
     }
 }
Example #11
0
 private void LeaveRtpSession()
 {
     if (rtpSession != null)
     {
         // Clean up all outstanding objects owned by the RtpSession
         rtpSession.Dispose();
         rtpSession = null;
     }
 }
Example #12
0
 // CF2 Create participant, join session
 // CF3 Retrieve RtpSender
 private void JoinRtpSession(string name)
 {
     try
     {
         rtpSession = new RtpSession(ep, new RtpParticipant(name, name), true, true);
         rtpSender  = rtpSession.CreateRtpSenderFec(name, PayloadType.Chat, null, 0, 200);
     }
     catch (Exception ex) { MessageBox.Show("Please make sure that you are connceted with the network so " + ex.Message); }
 }
Example #13
0
        /// <summary>
        /// Dispose of listener (if any), and create a new one on the new venue.
        /// </summary>
        /// <param name="venue"></param>
        /// <param name="isConferencingVenue"></param>
        public bool ChangeVenue(UWVenue venue, bool isConferencingVenue)
        {
            if (venue == null)
            {
                return(false);                //shouldn't ever be.
            }
            if (isConferencingVenue)
            {
                // Make sure it really did change because we could possibly have been using
                // the same address/port as a custom venue.
                if ((confVenue == null) || (!confVenue.Equals(venue)))
                {
                    confVenue = venue;
                    DisposeListener(ref confSession, presenterSession);
                    //Note: long term we don't want to clear them if encoding ..
                    assrcs.Clear();
                    vssrcs.Clear();
                    confSession = CreateListener(presenterSession, confVenue);
                    //confSession.BufferPacketsForUnsubscribedStreams = false;

                    if (confSession == null)
                    {
                        return(false);
                    }

                    // If conference and presenter now use the same venue, we
                    // may have already missed some relevant stream added events.
                    if (confSession == presenterSession)
                    {
                        AddConferenceStreams();
                    }
                }
            }
            else
            {
                if ((presenterVenue == null) || (!presenterVenue.Equals(venue)))
                {
                    presenterVenue = venue;
                    DisposeListener(ref presenterSession, confSession);
                    presenterSession = CreateListener(confSession, presenterVenue);
                    if (presenterSession == null)
                    {
                        return(false);
                    }

                    // If conference and presenter now use the same venue, we
                    // may have already missed some relevant stream added events.
                    if (confSession == presenterSession)
                    {
                        AddPresenterStreams();
                    }
                }
            }
            return(true);
        }
Example #14
0
        public UnicastToMulticastBridge(PresenterModel model)
        {
            GetConfig();

            //Prepare for RTP sending
            m_RtpParticipant = new RtpParticipant(m_Cname, m_Name);
            try {
                m_RtpSession = new RtpSession(m_MulticastEndpoint, m_RtpParticipant, true, false);
            }
            catch (Exception e) {
                Trace.WriteLine(e.ToString());
                m_RtpSession     = null;
                m_RtpParticipant = null;
                return;
            }

            try {
                /// Notes about FEC:  There are two types supported by the MSR RTP stack:  Frame-based and Packet-based.
                /// Setting cDataPx to zero forces frame-based.  In this case cFecPx is a percentage.  It must be greater than zero, but can be
                /// very large, eg. 1000.  Frame-based FEC appears to be better for large frames (which the stack splits into multiple packets)
                /// possibly because the FEC packets for the frame are not interlaced in time sequence with the frame packets.
                /// If cDataPx is not zero, packet-based FEC is used.  In this mode cDataPx and cFecPx are a ratio of data packets to fec packets.
                /// For single packet frames, 1:1 and 0:100 are identical.  Single packet frames are frames smaller than
                /// the MTU which is normally 1500 bytes.  Presenter's Chunk encoder creates frames up to 16kbytes.  Many frames are smaller
                /// than this, but only a few are below the MTU.  For this reason we will always use Frame-based FEC.  Usful values are expected to
                /// be from around 10 up to around 100.  More than 100 might be good in some cases, but might impact performance.
                /// More than 500 would probably never be advised.
                m_RtpSender = m_RtpSession.CreateRtpSenderFec("Classroom Presenter Unicast to Multicast Bridge", PayloadType.dynamicPresentation, null, 0, m_Fec);
                m_RtpSender.DelayBetweenPackets = m_InterpacketDelay;
            }
            catch (Exception e) {
                Trace.WriteLine(e.ToString());
                try {
                    m_RtpSession.Dispose();
                }
                catch { }
                m_RtpParticipant = null;
                m_RtpSession     = null;
                m_RtpSender      = null;
                return;
            }

            //Prepare the beacon
            this.m_ChunkSequence = 0;
            this.m_Encoder       = new Chunk.ChunkEncoder();
            this.m_BeaconService = new Beacons.BridgeBeaconService(this, model);

            //Prepare the queue and sending thread
            m_Disposing     = false;
            m_SendQueueWait = new EventWaitHandle(false, EventResetMode.AutoReset);
            m_SendQueue     = new PriorityQueue <BridgeMessage>();
            m_SendThread    = new Thread(new ThreadStart(SendThread));
            m_SendThread.Start();
        }
Example #15
0
 // CF2 Create participant, join session
 // CF3 Retrieve RtpSender
 private void JoinRtpSession(string name)
 {
     try
     {
         rtpSession = new RtpSession(ep, new RtpParticipant(name, name), true, true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        public SimpleTest()
        {
            // Create participant
            RtpParticipant rtpParticipant = null;

            //rtpParticipant.SetTool(true);

            // Create session with Participant and Rtp data
            rtpSession = new RtpSession(new IPEndPoint(IPAddress.Parse(addr), rtpPort),
                                        rtpParticipant, false, true);
        }
        // CF1
        private void LeaveRtpSession()
        {
            UnhookRtpEvents();

            if (rtpSession != null)
            {
                rtpSession.Dispose();
                rtpSession = null;
                rtpSender  = null;
                rtpStream  = null;
            }
        }
Example #18
0
        public RtpListener(RtpSession rtpSession)
        {
            this.rtpSession = rtpSession;

            returnBufferHandler = new ReturnBufferHandler(ReturnBuffer);
            getBufferHandler    = new GetBufferHandler(GetBuffer);

            InitializeBufferPool();
            InitializePerformanceCounters();
            InitializeNetwork();
            InitializeThreads();
        }
Example #19
0
        override public void Run()
        {
            RtpEvents.RtpStreamAdded += new MSR.LST.Net.Rtp.RtpEvents.RtpStreamAddedEventHandler(RtpStreamAdded);
            RtpEvents.RtpStreamRemoved += new MSR.LST.Net.Rtp.RtpEvents.RtpStreamRemovedEventHandler(RtpStreamRemoved);

            RtpSession session = new RtpSession(RtpSession.DefaultEndPoint, 
                new RtpParticipant("RtpSenderCreation", "RtpSenderCreation"), true, true);

            // Plain old RtpSender
            rtpSender = session.CreateRtpSender("RtpSenderCreation", PayloadType.Test, null);
            Thread.Sleep(timeout);
            SendData();
            SendData();
            rtpSender.Dispose();

            // Constant FEC sender
            rtpSender = session.CreateRtpSenderFec("RtpSenderCreation", PayloadType.Test, null, 1, 1);
            SendData();
            SendData();
            rtpSender.Dispose();

            // Frame FEC sender
            rtpSender = session.CreateRtpSenderFec("RtpSenderCreation", PayloadType.Test, null, 0, 50);
            SendData();
            SendData();
            rtpSender.Dispose();

            // RtpSenders with the fec private extensions already set
            Hashtable priExns = new Hashtable();
            
            // Plain old RtpSender
            rtpSender = session.CreateRtpSender("RtpSenderCreation", PayloadType.Test, priExns);
            SendData();
            SendData();
            rtpSender.Dispose();

            // Constant FEC sender
            priExns[Rtcp.PEP_FEC] = "1:1";
            rtpSender = session.CreateRtpSender("RtpSenderCreation", PayloadType.Test, priExns);
            SendData();
            SendData();
            rtpSender.Dispose();
            
            // Frame FEC sender
            priExns[Rtcp.PEP_FEC] = "0:50";
            rtpSender = session.CreateRtpSender("RtpSenderCreation", PayloadType.Test, priExns);
            SendData();
            SendData();
            rtpSender.Dispose();

            session.Dispose();
        }
Example #20
0
        override public void Run()
        {
            RtpEvents.RtpStreamAdded   += new MSR.LST.Net.Rtp.RtpEvents.RtpStreamAddedEventHandler(RtpStreamAdded);
            RtpEvents.RtpStreamRemoved += new MSR.LST.Net.Rtp.RtpEvents.RtpStreamRemovedEventHandler(RtpStreamRemoved);

            RtpSession session = new RtpSession(RtpSession.DefaultEndPoint,
                                                new RtpParticipant("RtpSenderCreation", "RtpSenderCreation"), true, true);

            // Plain old RtpSender
            rtpSender = session.CreateRtpSender("RtpSenderCreation", PayloadType.Test, null);
            Thread.Sleep(timeout);
            SendData();
            SendData();
            rtpSender.Dispose();

            // Constant FEC sender
            rtpSender = session.CreateRtpSenderFec("RtpSenderCreation", PayloadType.Test, null, 1, 1);
            SendData();
            SendData();
            rtpSender.Dispose();

            // Frame FEC sender
            rtpSender = session.CreateRtpSenderFec("RtpSenderCreation", PayloadType.Test, null, 0, 50);
            SendData();
            SendData();
            rtpSender.Dispose();

            // RtpSenders with the fec private extensions already set
            Hashtable priExns = new Hashtable();

            // Plain old RtpSender
            rtpSender = session.CreateRtpSender("RtpSenderCreation", PayloadType.Test, priExns);
            SendData();
            SendData();
            rtpSender.Dispose();

            // Constant FEC sender
            priExns[Rtcp.PEP_FEC] = "1:1";
            rtpSender             = session.CreateRtpSender("RtpSenderCreation", PayloadType.Test, priExns);
            SendData();
            SendData();
            rtpSender.Dispose();

            // Frame FEC sender
            priExns[Rtcp.PEP_FEC] = "0:50";
            rtpSender             = session.CreateRtpSender("RtpSenderCreation", PayloadType.Test, priExns);
            SendData();
            SendData();
            rtpSender.Dispose();

            session.Dispose();
        }
Example #21
0
 // CF2 Create participant, join session
 // CF3 Retrieve RtpSender
 private void JoinRtpSession(string name)
 {
     try
     {
         rtpSession = new RtpSession(ep, new RtpParticipant(name, name), true, true);
         Console.WriteLine("JoinedRtpSession");
     }
     catch (Exception ex)
     {
         Console.WriteLine("JoinedRtpSession Error : " + ex.Message);
         //MessageBox.Show("Please make sure that you are connceted with the network so " + ex.Message);
     }
 }
Example #22
0
        public RTPClient(IPEndPoint multiCastIP, Image image, String cname, String name)
        {
            UnhandledExceptionHandler.Register();
            this.ipe    = multiCastIP;
            this.image  = image;
            this.vpList = null;
            rtpSession  = new RtpSession(ipe, new RtpParticipant(cname, name), true, true);

            System.Diagnostics.Debug.WriteLine(rtpSession.MulticastInterface.ToString());
            rtpSender   = rtpSession.CreateRtpSenderFec(name, PayloadType.JPEG, null, 0, 1);
            waveWriters = new Dictionary <IPAddress, WaveFileWriter>();

            EvetnBinding();
        }
        public RtpListener(IPEndPoint nextHopEP, IPEndPoint groupEP, RtpSession rtpSession)
        {
            this.rtpSession = rtpSession;
            this.nextHopEP  = nextHopEP;
            this.groupEP    = groupEP;

            returnBufferHandler = new ReturnBufferHandler(ReturnBuffer);
            getBufferHandler    = new GetBufferHandler(GetBuffer);

            InitializeBufferPool();
            InitializePerformanceCounters();
            InitializeNetwork();
            InitializeThreads();
        }
Example #24
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);
        }
Example #25
0
        /// <summary>
        /// Start a listener on the venue specified.  If one was already running, dispose it
        /// regardless of the venue, and create a new one.
        /// isConfListener indicates whether this is a conferencing or Presenter listener.
        /// </summary>
        public bool StartListener(UWVenue venue, bool isConfListener)
        {
            if (venue == null)
            {
                return(false);
            }

            if (isConfListener)
            {
                confVenue = venue;
                if (confSession != null)
                {
                    DisposeListener(ref confSession, presenterSession);
                }
                confSession = CreateListener(presenterSession, venue);

                if (confSession == null)
                {
                    return(false);
                }

                // If conference and presenter now use the same venue, we
                // may have already missed some relevant stream added events.
                if (confSession == presenterSession)
                {
                    AddConferenceStreams();
                }
            }
            else
            {
                presenterVenue = venue;
                if (presenterSession != null)
                {
                    DisposeListener(ref presenterSession, confSession);
                }
                presenterSession = CreateListener(confSession, venue);
                if (presenterSession == null)
                {
                    return(false);
                }

                if (confSession == presenterSession)
                {
                    AddPresenterStreams();
                }
            }
            return(true);
        }
Example #26
0
        //            DShowNET.IGraphBuilder graphBuilder;
        //            IBasicAudio basicAudio;
        //            IMediaControl mediaControl;

        //            comType = Type.GetTypeFromCLSID(Clsid.FilterGraph);
        //            if (comType == null)
        //                throw new NotImplementedException(@"DirectShow FilterGraph not installed/registered!");
        //            comObj = Activator.CreateInstance(comType);
        //            graphBuilder = (IGraphBuilder)comObj; comObj = null; graphBuilder.RenderFile(d_tb_sciezka.Text, null);
        //            mediaControl = (IMediaControl)graphBuilder;
        //            videoWindow = graphBuilder as IVideoWindow;
        //            mediaEvt = (IMediaEventEx)graphBuilder;
        //            basicAudio = graphBuilder as IBasicAudio;

        //            comType = Type.GetTypeFromCLSID(Clsid.SampleGrabber);
        //            if (comType == null)
        //                throw new NotImplementedException(@"DirectShow SampleGrabber not installed/registered!");
        //            comObj = Activator.CreateInstance(comType);
        //            sampGrabber = (ISampleGrabber)comObj; comObj = null;

        //            mediaEvt = (IMediaEventEx)graphBuilder;
        //            baseGrabFlt = (IBaseFilter)sampGrabber;

        //            AMMediaType media = new AMMediaType();
        //            media.majorType = MediaType.Video;
        //            media.subType = MediaSubType.RGB24;
        //            media.formatType = FormatType.VideoInfo;		// ???
        //            hr = sampGrabber.SetMediaType(media);


        //            videoInfoHeader = (VideoInfoHeader)Marshal.PtrToStructure(media.formatPtr, typeof(VideoInfoHeader));
        //            Marshal.FreeCoTaskMem(media.formatPtr); media.formatPtr = IntPtr.Zero;


        //            videoWindow.put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN);
        //            videoWindow.put_Owner(picPreview.Handle);
        //            videoWindow.SetWindowPosition(0, 0, picPreview.Width, picPreview.Height);


        //            mediaControl.Run();
        //            timer1.Enabled = true;



        //        }
        //    }
        //    else
        //    {
        //        MessageBox.Show("Podaj plik do strumieniowania", "Brak ścieżki dostępu", MessageBoxButtons.OK, MessageBoxIcon.Information);
        //    }
        //}

        private void SetRTPSession()
        {
            IPEndPoint ep;

            try
            {
                ep = new IPEndPoint(IPAddress.Parse(d_tb_multicastIP.Text), 3000);
            }
            catch
            {
                MessageBox.Show("Błędny adres grupy multicastowej");
                return;
            }
            rtpSession = new RtpSession(ep, new RtpParticipant(Dns.GetHostName(), Dns.GetHostName()), true, true);
            rtpSender  = rtpSession.CreateRtpSenderFec(Dns.GetHostName(), PayloadType.Chat, null, 0, 10);
        }
Example #27
0
 /// <summary>
 /// Destroy a listener reference.  Dispose the listener if appropriate
 /// </summary>
 /// <param name="goner">The one to Dispose</param>
 /// <param name="other">The other (possible) reference which may be null</param>
 private void DisposeListener(ref RtpSession goner, RtpSession other)
 {
     if (goner != null)
     {
         if (other != null)
         {
             if (CompareIPEndPoints(goner.RtpEndPoint, other.RtpEndPoint))
             {
                 goner = null;
                 return;
             }
         }
         goner.Dispose();
         goner = null;
     }
 }
Example #28
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);
            }
        }
Example #29
0
 private void LeaveRtpSession()
 {
     try
     {
         if (rtpSession != null)
         {
             // Clean up all outstanding objects owned by the RtpSession
             rtpSession.Dispose();
             rtpSession = null;
             rtpSender  = null;
         }
     }
     catch (Exception err)
     {
         logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);
     }
 }
Example #30
0
        // CF2 Create participant, join session
        // CF3 Retrieve RtpSender
        private void JoinRtpSession(string name)
        {
            try
            {
                Hashtable payloadPara = new Hashtable();
                payloadPara.Add("Width", Width);
                payloadPara.Add("Height", Height);
                payloadPara.Add("Quality", Quality);

                rtpSession = new RtpSession(ep, new RtpParticipant(name, name), true, true);
                rtpSender  = rtpSession.CreateRtpSender(name, PayloadType.JPEG, null, payloadPara);
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);
            }
        }
Example #31
0
        private void SetRTPSession()
        {
            RtpSession rtpSession;
            IPEndPoint ep;

            try
            {
                ep = new IPEndPoint(ip, port);
            }
            catch
            {
                MessageBox.Show("Błędny adres grupy multicastowej");
                return;
            }
            rtpSession = new RtpSession(ep, new RtpParticipant(Dns.GetHostName(), Dns.GetHostName()), true, true);
            rtpSender  = rtpSession.CreateRtpSenderFec(Dns.GetHostName(), PayloadType.Chat, null, 0, 200);
        }