Deallocate frames in example code
This commit is contained in:
parent
d287972f70
commit
c0cb1a7cf2
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue