under normal circumstances, the rtp sink enters this function first
and updates the reti->local.family var to AF_INET so that when the
function is called for an rtcp sink, it exits the function early.
However, if media is being blocked the rtcp sink is the first to
enter the function and does so with a NULL payload type. this NULL
check is therefore required to prevent a sefgault on the call to `assert`.
closes#1876
Change-Id: Id95cbbc9ae388f50dd51417c351f4a9ba09eb5f0
(cherry picked from commit 8e04c44b86)
(cherry picked from commit b215562867)
We use int or unsigned int everywhere, except in a few leftover places.
Unify to (unsigned) int.
Change-Id: I0896b2f177957c17b30a3d0cb6b3fb2beb4bd684
(cherry picked from commit f60ee917c9)
If a stream has been pushed to the kernel from anything other than RTP,
even though RTP is expected, we get a forwarding entries without any
SSRCs. This is valid, but once actual RTP is received, it needs to be
passed on to user space, so that SSRC contexts can be set up.
Possible fix for #1855
Change-Id: I51b82d3cf79cf66780fdde154bebe56e0f43174b
Use the __preferred_lists_for_family queues as storage for all
logical_intf objects instead of the __logical_intf_name_family_hash hash
table. Move cleanup of logical_intf objects to cleanup of the respective
queues. Use the hash table key free function to manage the key objects.
Change-Id: I3f9628fbde0c9c71dc6afcfc95bfd54a5b12d6fa
For typed hash tables, enforce the correct type in the arguments to the
hashing and equality functions.
Adapt existing affected callback functions and change their arguments
from void* to the respective types.
Add reverse casts to GHashFunc and GEqualFunc in instances where these
functions are used in non-typed hash tables (that should be converted at
a later point).
Add convenience macro to create typed wrapper functions for hash tables
that use "direct" hashing (i.e. the pointer value).
Add wrappers for existing GLib functions that have generic arguments so
that they can be used in typed hash tables.
Change-Id: I43bb32969208f4aae49584d95c0df8353df6e2a0
This only exists because of RTCP indexing issues, but with the index
being in shared memory now, we no longer need this.
Change-Id: Ib0a69214f24a7c1edec8aa53139212ee861a6c4d
The requirement to continuously update stats from the kernel has been
eliminates. Remove all relevant code.
Change-Id: Idc8093b64290b89ff3d015f3e61e4bbe25df6e23
We now have accurate "last packet" timestamps for both user and kernel
space. Since we iterate all calls anyway, we can use these timestamps to
update the gauges.
Change-Id: If0522c387ed1fba51058129ef37a41f45d0c0c8b
... and change to 32 bit.
Remove functions to retrieve kernel stats as they don't do anything any
more.
Add RTCP index information to /list output.
Change-Id: Ia087c8c3913daf83a0749d6a048682b7248eb38b
This field is duplicated with `ext_seq`, which is already kept in shared
memory and therefore preferable.
Also update all sequence number fields to 32-bit (down from 64-bit) as
there's no need for all these extra bits.
Add output seq information to /list.
Change-Id: I0b8d8dfdf5c007c6ca75e7b50a8c900c16be21ed
Use the already existing ext_seq (in shm) in place of srtp_index as
these carry duplicate information.
Kernel still tracks its own index in the crypto context at this point.
Change data type from 64-bit to (unsigned) int as we don't need that
many bits.
Change-Id: I2468c6a814964eb64a19d84c918d3a37c2494b66
Allocate per-payload-type stats buffers in shared bufferpool. Push these
to the kernel module for direct tracking of bytes/packets stats. This
eliminates the need to return these values in the /blist data and
continuously update the userspace stats.
The accomodate updating the payload-type tracker, we use the "last
received" timestamp from the kernel module together with the "last seen
payload type" to give similar results as before.
Change-Id: I524791a1940b5d1ff2d82716c3b7a262f64e106c
This obsoletes the need to retain the last seen kernel stats and track
updates to the counters in order to set call states.
Change-Id: Ie5338bd630b679af205a16933f847ccdcd6a477e
Keep two separate timestamps, one updated by userspace code only and the
other updated by kernel only. This way we can tell where the packet
processing happens. For code that wants to report only the last
timestamp regardless of which one of the two it is, we add a convenience
function that just returns the newer one.
Change-Id: Ib3af7aa55006d8b32e2bc3db4f8bfa5514c57e40
This leaves the TOS value as the only leftover to be not in shm.
The kernel_stats structures remain for the time being as they're needed
to determine whether kernel forwarding is done or not, as well as for
global stats.
Change-Id: I158f18098e018d2870b797f1a196baa03a0e0fb7
Allocate memory from bufferpool for per-stream stats. No functional
change, but it allows sharing these between kernel and user space.
Change-Id: I370a49e1d94bb91c7fd0a2bc7d00ba65f99c4f6a
Use the kernel/user shared memory to keep track of interface stats. This
eliminates the need to update the userspace stats counters with the
values from the kernel, and vice versa when updating the kernel streams.
Add a function to reverse map userspace mapped memory address to kernel
space addresses.
Change-Id: Iaa5f9488061a12103e57faf27b3979521778cea8
There isn't any immediate benefit to this, but it prepares the code for
use of shared memory for statistics.
Use the opportunity to switch accesses to these to relaxed memory order.
Change-Id: I585fef7579202179fbbcbc1b843d3bbe440a723b
Switch all memory buffers used for RTP I/O from generic stack or heap
allocated memory to the bufferpool implementation. Use a per-thread
bufferpool to minimise lock contention.
This commit is just a one-for-one swap and doesn't use the bufferpool's
reference counting semantics yet.
Change-Id: I9cba4ec97bd0afcd374bf6c0be2b608a46e73e57
To support asynchronous pollers which may hold references on underlying
sockets, let the poller close the socket after it has released its
references. This prevents cases of file descriptor re-use while an
underlying socket is still open.
Add reset_socket() to be used in place of close_socket() which does the
same thing except the actual closing of the socket.
Add poller_del_item_callback() for cases where more action than just
closing the file descriptor is needed.
Change-Id: Iefda1487ecb89263729120ecb964436dd79b2a0e
This has been broken for a while and nobody seems to be using it since
nobody complained. Remove it.
Change-Id: I114e7b1859ecd1982338c625f4523f372af3bbe8
If multiple pollers are in use, use a single poller per call instead of
assigning pollers round-robin to each socket used in the call.
Change-Id: Iec49bd9d2fbd75d947d6232bcccfdfe87c4c6d7c