|
uvgRTP 4.0.0
An open-source library for RTP/SRTP media delivery
|
Available for both static and shared builds. Only ABI-safe fuctions and classes. More...
Classes | |
| struct | uvgrtp::frame::rtp_frame |
| See RFC 3550 section 5 More... | |
| struct | uvgrtp::frame::rtcp_header |
| Header for all RTCP packets defined in RFC 3550 section 6 More... | |
| struct | uvgrtp::frame::rtcp_sender_info |
| See RFC 3550 section 6.4.1 More... | |
| struct | uvgrtp::frame::rtcp_report_block |
| See RFC 3550 section 6.4.1 More... | |
| struct | uvgrtp::frame::rtcp_sr |
| See RFC 3550 section 6.4.1 More... | |
| struct | uvgrtp::frame::rtcp_rr |
| See RFC 3550 section 6.4.2 for details on the RTCP RR (Receiver Report). More... | |
| struct | uvgrtp::frame::rtcp_sdes_item |
| See RFC 3550 section 6.5 for details on RTCP SDES Item. More... | |
| struct | uvgrtp::frame::rtcp_sdes_ck |
| See RFC 3550 section 6.5 for details on RTCP SDES Chunk. More... | |
| struct | uvgrtp::frame::rtcp_sdes |
| See RFC 3550 section 6.5 for details on RTCP SDES (Source Description). More... | |
| struct | uvgrtp::frame::rtcp_app_packet |
| See RFC 3550 section 6.7 for details on RTCP Application Packet. More... | |
Functions | |
| UVGRTP_EXPORT uint64_t | uvgrtp::clock::ntp::now () |
| Get current time in NTP units. | |
| UVGRTP_EXPORT uint64_t | uvgrtp::clock::ntp::diff (uint64_t ntp1, uint64_t ntp2) |
| Calculate the time difference of two NTP times. | |
| UVGRTP_EXPORT uint64_t | uvgrtp::clock::ntp::diff_now (uint64_t then) |
| Calculate the time difference of two NTP times. | |
| uvgrtp::context::context () | |
| RTP context constructor. | |
| uvgrtp::context::~context () | |
| RTP context destructor. | |
| session * | uvgrtp::context::create_session (const char *address) |
| Create a new RTP session. | |
| session * | uvgrtp::context::create_session (const char *local_address, const char *remote_address) |
| Create a new RTP session between two IP addresses. | |
| rtp_error_t | uvgrtp::context::destroy_session (uvgrtp::session *session) |
| Destroy RTP session and all of its media streams. | |
| bool | uvgrtp::context::crypto_enabled () const |
| Has Crypto++ been included in uvgRTP library. | |
| uvgrtp::frame::__pragma (pack(push, 1)) struct UVGRTP_EXPORT rtp_header | |
| RTP header as defined in RFC 3550 (Section 5). | |
| rtp_error_t UVGRTP_EXPORT | uvgrtp::frame::dealloc_frame (uvgrtp::frame::rtp_frame *frame) |
| Deallocates an RTP frame. | |
| rtp_error_t UVGRTP_EXPORT | uvgrtp::frame::dealloc_sr (uvgrtp::frame::rtcp_sr *sr) |
| Deallocates an RTCP Sender Report (SR) frame. | |
| rtp_error_t UVGRTP_EXPORT | uvgrtp::frame::dealloc_rr (uvgrtp::frame::rtcp_rr *rr) |
| Deallocates an RTCP Receiver Report (RR) frame. | |
| rtp_error_t UVGRTP_EXPORT | uvgrtp::frame::dealloc_sdes (uvgrtp::frame::rtcp_sdes *sdes) |
| Deallocates an RTCP Source Description (SDES) frame. | |
| rtp_error_t | uvgrtp::media_stream::start_zrtp () |
| Start the ZRTP negotiation manually. | |
| rtp_error_t | uvgrtp::media_stream::add_srtp_ctx (uint8_t *key, uint8_t *salt) |
| Add keying information for user-managed SRTP session. | |
| rtp_error_t | uvgrtp::media_stream::push_frame (uint8_t *data, size_t data_len, int rtp_flags) |
| Send data to remote participant with a custom timestamp. | |
| rtp_error_t | uvgrtp::media_stream::push_frame (uint8_t *data, size_t data_len, uint32_t ts, int rtp_flags) |
| Send data to remote participant with a custom timestamp. | |
| rtp_error_t | uvgrtp::media_stream::push_frame (uint8_t *data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags) |
| Send data to remote participant with custom RTP and NTP timestamps. | |
| uvgrtp::frame::rtp_frame * | uvgrtp::media_stream::pull_frame () |
| Poll a frame indefinitely from the media stream object. | |
| uvgrtp::frame::rtp_frame * | uvgrtp::media_stream::pull_frame (size_t timeout_ms) |
| Poll a frame for a specified time from the media stream object. | |
| rtp_error_t | uvgrtp::media_stream::install_receive_hook (void *arg, void(*hook)(void *, uvgrtp::frame::rtp_frame *)) |
| Asynchronous way of getting frames. | |
| rtp_error_t | uvgrtp::media_stream::configure_ctx (int rcc_flag, ssize_t value) |
| Configure the media stream, see RTP_CTX_CONFIGURATION_FLAGS for more details. | |
| int | uvgrtp::media_stream::get_configuration_value (int rcc_flag) |
| Get the values associated with configuration flags, see RTP_CTX_CONFIGURATION_FLAGS for more details. | |
| uvgrtp::rtcp * | uvgrtp::media_stream::get_rtcp () |
| Get pointer to the RTCP object of the media stream. | |
| uint32_t | uvgrtp::media_stream::get_ssrc () const |
| Get SSRC identifier. You can use the SSRC value for example to find the report block belonging to this media stream in RTCP sender/receiver report. | |
| void | uvgrtp::rtcp::set_ts_info (uint64_t clock_start, uint32_t clock_rate, uint32_t rtp_ts_start) |
| Provide timestamping information for RTCP. | |
| rtp_error_t | uvgrtp::rtcp::add_sdes_item (const uvgrtp::frame::rtcp_sdes_item &item) |
| Add an SDES item that will be included in all future RTCP SDES packets. | |
| rtp_error_t | uvgrtp::rtcp::clear_sdes_items () |
| Remove all SDES items previously added with add_sdes_item() | |
| rtp_error_t | uvgrtp::rtcp::send_app_packet (const char *name, uint8_t subtype, uint32_t payload_len, const uint8_t *payload) |
| Send an RTCP APP packet. | |
| rtp_error_t | uvgrtp::rtcp::install_send_app_hook (const char *app_name, uint8_t *(*send_hook)(uint8_t *subtype, uint32_t *payload_len, void *user_arg), void *user_arg) |
| Install a hook for generating RTCP APP packets during RTCP reporting. | |
| rtp_error_t | uvgrtp::rtcp::remove_send_app_hook (const char *app_name) |
| Remove a previously installed APP sending hook. | |
| rtp_error_t | uvgrtp::rtcp::send_bye_packet (const uint32_t *ssrcs, size_t count) |
| Send an RTCP BYE packet to indicate stream end. | |
| rtp_error_t | uvgrtp::rtcp::install_sender_hook (void(*handler)(uvgrtp::frame::rtcp_sr *)) |
| Install a callback for incoming RTCP Sender Reports. | |
| rtp_error_t | uvgrtp::rtcp::install_receiver_hook (void(*handler)(uvgrtp::frame::rtcp_rr *)) |
| Install a callback for incoming RTCP Receiver Reports. | |
| rtp_error_t | uvgrtp::rtcp::install_sdes_hook (void(*handler)(uvgrtp::frame::rtcp_sdes *)) |
| Install a callback for incoming RTCP SDES packets. | |
| rtp_error_t | uvgrtp::rtcp::install_app_hook (void(*handler)(uvgrtp::frame::rtcp_app_packet *)) |
| Install a callback for incoming RTCP APP packets. | |
| rtp_error_t | uvgrtp::rtcp::remove_all_hooks () |
| Remove all installed reception RTCP packet hook, but not app send hook. | |
| uvgrtp::frame::rtcp_sr * | uvgrtp::rtcp::get_sr (uint32_t ssrc) |
| Get sender report for given SSRC. | |
| uvgrtp::frame::rtcp_rr * | uvgrtp::rtcp::get_rr (uint32_t ssrc) |
| Get receiver report for given SSRC. | |
| uvgrtp::frame::rtcp_sdes * | uvgrtp::rtcp::get_sdes (uint32_t ssrc) |
| Get SDES packet for given SSRC. | |
| uvgrtp::frame::rtcp_app_packet * | uvgrtp::rtcp::get_app_packet (uint32_t ssrc) |
| Get APP packet for given SSRC. | |
| uvgrtp::media_stream * | uvgrtp::session::create_stream (uint16_t src_port, uint16_t dst_port, rtp_format_t fmt, int rce_flags) |
| Create a uni- or bidirectional media stream. | |
| uvgrtp::media_stream * | uvgrtp::session::create_stream (uint16_t port, rtp_format_t fmt, int rce_flags) |
| Create a unidirectional media_stream for an RTP session. | |
| rtp_error_t | uvgrtp::session::destroy_stream (uvgrtp::media_stream *stream) |
| Destroy a media stream. | |
| uint16_t UVGRTP_EXPORT | uvgrtp::get_version_major () |
| Get the major version number of uvgRTP. | |
| uint16_t UVGRTP_EXPORT | uvgrtp::get_version_minor () |
| Get the minor version number of uvgRTP. | |
| uint16_t UVGRTP_EXPORT | uvgrtp::get_version_patch () |
| Get the patch version number of uvgRTP. | |
| const char *UVGRTP_EXPORT | uvgrtp::get_version_cstr () |
| Get the full version string of uvgRTP as a C string. | |
| const char *UVGRTP_EXPORT | uvgrtp::get_git_hash_cstr () |
| Get the Git commit hash of the uvgRTP build as a C string. | |
Available for both static and shared builds. Only ABI-safe fuctions and classes.
| uvgrtp::frame::__pragma | ( | pack(push, 1) | ) |
RTP header as defined in RFC 3550 (Section 5).
RTP extension header.
The RTP header contains fields that define the basic structure of the RTP packet, including version, padding, payload type, sequence number, timestamp, and synchronization source identifier (SSRC).
The extension header provides additional information for the RTP packet, such as the type of extension and the length of the extension data.
< RTP version (2 bits)
< Padding flag (1 bit)
< Extension header flag (1 bit)
< CSRC count (4 bits)
< Marker bit (1 bit)
< Payload type (7 bits)
< Sequence number (16 bits)
< Timestamp (32 bits)
< Synchronization source identifier (SSRC) (32 bits)
| rtp_error_t uvgrtp::rtcp::add_sdes_item | ( | const uvgrtp::frame::rtcp_sdes_item & | item | ) |
Add an SDES item that will be included in all future RTCP SDES packets.
| item | SDES item to include (C-compatible ABI-safe struct) |
| RTP_OK | on success |
| RTP_GENERIC_ERROR | on failure |
| rtp_error_t uvgrtp::media_stream::add_srtp_ctx | ( | uint8_t * | key, |
| uint8_t * | salt ) |
Add keying information for user-managed SRTP session.
For user-managed SRTP session (flag RCE_SRTP_KMNGMNT_USER), the media stream is not started until SRTP key has been added and all calls to push_frame() will fail.
| key | SRTP master key, default is 128-bit long |
| salt | 112-bit long salt |
| RTP_OK | On success |
| RTP_INVALID_VALUE | If key or salt is invalid |
| RTP_NOT_SUPPORTED | If user-managed SRTP was not specified in create_stream() |
| rtp_error_t uvgrtp::rtcp::clear_sdes_items | ( | ) |
Remove all SDES items previously added with add_sdes_item()
Clears the list of SDES items that are included in outgoing RTCP SDES packets.
| RTP_OK | on success |
| rtp_error_t uvgrtp::media_stream::configure_ctx | ( | int | rcc_flag, |
| ssize_t | value ) |
Configure the media stream, see RTP_CTX_CONFIGURATION_FLAGS for more details.
| RTP_OK | On success |
| RTP_INVALID_VALUE | If the provided value is not valid for a given configuration flag |
| RTP_GENERIC_ERROR | If setsockopt(2) failed |
| uvgrtp::context::context | ( | ) |
RTP context constructor.
Most of the time one RTP context per application is enough. If CNAME namespace isolation is required, multiple context objects can be created.
| session * uvgrtp::context::create_session | ( | const char * | address | ) |
Create a new RTP session.
| address | IP address of remote or local participant |
| uvgrtp::session | On success |
| nullptr | If "address" is empty or memory allocation failed |
| session * uvgrtp::context::create_session | ( | const char * | local_address, |
| const char * | remote_address ) |
Create a new RTP session between two IP addresses.
| local_address | Local IP address for the session |
| remote_address | Remote IP address for the session |
| uvgrtp::session | On success |
| nullptr | If memory allocation failed |
| uvgrtp::media_stream * uvgrtp::session::create_stream | ( | uint16_t | port, |
| rtp_format_t | fmt, | ||
| int | rce_flags ) |
Create a unidirectional media_stream for an RTP session.
The created object is used for sending or receiving media, see documentation for uvgrtp::media_stream for more details.
User can enable and disable functionality of uvgRTP by OR'ing (using |) RCE_* flags together and passing them using the rce_flags parameter. The RCE_SEND_ONLY flag in rce_flags means the port is interpreted as a remote port. The RCE_RECEIVE_ONLY means the port is used for binding to a local interface. Without either flag, this function defaults to RCE_SEND_ONLY.
| port | Either local or remote port depending on rce_flags |
| fmt | Format of the media stream. see RTP_FORMAT for more details |
| rce_flags | RTP context enable flags, see RTP_CTX_ENABLE_FLAGS for more details |
| uvgrtp::media_stream* | On success |
| nullptr | On failure, see print |
| uvgrtp::media_stream * uvgrtp::session::create_stream | ( | uint16_t | src_port, |
| uint16_t | dst_port, | ||
| rtp_format_t | fmt, | ||
| int | rce_flags ) |
Create a uni- or bidirectional media stream.
The created object is used for sending and/or receiving media, see documentation for uvgrtp::media_stream for more details.
If both addresses were provided when uvgrtp::session was created, by default uvgRTP binds itself to local_addr:src_port and sends packets to remote_addr:dst_port.
User can enable and disable functionality of media_stream by OR'ing (using |) RCE_* flags together and passing them using the rce_flags parameter. In rce_flags, the RCE_SEND_ONLY flag can be used to avoid binding and src_port is thus ignored. Correspondinly RCE_RECEIVE_ONLY flag means dst_port is ignored. Without either RCE_SEND_ONLY or RCE_RECEIVE_ONLY, and if only one address was provided for session that address is interpreted as remote_addr and binding happens to ANY:src_port.
| src_port | Local port that uvgRTP listens to for incoming RTP packets |
| dst_port | Remote port where uvgRTP sends RTP packets |
| fmt | Format of the media stream. see RTP_FORMAT for more details |
| rce_flags | RTP context enable flags, see RTP_CTX_ENABLE_FLAGS for more details |
If no explicit SSRC is provided during creation, the stream will be assigned a random non-zero SSRC internally. To set an explicit SSRC, call configure_ctx(RCC_SSRC, value) on the returned uvgrtp::media_stream.
| uvgrtp::media_stream* | On success |
| nullptr | On failure, see print and |
| bool uvgrtp::context::crypto_enabled | ( | ) | const |
Has Crypto++ been included in uvgRTP library.
| true | Crypto++ has been included, using SRTP is possible |
| false | Crypto++ has not been included, using SRTP is not possible |
| rtp_error_t UVGRTP_EXPORT uvgrtp::frame::dealloc_frame | ( | uvgrtp::frame::rtp_frame * | frame | ) |
Deallocates an RTP frame.
This function is responsible for deallocating an RTP frame object.
| frame | Pointer to the RTP frame to be deallocated. |
| rtp_error_t UVGRTP_EXPORT uvgrtp::frame::dealloc_rr | ( | uvgrtp::frame::rtcp_rr * | rr | ) |
Deallocates an RTCP Receiver Report (RR) frame.
This function is responsible for deallocating an RTCP Receiver Report (RR) frame object.
| rr | Pointer to the RTCP RR frame to be deallocated. |
| rtp_error_t UVGRTP_EXPORT uvgrtp::frame::dealloc_sdes | ( | uvgrtp::frame::rtcp_sdes * | sdes | ) |
Deallocates an RTCP Source Description (SDES) frame.
This function is responsible for deallocating an RTCP Source Description (SDES) frame object.
| sdes | Pointer to the RTCP SDES frame to be deallocated. |
| rtp_error_t UVGRTP_EXPORT uvgrtp::frame::dealloc_sr | ( | uvgrtp::frame::rtcp_sr * | sr | ) |
Deallocates an RTCP Sender Report (SR) frame.
This function is responsible for deallocating an RTCP Sender Report (SR) frame object.
| sr | Pointer to the RTCP SR frame to be deallocated. |
| rtp_error_t uvgrtp::context::destroy_session | ( | uvgrtp::session * | session | ) |
Destroy RTP session and all of its media streams.
| session | Pointer to the session object that should be destroyed |
| RTP_OK | On success |
| RTP_INVALID_VALUE | If session is nullptr |
| rtp_error_t uvgrtp::session::destroy_stream | ( | uvgrtp::media_stream * | stream | ) |
Destroy a media stream.
| stream | Pointer to the media stream that should be destroyed |
| RTP_OK | On success |
| RTP_INVALID_VALUE | If stream is nullptr |
| RTP_NOT_FOUND | If stream does not belong to this session |
| UVGRTP_EXPORT uint64_t uvgrtp::clock::ntp::diff | ( | uint64_t | ntp1, |
| uint64_t | ntp2 ) |
Calculate the time difference of two NTP times.
The second timestamp is subtracted from the first one
| ntp1 | First NTP timestamp |
| ntp2 | Second NTP timestamp |
| UVGRTP_EXPORT uint64_t uvgrtp::clock::ntp::diff_now | ( | uint64_t | then | ) |
Calculate the time difference of two NTP times.
This function calls uvgrtp::clock::ntp::now() and then subtracts the input parameter from that timestamp value.
| then | NTP timestamp |
| uvgrtp::frame::rtcp_app_packet * uvgrtp::rtcp::get_app_packet | ( | uint32_t | ssrc | ) |
Get APP packet for given SSRC.
| ssrc | SSRC identifier to lookup |
| pointer | to rtcp_app_packet if found, nullptr otherwise |
| int uvgrtp::media_stream::get_configuration_value | ( | int | rcc_flag | ) |
Get the values associated with configuration flags, see RTP_CTX_CONFIGURATION_FLAGS for more details.
| int | value on success |
| -1 | on error |
| const char *UVGRTP_EXPORT uvgrtp::get_git_hash_cstr | ( | ) |
Get the Git commit hash of the uvgRTP build as a C string.
| uvgrtp::frame::rtcp_rr * uvgrtp::rtcp::get_rr | ( | uint32_t | ssrc | ) |
Get receiver report for given SSRC.
| ssrc | SSRC identifier to lookup |
| pointer | to rtcp_rr if found, nullptr otherwise |
| uvgrtp::rtcp * uvgrtp::media_stream::get_rtcp | ( | ) |
Get pointer to the RTCP object of the media stream.
This object is used to control all RTCP-related functionality and RTCP documentation can be found in uvgrtp::rtcp
| uvgrtp::rtcp* | If RTCP has been enabled (RCE_RTCP has been given to uvgrtp::session::create_stream()) |
| nullptr | If RTCP has not been enabled |
| uvgrtp::frame::rtcp_sdes * uvgrtp::rtcp::get_sdes | ( | uint32_t | ssrc | ) |
Get SDES packet for given SSRC.
| ssrc | SSRC identifier to lookup |
| pointer | to rtcp_sdes if found, nullptr otherwise |
| uvgrtp::frame::rtcp_sr * uvgrtp::rtcp::get_sr | ( | uint32_t | ssrc | ) |
Get sender report for given SSRC.
| ssrc | SSRC identifier to lookup |
| pointer | to rtcp_sr if found, nullptr otherwise |
| uint32_t uvgrtp::media_stream::get_ssrc | ( | ) | const |
Get SSRC identifier. You can use the SSRC value for example to find the report block belonging to this media stream in RTCP sender/receiver report.
| const char *UVGRTP_EXPORT uvgrtp::get_version_cstr | ( | ) |
Get the full version string of uvgRTP as a C string.
| uint16_t UVGRTP_EXPORT uvgrtp::get_version_major | ( | ) |
Get the major version number of uvgRTP.
| uint16_t UVGRTP_EXPORT uvgrtp::get_version_minor | ( | ) |
Get the minor version number of uvgRTP.
| uint16_t UVGRTP_EXPORT uvgrtp::get_version_patch | ( | ) |
Get the patch version number of uvgRTP.
| rtp_error_t uvgrtp::rtcp::install_app_hook | ( | void(* | handler )(uvgrtp::frame::rtcp_app_packet *) | ) |
Install a callback for incoming RTCP APP packets.
| handler | Function to call when an APP packet is received |
| RTP_OK | on success |
| RTP_INVALID_VALUE | if handler is nullptr |
| rtp_error_t uvgrtp::media_stream::install_receive_hook | ( | void * | arg, |
| void(* | hook )(void *, uvgrtp::frame::rtp_frame *) ) |
Asynchronous way of getting frames.
The receive hook is an alternative to polling frames using uvgrtp::media_stream::pull_frame(). Instead of the application asking from uvgRTP if there are any new frames available, uvgRTP will notify the application when a frame has been received.
The hook should not be used for media processing as it will block the receiver from reading more frames. Instead, it should only be used as an interface between uvgRTP and the calling application where the frame hand-off happens.
| arg | Optional argument that is passed to the hook when it is called, can be set to nullptr |
| hook | Function pointer to the receive hook that uvgRTP should call |
| RTP_OK | On success |
| RTP_INVALID_VALUE | If hook is nullptr |
| rtp_error_t uvgrtp::rtcp::install_receiver_hook | ( | void(* | handler )(uvgrtp::frame::rtcp_rr *) | ) |
Install a callback for incoming RTCP Receiver Reports.
| handler | Function to call when a Receiver Report is received |
| RTP_OK | on success |
| RTP_INVALID_VALUE | if handler is nullptr |
| rtp_error_t uvgrtp::rtcp::install_sdes_hook | ( | void(* | handler )(uvgrtp::frame::rtcp_sdes *) | ) |
Install a callback for incoming RTCP SDES packets.
| handler | Function to call when an SDES packet is received |
| RTP_OK | on success |
| RTP_INVALID_VALUE | if handler is nullptr |
| rtp_error_t uvgrtp::rtcp::install_send_app_hook | ( | const char * | app_name, |
| uint8_t *(* | send_hook )(uint8_t *subtype, uint32_t *payload_len, void *user_arg), | ||
| void * | user_arg ) |
Install a hook for generating RTCP APP packets during RTCP reporting.
This function installs a C-style callback that is called every time RTCP packets are being prepared for sending. The callback is responsible for returning a pointer to the payload data and filling in subtype and length. The returned buffer must be allocated on the heap using new uint8_t[] and will be freed by uvgRTP.
| app_name | Name of the APP item, must be 4 ASCII characters |
| send_hook | Function pointer for the hook |
| user_arg | User-provided pointer passed to the callback |
| RTP_OK | On success |
| RTP_INVALID_VALUE | If input is invalid |
| rtp_error_t uvgrtp::rtcp::install_sender_hook | ( | void(* | handler )(uvgrtp::frame::rtcp_sr *) | ) |
Install a callback for incoming RTCP Sender Reports.
| handler | Function to call when a Sender Report is received |
| RTP_OK | on success |
| RTP_INVALID_VALUE | if handler is nullptr |
| UVGRTP_EXPORT uint64_t uvgrtp::clock::ntp::now | ( | ) |
Get current time in NTP units.
| uvgrtp::frame::rtp_frame * uvgrtp::media_stream::pull_frame | ( | ) |
Poll a frame indefinitely from the media stream object.
| uvgrtp::frame::rtp_frame* | On success |
| nullptr | If an unrecoverable error occurred |
| uvgrtp::frame::rtp_frame * uvgrtp::media_stream::pull_frame | ( | size_t | timeout_ms | ) |
Poll a frame for a specified time from the media stream object.
| timeout_ms | How long to wait for a frame, in milliseconds |
| uvgrtp::frame::rtp_frame* | On success |
| nullptr | If a frame was not received within the specified time limit or in case of an error |
| rtp_error_t uvgrtp::media_stream::push_frame | ( | uint8_t * | data, |
| size_t | data_len, | ||
| int | rtp_flags ) |
Send data to remote participant with a custom timestamp.
If so specified either by the selected media format and/or given RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes, or to any other size defined by the application using RCC_MTU_SIZE.
The frame is automatically reconstructed by the receiver if all fragments have been received successfully.
| data | Pointer to data that should be sent, uvgRTP does not take ownership of the memory |
| data_len | Length of data |
| rtp_flags | Optional flags, see RTP_FLAGS for more details |
| RTP_OK | On success |
| RTP_INVALID_VALUE | If one of the parameters is invalid |
| RTP_MEMORY_ERROR | If the data chunk is too large to be processed |
| RTP_SEND_ERROR | If uvgRTP failed to send the data to remote |
| RTP_GENERIC_ERROR | If an unspecified error occurred |
| rtp_error_t uvgrtp::media_stream::push_frame | ( | uint8_t * | data, |
| size_t | data_len, | ||
| uint32_t | ts, | ||
| int | rtp_flags ) |
Send data to remote participant with a custom timestamp.
If so specified either by the selected media format and/or given RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes, or to any other size defined by the application using RCC_MTU_SIZE.
The frame is automatically reconstructed by the receiver if all fragments have been received successfully.
If the application wishes, it may override uvgRTP's own timestamp calculations and provide timestamping information for the stream itself. This requires that the application provides a sensible value for the ts parameter. If RTCP has been enabled, uvgrtp::rtcp::set_ts_info() should have been called.
| data | Pointer to data that should be sent, uvgRTP does not take ownership of the memory |
| data_len | Length of data |
| ts | 32-bit timestamp value for the data |
| rtp_flags | Optional flags, see RTP_FLAGS for more details |
| RTP_OK | On success |
| RTP_INVALID_VALUE | If one of the parameters is invalid |
| RTP_MEMORY_ERROR | If the data chunk is too large to be processed |
| RTP_SEND_ERROR | If uvgRTP failed to send the data to remote |
| RTP_GENERIC_ERROR | If an unspecified error occurred |
| rtp_error_t uvgrtp::media_stream::push_frame | ( | uint8_t * | data, |
| size_t | data_len, | ||
| uint32_t | ts, | ||
| uint64_t | ntp_ts, | ||
| int | rtp_flags ) |
Send data to remote participant with custom RTP and NTP timestamps.
If so specified either by the selected media format and/or given RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes, or to any other size defined by the application using RCC_MTU_SIZE.
The frame is automatically reconstructed by the receiver if all fragments have been received successfully.
If the application wishes, it may override uvgRTP's own timestamp calculations and provide timestamping information for the stream itself. This requires that the application provides a sensible value for the ts parameter. If RTCP has been enabled, uvgrtp::rtcp::set_ts_info() should have been called.
| data | Pointer to data that should be sent, uvgRTP does not take ownership of the memory |
| data_len | Length of data |
| ts | 32-bit RTP timestamp for the packet |
| ntp_ts | 64-bit NTP timestamp value of when the packet's data was sampled. NTP timestamp is a 64-bit unsigned fixed-point number with the integer part (seconds) in the first 32 bits and the fractional part (fractional seconds) in the last 32 bits. Used for synchronizing multiple streams. |
| rtp_flags | Optional flags, see RTP_FLAGS for more details |
| RTP_OK | On success |
| RTP_INVALID_VALUE | If one of the parameters is invalid |
| RTP_MEMORY_ERROR | If the data chunk is too large to be processed |
| RTP_SEND_ERROR | If uvgRTP failed to send the data to remote |
| RTP_GENERIC_ERROR | If an unspecified error occurred |
| rtp_error_t uvgrtp::rtcp::remove_all_hooks | ( | ) |
Remove all installed reception RTCP packet hook, but not app send hook.
| RTP_OK | on success |
| rtp_error_t uvgrtp::rtcp::remove_send_app_hook | ( | const char * | app_name | ) |
Remove a previously installed APP sending hook.
| app_name | Four-character name of the APP hook to remove |
| RTP_OK | on success |
| RTP_NOT_FOUND | if hook was not found |
| rtp_error_t uvgrtp::rtcp::send_app_packet | ( | const char * | name, |
| uint8_t | subtype, | ||
| uint32_t | payload_len, | ||
| const uint8_t * | payload ) |
Send an RTCP APP packet.
| name | Four-character name of the APP packet (e.g., "STAT") |
| subtype | Subtype (0-31) for the APP message |
| payload_len | Size of payload in bytes |
| payload | Pointer to payload data |
| RTP_OK | on success |
| RTP_MEMORY_ERROR | if allocation fails |
| RTP_GENERIC_ERROR | if sending fails |
| rtp_error_t uvgrtp::rtcp::send_bye_packet | ( | const uint32_t * | ssrcs, |
| size_t | count ) |
Send an RTCP BYE packet to indicate stream end.
| ssrcs | Array of SSRCs to include in the BYE |
| count | Number of SSRCs in the array |
| RTP_OK | on success |
| RTP_INVALID_VALUE | on invalid parameters |
| void uvgrtp::rtcp::set_ts_info | ( | uint64_t | clock_start, |
| uint32_t | clock_rate, | ||
| uint32_t | rtp_ts_start ) |
Provide timestamping information for RTCP.
If the application wishes to timestamp the stream itself and it has enabled RTCP (via RCE_RTCP), it should provide timestamping information for RTCP so sensible synchronization values can be calculated for Sender Reports.
You can use uvgrtp::clock::ntp::now() to get the current NTP timestamp.
| clock_start | NTP timestamp at t = 0 |
| clock_rate | Clock rate of the media (Hz) |
| rtp_ts_start | RTP timestamp at t = 0 |
| rtp_error_t uvgrtp::media_stream::start_zrtp | ( | ) |
Start the ZRTP negotiation manually.
There are two ways to use ZRTP:
| RTP_OK | On success |
| RTP_TIMEOUT | If ZRTP timed out |
| RTP_GENERIC_ERROR | On other errors |
| uvgrtp::context::~context | ( | ) |
RTP context destructor.
This does not destroy active sessions. They must be destroyed manually by calling uvgrtp::context::destroy_session()