internal static RtpStream CreateStream(RtpListener rtpListener, uint ssrc, 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, sdes, pt, fecPxExp)); } else // Constant Fec { return(new RtpStreamCFec(rtpListener, ssrc, sdes, pt, dataPxExp, fecPxExp)); } } // RtpStream return(new RtpStream(rtpListener, ssrc, sdes, pt)); }
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); }
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)); }
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); }
/// <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]; }
internal RtpStreamCFec(RtpListener rtpListener, uint ssrc, SdesData sdes, PayloadType pt, ushort dataPxExp, ushort fecPxExp) : base(rtpListener, ssrc, sdes, pt) { pcFecType = 1; this.dataPxExp = dataPxExp; this.fecPxExp = fecPxExp; SetDecoder(); InitializeDCRStorage(); }
internal RtpStream(RtpListener rtpListener, uint ssrc, SdesData sdes, PayloadType pt) { Debug.Assert(rtpListener != null); Debug.Assert(ssrc != 0); Debug.Assert(sdes != null); this.returnBufferHandler = rtpListener.ReturnBufferCallback; this.ssrc = ssrc; this.pt = pt; properties = new SdesData(sdes); InitializePerformanceCounters(); }
internal RtpStreamFec(RtpListener rtpListener, uint ssrc, SdesData sdes, PayloadType pt) : base(rtpListener, ssrc, sdes, pt) { this.getBufferHandler = rtpListener.GetBufferCallback; }
internal RtpStreamFFec(RtpListener rtpListener, uint ssrc, SdesData sdes, PayloadType pt, ushort fecPxExp) : base(rtpListener, ssrc, sdes, pt) { fecPercent = fecPxExp; pcFecType = 2; }
/// <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); } }
internal RtpStreamFec(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt) : base(rtpListener, ssrc, ipaddress, sdes, pt) { this.getBufferHandler = rtpListener.GetBufferCallback; }
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(); }
internal RtpStreamFFec(RtpListener rtpListener, uint ssrc, string ipaddress, SdesData sdes, PayloadType pt, ushort fecPxExp) : base(rtpListener, ssrc, ipaddress, sdes, pt) { fecPercent = fecPxExp; pcFecType = 2; }
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(); }
/// <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){}