Deallocate frames in example code

This commit is contained in:
Aaro Altonen 2020-05-15 07:46:50 +03:00
parent d287972f70
commit c0cb1a7cf2
4 changed files with 13 additions and 1 deletions

View File

@ -61,8 +61,11 @@ int main(void)
/* If the difference is more than 10 seconds, it's very likely that the frame was dropped
* and this latency value is bogus and should be discarded */
if (diff <= 10 * 1000 * 1000)
if (diff >= 10 * 1000 * 1000)
frames--;
else
total += diff;
offset += csize;
}
rtp_ctx.destroy_session(sess);

View File

@ -47,6 +47,9 @@ int main(void)
fprintf(stderr, "frame was corrupted during transfer!\n");
}
/* the frame must be destroyed manually */
(void)uvg_rtp::frame::dealloc_frame(frame);
/* Session must be destroyed manually */
ctx.destroy_session(sess);

View File

@ -33,6 +33,9 @@ void thread_func(void)
for (;;) {
auto frame = recv->pull_frame();
fprintf(stderr, "Message: '%s'\n", frame->payload);
/* the frame must be destroyed manually */
(void)uvg_rtp::frame::dealloc_frame(frame);
}
}

View File

@ -16,6 +16,9 @@ void thread_func(void)
for (;;) {
auto frame = recv->pull_frame();
fprintf(stderr, "Message: '%s'\n", frame->payload);
/* the frame must be destroyed manually */
(void)uvg_rtp::frame::dealloc_frame(frame);
}
}