Example #1
0
        internal static RtpStream CreateStream(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes)
        {
            string sPT = sdes.GetPrivateExtension(Rtcp.PEP_PAYLOADTYPE);
            PayloadType pt = (PayloadType)Enum.Parse(typeof(PayloadType), sPT);

            // RtpStreamFec
            string fecData = sdes.GetPrivateExtension(Rtcp.PEP_FEC);
            if(fecData != null)
            {
                string[] args = fecData.Split(new char[]{':'});
                ushort dataPxExp = ushort.Parse(args[0]);
                ushort fecPxExp = ushort.Parse(args[1]);

                if(fecPxExp == 0)
                {
                    throw new ArgumentOutOfRangeException("fecPxExp", fecPxExp, "Must be >= 1");
                }
                
                // Frame based Fec
                if(dataPxExp == 0)
                {
                    return new RtpStreamFFec(rtpListener, ssrc, ipaddress, sdes, pt, fecPxExp);
                }
                else // Constant Fec
                {
                    return new RtpStreamCFec(rtpListener, ssrc, ipaddress, sdes, pt, dataPxExp, fecPxExp);
                }
            }

            // RtpStream
            return new RtpStream(rtpListener, ssrc, ipaddress,sdes, pt);
        }
Example #2
0
        internal static RtpStream CreateStream(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes)
        {
            string      sPT = sdes.GetPrivateExtension(Rtcp.PEP_PAYLOADTYPE);
            PayloadType pt  = (PayloadType)Enum.Parse(typeof(PayloadType), sPT);

            // RtpStreamFec
            string fecData = sdes.GetPrivateExtension(Rtcp.PEP_FEC);

            if (fecData != null)
            {
                string[] args      = fecData.Split(new char[] { ':' });
                ushort   dataPxExp = ushort.Parse(args[0]);
                ushort   fecPxExp  = ushort.Parse(args[1]);

                if (fecPxExp == 0)
                {
                    throw new ArgumentOutOfRangeException("fecPxExp", fecPxExp, "Must be >= 1");
                }

                // Frame based Fec
                if (dataPxExp == 0)
                {
                    return(new RtpStreamFFec(rtpListener, ssrc, ipaddress, sdes, pt, fecPxExp));
                }
                else // Constant Fec
                {
                    return(new RtpStreamCFec(rtpListener, ssrc, ipaddress, sdes, pt, dataPxExp, fecPxExp));
                }
            }

            // RtpStream
            return(new RtpStream(rtpListener, ssrc, ipaddress, sdes, pt));
        }
Example #3
0
        internal static RtpStream CreateStream2(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes)
        {
            string sPT = sdes.GetPrivateExtension(Rtcp.PEP_PAYLOADTYPE);
            PayloadType pt = PayloadType.JPEG;

            // RtpStream
            return new RtpStream(rtpListener, ssrc, ipaddress, sdes, pt);
        }
Example #4
0
        internal static RtpStream CreateStream2(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes)
        {
            string      sPT = sdes.GetPrivateExtension(Rtcp.PEP_PAYLOADTYPE);
            PayloadType pt  = PayloadType.JPEG;

            // RtpStream
            return(new RtpStream(rtpListener, ssrc, ipaddress, sdes, pt));
        }
Example #5
0
        internal RtpStreamCFec(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt, ushort dataPxExp, ushort fecPxExp)
            : base(rtpListener, ssrc, ipaddress, sdes, pt)
        {
            pcFecType = 1;

            this.dataPxExp = dataPxExp;
            this.fecPxExp  = fecPxExp;

            SetDecoder();
            InitializeDCRStorage();
        }
Example #6
0
        internal RtpStream(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt)
        {
            Debug.Assert(rtpListener != null);
            Debug.Assert(ssrc != 0);
            Debug.Assert(sdes != null);
            Debug.Assert(ipaddress != null);

            this.returnBufferHandler = rtpListener.ReturnBufferCallback;
            this.ssrc      = ssrc;
            this.pt        = pt;
            this.ipaddress = ipaddress;

            properties = new SdesData(sdes);

            InitializePerformanceCounters();
        }
