Added helper functions, commented the examples with larger explanation at the beginning and small comments in the important areas. |
||
---|---|---|
.. | ||
.gitignore | ||
README.md | ||
binding.cc | ||
configuration.cc | ||
custom_timestamps.cc | ||
receiving_hook.cc | ||
receiving_poll.cc | ||
rtcp_hook.cc | ||
sending.cc | ||
sending_generic.cc | ||
srtp_user.cc | ||
srtp_zrtp.cc | ||
uvgRTP_examples.pro | ||
zrtp_multistream.cc |
README.md
uvgRTP example codes
This directory contains a collection of simple and thoroughly commented examples that demonstrate how to use uvgRTP.
Below is a very simple example usage of uvgRTP:
#include <uvgrtp/lib.hh>
/* g++ main.cc -luvgrtp -lpthread && ./a.out */
int main(void)
{
uvgrtp::context ctx;
uvgrtp::session *sess = ctx.create_session("127.0.0.1");
uvgrtp::media_stream *strm = sess->create_stream(8888, 8888, RTP_FORMAT_GENERIC, RTP_NO_FLAGS);
char *message = (char *)"Hello, world!";
size_t msg_len = strlen(message) + 1;
for (;;) {
strm->push_frame((uint8_t *)message, msg_len, RTP_NO_FLAGS);
auto frame = strm->pull_frame();
fprintf(stderr, "Message: '%s'\n", frame->payload);
uvgrtp::frame::dealloc_frame(frame);
}
}
Basic RTP functionality
How to create a simple RTP sender
How to create a simple RTP receiver (hooking)
NOTE: The hook should not be used for media processing. It should be used as interface between application and library where the frame hand-off happens.
How to create a simple RTP receiver (polling)
Advanced RTP functionality
How to configure uvgRTP context
How to fragment generic media types
How to enable UDP hole punching
How to use custom timestamps correctly
RTCP
How to use RTCP instance (hooking)