Browse Source

MT#55283 allow for delay in kernel mode

In some cases it's possible that some packets still arrive in userspace
immediately after a stream has been pushed to the kernel, for example if
some packets are already in the queue or if there is some processing
delay (e.g. writing to Redis). Allow for a short delay before counting a
stream as userspace if it has been pushed to the kernel.

Change-Id: I55a6e255868c8c2a9e93355a4aa2287f07b3748d
pull/1577/head
Richard Fuchs 3 years ago
parent
commit
8a99171200
2 changed files with 5 additions and 1 deletions
  1. +4
    -1
      daemon/media_socket.c
  2. +1
    -0
      include/call.h

+ 4
- 1
daemon/media_socket.c View File

@ -1454,6 +1454,7 @@ void kernelize(struct packet_stream *stream) {
g_slice_free1(sizeof(*redi), redi);
}
stream->kernel_time = rtpe_now.tv_sec;
PS_SET(stream, KERNELIZED);
return;
@ -1461,6 +1462,7 @@ no_kernel_warn:
ilog(LOG_WARNING, "No support for kernel packet forwarding available (%s)", nk_warn_msg);
no_kernel:
PS_SET(stream, KERNELIZED);
stream->kernel_time = rtpe_now.tv_sec;
PS_SET(stream, NO_KERNEL_SUPPORT);
}
@ -2479,7 +2481,8 @@ static int stream_packet(struct packet_handler_ctx *phc) {
RTPE_STATS_INC(packets_user);
RTPE_STATS_ADD(bytes_user, phc->s.len);
count_stream_stats_userspace(phc->mp.stream);
if (!PS_ISSET(phc->mp.stream, KERNELIZED) || rtpe_now.tv_sec > phc->mp.stream->kernel_time + 1)
count_stream_stats_userspace(phc->mp.stream);
int address_check = media_packet_address_check(phc);
if (address_check)


+ 1
- 0
include/call.h View File

@ -356,6 +356,7 @@ struct packet_stream {
ssrc_out_idx; /* LOCK: out_lock */
struct send_timer *send_timer; /* RO */
struct jitter_buffer *jb; /* RO */
time_t kernel_time;
struct stream_stats stats_in;
struct stream_stats stats_out;


Loading…
Cancel
Save