Example #7
0
 internal RtpStreamFec(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt) 
     : base(rtpListener, ssrc, ipaddress, sdes, pt)
 {
     this.getBufferHandler = rtpListener.GetBufferCallback;
 }
Example #8
0
        internal RtpStream(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt)
        {
            Debug.Assert(rtpListener != null);
            Debug.Assert(ssrc != 0);
            Debug.Assert(sdes != null);
            Debug.Assert(ipaddress != null);

            this.returnBufferHandler = rtpListener.ReturnBufferCallback;
            this.ssrc = ssrc;
            this.pt = pt;
            this.ipaddress = ipaddress;

            properties = new SdesData(sdes);

            InitializePerformanceCounters();
        }
Example #9
0
 internal RtpStreamFFec(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt, ushort fecPxExp)
     : base(rtpListener, ssrc, ipaddress, sdes, pt)
 {
     fecPercent = fecPxExp;
     pcFecType = 2;
 }
Example #10
0
        internal RtpStreamCFec(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt, ushort dataPxExp, ushort fecPxExp) 
            : base(rtpListener, ssrc, ipaddress, sdes, pt)
        {
            pcFecType = 1;

            this.dataPxExp = dataPxExp;
            this.fecPxExp = fecPxExp;

            SetDecoder();
            InitializeDCRStorage();
        }
Example #11
0
        /// <summary>
        /// Initialize the Rtcp/Rtp listeners and senders.  See the primary constructor's summary
        /// for an explanation of the "states" an RtpSession can be constructed in.
        /// 
        /// Performance note - it takes .6+ seconds to initialize the performance counter code in
        /// the .Net framework (the first time per process).  In the current code, that happens
        /// during RtcpSender construction.
        /// </summary>
        private void InitializeNetwork()
        {
            if( receiveData )
            {
                if(participant != null && rtpTraffic)
                {
                    rtpListener = new RtpListener(this);   
                }

                // RtcpListener can create streams.  A stream needs a valid RtpListener in order to
                // return used packets, so start this object/thread after RtpListener.
                rtcpListener = new RtcpListener(this);
            }

            if(participant != null)
            {
                // Set the participant's IP address
                participant.SetIPAddress = Utility.GetLocalMulticastInterface();

                // Get an ssrc for the local participant
                uint ssrc = NextSSRC();
                AddParticipant(ssrc, participant);
                AddSsrcToIp(ssrc, participant.IPAddress);
                
                rtcpSender = new RtcpSender(this);    
            }
        }
Example #12
0
        /// <summary>
        /// Constructs a frame for Receiving data
        /// </summary>
        public RtpFrame(uint packetsInFrame, uint timeStamp, RtpListener.ReturnBufferHandler returnBufferHandler, bool allowDuplicatePackets)
        {
            this.packetsInFrame = packetsInFrame;
            this.timeStamp = timeStamp;
            this.returnBufferHandler = returnBufferHandler;
            this.allowDuplicatePackets = allowDuplicatePackets;            

            pool = new RtpPacket[packetsInFrame];
            this.poolLength = (uint)pool.Length;
            this.packetsInFrameIsSet = false;
        }
Example #13
0
 /// <summary>
 /// Constructs a frame for Receiving data
 /// Defaults allowDuplicatePackets to false
 /// </summary>
 public RtpFrame(uint packetsInFrame, uint timeStamp, RtpListener.ReturnBufferHandler returnBufferHandler) :
     this(packetsInFrame, timeStamp, returnBufferHandler, false){}
Example #14
0
 internal RtpStreamFec(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt)
     : base(rtpListener, ssrc, ipaddress, sdes, pt)
 {
     this.getBufferHandler = rtpListener.GetBufferCallback;
 }
Example #15
0
 internal RtpStreamFFec(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt, ushort fecPxExp)
     : base(rtpListener, ssrc, ipaddress, sdes, pt)
 {
     fecPercent = fecPxExp;
     pcFecType  = 2;
 }