libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
RtpPayload Class Referenceabstract

Abstract base class for RTP payload type handlers. More...

#include <rtppayload.h>

Inheritance diagram for RtpPayload:

Public Member Functions

virtual ~RtpPayload ()=default
 Destructor.
 
virtual uint8_t payloadType () const =0
 Returns the RTP payload type number.
 
virtual uint32_t clockRate () const =0
 Returns the RTP timestamp clock rate in Hz.
 
virtual RtpPacket::List pack (const void *mediaData, size_t size)=0
 Fragments media data into RTP payload packets.
 
virtual Buffer unpack (const RtpPacket::List &packets)=0
 Reassembles RTP payload packets into media data.
 
virtual size_t maxPayloadSize () const
 Returns the maximum payload size per packet.
 

Protected Member Functions

 RtpPayload ()=default
 Default constructor (protected; use a concrete subclass).
 

Detailed Description

Abstract base class for RTP payload type handlers.

RtpPayload defines the interface for packing media data into RTP payload packets and unpacking packets back into media data. Packing produces a list of RtpPackets that share a single buffer allocation for efficiency.

Concrete subclasses implement specific payload formats:

Member Function Documentation

◆ clockRate()

virtual uint32_t RtpPayload::clockRate ( ) const
pure virtual

Returns the RTP timestamp clock rate in Hz.

Implemented in RtpPayloadL24, RtpPayloadL16, RtpPayloadRawVideo, and RtpPayloadJpeg.

◆ maxPayloadSize()

virtual size_t RtpPayload::maxPayloadSize ( ) const
inlinevirtual

Returns the maximum payload size per packet.

Default is 1200 bytes (MTU-safe, accounts for IP/UDP headers within a 1500-byte Ethernet MTU).

Returns
Maximum payload bytes per packet.

◆ pack()

virtual RtpPacket::List RtpPayload::pack ( const void mediaData,
size_t  size 
)
pure virtual

Fragments media data into RTP payload packets.

Each returned RtpPacket includes space for the 12-byte RTP header at the start, followed by any payload-specific header, followed by the media data fragment. All returned packets share a single Buffer::Ptr.

Parameters
mediaDataPointer to the media data.
sizeSize of the media data in bytes.
Returns
List of RtpPackets sharing one buffer.

Implemented in RtpPayloadL24, RtpPayloadL16, RtpPayloadRawVideo, and RtpPayloadJpeg.

◆ payloadType()

virtual uint8_t RtpPayload::payloadType ( ) const
pure virtual

Returns the RTP payload type number.

Implemented in RtpPayloadL24, RtpPayloadL16, RtpPayloadRawVideo, and RtpPayloadJpeg.

◆ unpack()

virtual Buffer RtpPayload::unpack ( const RtpPacket::List packets)
pure virtual

Reassembles RTP payload packets into media data.

Parameters
packetsThe list of packets to reassemble.
Returns
Buffer containing the reassembled media data.

Implemented in RtpPayloadL24, RtpPayloadL16, RtpPayloadRawVideo, and RtpPayloadJpeg.


The documentation for this class was generated from the following file: