uvgRTP
|
Public Member Functions | |
rtp_error_t | add_srtp_ctx (uint8_t *key, uint8_t *salt) |
rtp_error_t | push_frame (uint8_t *data, size_t data_len, int flags) |
rtp_error_t | push_frame (uint8_t *data, size_t data_len, uint32_t ts, int flags) |
rtp_error_t | push_frame (std::unique_ptr< uint8_t[]> data, size_t data_len, int flags) |
rtp_error_t | push_frame (std::unique_ptr< uint8_t[]> data, size_t data_len, uint32_t ts, int flags) |
uvgrtp::frame::rtp_frame * | pull_frame () |
Poll a frame indefinetily from the media stream object. More... | |
uvgrtp::frame::rtp_frame * | pull_frame (size_t timeout) |
Poll a frame for a specified time from the media stream object. More... | |
rtp_error_t | install_receive_hook (void *arg, void(*hook)(void *, uvgrtp::frame::rtp_frame *)) |
rtp_error_t | configure_ctx (int flag, ssize_t value) |
Configure the media stream, see RTP_CTX_CONFIGURATION_FLAGS for more details. More... | |
uvgrtp::rtcp * | get_rtcp () |
Get pointer to the RTCP object of the media stream. More... | |
rtp_error_t uvgrtp::media_stream::configure_ctx | ( | int | 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_INVALID_VALUE | If the provided configuration flag is not supported |
RTP_GENERIC_ERROR | If setsockopt(2) failed |
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 from 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 |
rtp_error_t uvgrtp::media_stream::install_receive_hook | ( | void * | arg, |
void(*)(void *, uvgrtp::frame::rtp_frame *) | hook | ||
) |
Alternative to pull_frame(). The provided hook is called when a frame is received.
"arg" is optional argument that is passed to hook when it is called. It may be nullptr
NOTE: Hook should not be used to process the frame but it should be a place where the frame handout happens from uvgRTP to application
Return RTP_OK on success Return RTP_INVALID_VALUE if "hook" is nullptr
uvgrtp::frame::rtp_frame* uvgrtp::media_stream::pull_frame | ( | ) |
Poll a frame indefinetily from the media stream object.
When a frame is received, it is put into the frame vector of the receiver Calling application can poll frames by calling pull_frame().
NOTE: pull_frame() is a blocking operation and a separate thread should be spawned for it!
You can specify for how long should pull_frame() block by giving "timeout" parameter that denotes how long pull_frame() will wait for an incoming frame in milliseconds
Return pointer to RTP frame on success
uvgrtp::frame::rtp_frame* uvgrtp::media_stream::pull_frame | ( | size_t | timeout | ) |
Poll a frame for a specified time from the media stream object.
When a frame is received, it is put into the frame vector of the receiver Calling application can poll frames by calling pull_frame().
NOTE: pull_frame() is a blocking operation and a separate thread should be spawned for it!
You can specify for how long should pull_frame() block by giving "timeout" parameter that denotes how long pull_frame() will wait for an incoming frame in milliseconds
Return pointer to RTP frame on success
rtp_error_t uvgrtp::media_stream::push_frame | ( | uint8_t * | data, |
size_t | data_len, | ||
int | flags | ||
) |
Split "data" into 1500 byte chunks and send them to remote
NOTE: If SCD has been enabled, calling this version of push_frame() requires either that the caller has given a deallocation callback to SCD OR that "flags" contains flags "RTP_COPY"
NOTE: Each push_frame() sends one discrete frame of data. If the input frame is fragmented, calling application should call push_frame() with RTP_MORE and RTP_SLICE flags to prevent uvgRTP from flushing the frame queue after push_frame().
push_frame(..., RTP_MORE | RTP_SLICE); // more data coming in, do not flush queue push_frame(..., RTP_MORE | RTP_SLICE); // more data coming in, do not flush queue push_frame(..., RTP_SLICE); // no more data coming in, flush queue
If user wishes to manage RTP timestamps himself, he may pass "ts" to push_frame() which forces uvgRTP to use that timestamp for all RTP packets of "data".
Return RTP_OK success Return RTP_INVALID_VALUE if one of the parameters are invalid Return RTP_MEMORY_ERROR if the data chunk is too large to be processed Return RTP_SEND_ERROR if uvgRTP failed to send the data to remote Return RTP_GENERIC_ERROR for any other error condition