C# (CSharp) NewTOAPIA.Net.Rtp Namespace

Classes

Name Description
AppConfig
EventThrower This class is used to fire events on a separate thread using a queue of events to fire with a First In, First Out algorithm. Rather than use the ThreadPool which would not guarantee FIFO since there are 25+ threads to service the events in the queue, we have a custom object that uses a single thread to service the queue and guarantees FIFO ordering. The reason this class exists is that two initial approaches failed. Approach 1: Fire events on the thread that discovered them. For instance, the RtcpListener thread would detect a new Rtp Participant and would fire RtpParticipantAdded. The client, upon catching the event, would draw a new Participant in the UI, but to do so it would have to make a web service call to the Venue Service to get the Participant's icon. This would take up to a second and the RtcpListener thread would block while this synchronous call was occuring. This caused a number of incoming Rtcp packets to be dropped while the thread was blocked and in high stress conditions would even cause Rtp Participant timeouts to occur due to a lack of received Rtcp packets for the participant. Approach 2: Have the main thread forward off events to the ThreadPool for firing. The problem here was that events would get queued and then serviced by the 25 threads sitting in the thread pool. Due to the intricacies of when threads get serviced by the CPU, we couldn't guarantee the order in which the events would get serviced. This caused freaky and very rare race conditions where the client might receive an RtpStreamAdded event before the RtpParticipantAdded event for the RtpParticipant that the RtpStream belonged to was received, especially prevalent under stress conditions of large numbers of streams/participants or high CPU utilization.
EventThrower.WorkItem A WorkItem consisting of the delegate to be called and an array of objects to pass in as parameters
FEC_Matrix Overview: ------------------------------------------------------------------------------------------- FEC_Matrix is a class that implements the basic matrix calculation using Galois Fields on 16 bits (GF16). Public Methods: ------------------------------------------------------------------------------------------- Invert - Invert the matrix by using Gauss-Jordan using GF16 operations CreateVandermondeMatrix - Create a Vandermonde matrix over GF16
FrameTooLargeException This exception is thrown when a chunk that is too large is sent or received
GF16 A field is a set of numbers with an addition/subtraction operations as well as multiplication/division operation. The result of adding/subtracting or multiplying/dividing any two numbers of the field has to be in the set as well. A finite field contains only finitely many elements. A finite field is also called Galois Field in honor of Evariste Galois. The advantage of a finite-field arithmetic is that it can be done exactly by computer (error-correcting code). (*) Evariste Galois 1811 (Bourg-La-Reine, near Paris) - 1832 (Paris)
GF8
IPStreamPair
IncorrectTimestampException This exception is thrown when a packet with an incorrect timestamp is added to a chunk
Installation
InvalidRtpPacketException InvalidRtpPacket exception is thrown when an Rtp packet has invalid contents either due to an invalid Rtp header or due to unexpected data in a stream such as a HeaderExtension where none should be present or an invalid TimeStamp value in an Rtp Frame.
NextFrameUnblockedException This exception is thrown when the NextFrame method is unblocked from a manual call or the Dispose method.
PCInstaller
PacketOutOfSequenceException OutOfOrder exception is thrown when issues are found with the Sequence or TimeStamp where they don't match up with the expected values an individual packet in a stream of Rtp packets should have. Note that this exception is also thrown by the RtpPacket class when using the RtpPacket.Next() method.
PayloadChannel
PoolExhaustedException This exception is thrown when the RtpListener runs out of buffers
ReceiverReport Structure containing a ReceiverReport, see RFC 3550 for details on the data it contains
Rtcp
RtcpData
RtcpListener RtcpReceiverThread is responsible for receiving all incoming packets on the Rtcp Listener, casting them into specific RtcpPackets, and then taking appropriate action with the packet SDES packets are used to maintain the lists of active Participants and Streams, associate Streams to Participants, and set the SdesData on Participants and Streams. BYE packets are used to remove RtpParticipants and RtpStreams. Currently SR, RR, and APP packets are simply forwarded to Events in case the application has interest in them. TODO - In the future, we should take the information from SR and RR and adjust our streams sending rates accordingly.
RtcpSender
RtcpSenderPC Contains the static performance counter data for the RtpSession class
RtcpSendingDisabledException RtcpSendingDisabledException is thrown if Rtcp sender methods in the Session are accessed while participant == null
RtpEL Rtp EventLog helper class EL was preferred over EventLog because it is shorter
RtpEvents Events contains all the events raised by the Rtp/Rtcp code Each event consists of 4 items - an EventArgs, a Delegate, an Event and an internal method Raise*Event that actually fires the event, and if the event is not hooked logs information to the EventLog. Because all our events follow the same pattern, they have been streamlined to call a single method (FireEvent) to actually fire them. This method uses the delegate's invocation list to call the hooked methods in a non-linked list format Due to our use of the static EventThrower which calls all events from a single thread, all methods in this class are static as well. They are not meant to be called in a multi-threaded way (although it would probably work fine since no static members are touched). Consideration was given to breaking these down by Rtp, Rtcp and shared (Rtp + Rtcp) events but due to the limited number of events it wasn't deemed necessary. It would be interesting to query our API users to see how many of them use the events and which events they use - Rtp, Rtcp or Shared
RtpEvents.AppPacketReceivedEventArgs
RtpEvents.DuplicateCNameDetectedEventArgs
RtpEvents.FrameOutOfSequenceEventArgs
RtpEvents.HiddenSocketExceptionEventArgs
RtpEvents.InvalidPacketEventArgs
RtpEvents.InvalidPacketInFrameEventArgs
RtpEvents.NetworkTimeoutEventArgs
RtpEvents.PacketOutOfSequenceEventArgs
RtpEvents.ReceiverReportEventArgs
RtpEvents.RtpParticipantEventArgs
RtpEvents.RtpStreamEventArgs
RtpException This is the base exception from which all others inherit
RtpListener Listens for packets from the network and distributes them to the appropriate RtpStream
RtpListenerPC Contains the static performance counter data for the RtpListener class
RtpPacket RtpPacket is based on RFC 1889. This class knows how to form a byte array for sending out over the network and how to turn a byte array into Rtp fields and a payload. It is meant to be used as a translation mechanism from bytes to structure and vice versa. This is a lower level class exposed only for use by applications that want intimate details about an individual Rtp packet or want to provide their own transport mechanism. Applications that simply want to send/receive real time data over IP Multicast should instead use RtpSender / RtpListener which handle all aspects of network transport and framing (AKA breaking/assembling large datasets into packet sized chunks). There is a small amount of Rtp protocol intelligence in the class when you use the Next methods. The Next methods assume you are working on RtpPackets in a series and will perform helper functions such as compare Sequence numbers for linearness and NextPayload increments the Sequence number between new packets. This implementation has no support for CSRC identifiers. The Rtp header has the following format: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |V=2|P|X| CC |M| PT | sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | timestamp | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | synchronization source (SSRC) identifier | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | contributing source (CSRC) identifiers (if mixers used) | | .... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ V = Version P = Padding X = Extensions CC = Count of Contributing Sources M = Marker PT = Payload Type
RtpPacketBase The standard Rtp packet TODO - we may need to re-add support for CSRCs and HeaderExtensions, although header extensions could just as easily be implemented as payload headers
RtpPacketFec RtpPacketFec is a forward error correction packet. It is used to provide error correction for data packets that may become lost. It has a fixed payload type PayloadType.FEC The normal Rtp Timestamp has been repurposed in order to save bytes. It is split into... FecIndex - the index of this packet within the fec packet[]. The size of the fec packet[] is either determined by the constant fec ratio, or the percent coverage across a chunk. DataRangeMin - the starting data packet sequence number for which this packet provides coverage. PacketsInFrame - how many packets are in a chunk. Used in the event that no data packets are received, but enough fec packets arrive to recover the data. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |V=2|P|X| CC |M| PT.FEC | sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DataRangeMin | PacketsInFrame | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | synchronization source (SSRC) identifier | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FecIndex | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
RtpParticipant RtpParticipant is the object shared between Rtp and Rtcp for describing a participant. Most of the public properties are a thin wrapper around the SdesData used in Rtcp. This class was created in order to shield the user from needing to understand Rtcp/Sdes, and give them a familiar concept that is easy to understand. The most important aspect of a participant is their uniqueName. It needs to be unique within the context of a session in order to differentiate them from other participants. A domain account, email, GUID, etc. would be good unique names. The participant also contains some other properties, such as the IPAddress the participant originates from, as well as all the streams the participant "owns" (is sending).
RtpRetransmit Summary description for RtpRetransmit.
RtpSenderPC Contains the static performance counter data for the RtpSender class
RtpSession
RtpSessionPC Contains the static performance counter data for the RtpSession class
RtpStreamCFec
RtpStreamFFec
RtpStreamFec
RtpStreamPC Contains the static performance counter data for the RtpStream class
RtpTrafficDisabledException RtpTrafficDisabledException is thrown if Rtp methods in the Session are accessed while in rtpTraffic == false mode
SdesData SdesData structure, used extensively among Rtcp and Rtp objects to describe the common properties associated with the Rtp data / Rtcp Participant. See RFC 3550 for definitions on the data it contains.
SdesReport
SenderReport Structure containing a SenderReport, See RFC 3550 for details of the data it contains
SessionException SessionExeption is thrown if anything goes wrong in the session object