Fix example code
Some of the code used the old API, now fixed
This commit is contained in:
parent
729db0c928
commit
9472c4142c
|
@ -4,7 +4,9 @@
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
kvz_rtp::writer *writer = ctx.create_writer("127.0.0.1", 5566);
|
||||
kvz_rtp::context ctx;
|
||||
|
||||
kvz_rtp::writer *writer = ctx.create_writer("127.0.0.1", 5566, RTP_FORMAT_GENERIC);
|
||||
|
||||
(void)writer->start();
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
kvz_rtp::writer *writer = ctx.create_writer("127.0.0.1", 5566, 8888);
|
||||
kvz_rtp::context ctx;
|
||||
|
||||
kvz_rtp::writer *writer = ctx.create_writer("127.0.0.1", 5566, 8888, RTP_FORMAT_GENERIC);
|
||||
|
||||
(void)writer->start();
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@ void dealloc_hook(void *mem)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
kvz_rtp::writer *writer = ctx.create_writer("127.0.0.1", 5566, 8888);
|
||||
kvz_rtp::context ctx;
|
||||
|
||||
kvz_rtp::writer *writer = ctx.create_writer("127.0.0.1", 5566, 8888, RTP_FORMAT_GENERIC);
|
||||
|
||||
/* When SCD has processed this memory chunk, it will call dealloc_hook()
|
||||
* which will do all necessary deallocation steps required by the application
|
||||
|
|
|
@ -9,11 +9,22 @@ int main(int argc, char **argv)
|
|||
kvz_rtp::context ctx;
|
||||
|
||||
/* Creating a writer is very simple: all that needs to be provided is the
|
||||
* destination address and port.
|
||||
* destination address and port, and media type
|
||||
*
|
||||
* "RTP_FORMAT_GENERIC" means that no assumptions should be made about the data
|
||||
* and it should be sent as it.
|
||||
* This can be used for example raw video/raw audio or for media formats not supported
|
||||
* by the library
|
||||
*
|
||||
* If "RTP_FORMAT_HEVC" is provided, push_frame() splits the buffer into NAL units
|
||||
* and sends these NAL units in one or more RTP frames (if NAL unit size > MTU,
|
||||
* the NAL unit is split into fragments)
|
||||
* HEVC frame receiver will reconstruct the frame from these fragments and return
|
||||
* complete NAL units back
|
||||
*
|
||||
* Source port is an optional argument that can be provided if UDP hole
|
||||
* punching is utilized */
|
||||
kvz_rtp::writer *writer = ctx.create_writer("127.0.0.1", 5566, 8888);
|
||||
kvz_rtp::writer *writer = ctx.create_writer("127.0.0.1", 5566, 8888, RTP_FORMAT_GENERIC);
|
||||
|
||||
/* Before the writer can be used, it must be started.
|
||||
* This initializes the underlying socket and all needed data structures */
|
||||
|
@ -23,21 +34,8 @@ int main(int argc, char **argv)
|
|||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
|
||||
/* Sending data is as simple as calling push_frame()
|
||||
*
|
||||
* "RTP_FORMAT_GENERIC" means that no assumptions should be made about the data
|
||||
* and it should be sent as it.
|
||||
* This can be used for example raw video/raw audio or for media formats not supported
|
||||
* by the library
|
||||
*
|
||||
* If "RTP_FORMAT_HEVC" is provided, push_frame() splits the buffer into NAL units
|
||||
* and sends these NAL units in one or more RTP frames (if NAL unit size > MTU,
|
||||
* the NAL unit is split into fragments)
|
||||
* HEVC frame receiver will reconstruct the frame from these fragments and return
|
||||
* complete NAL units back
|
||||
*
|
||||
*/
|
||||
if (writer->push_frame(buffer, PAYLOAD_MAXLEN, RTP_FORMAT_GENERIC) != RTP_OK) {
|
||||
/* Sending data is as simple as calling push_frame() */
|
||||
if (writer->push_frame(buffer, PAYLOAD_MAXLEN, RTP_NO_FLAGS) != RTP_OK) {
|
||||
fprintf(stderr, "Failed to send RTP frame!");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue