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
Based on the information gotten from Richard Fuchs
document the main objects in the code, to let the code be more
understandable for other code readers.
Mainly documented:
- call
- call_monologue
- call_subscription
- call_media
- packet_stream
- stream_fd
- sink_handler
- rtpe_callhash / rtpe_callhash_lock
Change-Id: I0cf122bea2d9c3f198b48da134a70301564ff1f9
Only skip forwarding unknown payload types in the kernel module if
there's reason to skip them, i.e. when we know that certain payload
types must be handled in userspace. Use an explicit flag to signal this
to the kernel module instead of implicitly doing it for anything that is
RTP.
Change-Id: I655317afe64a27252bf7b8be6c78418db2e1ccef
Instead of just leaving the transport protocol unset when we know we're
not supposed to be aware of the protocol, add a special entry to
suppress the pointless warning message.
Change-Id: I228c2f1652320627f974d9d7bcb0b1345adce2be
The packet must be decrypted first before RTP padding can be considered,
as the padding count is part of the encrypted payload as well.
Change-Id: I6aecff636efd420401856bb8110b3d784f989179
This makes it possible to have different media silencing options for
different outputs. Functionally this commit alone is a no-op.
Change-Id: I967c3e07ea4645bb49ccb76db12d51ded2d72f06
Make kernelize_one eturn the list of sorted payload types back to the
calling function instead of only keeping it temporarily. This makes it
possible to re-use the list in repeated invocations of the same
function.
Change-Id: I696b4d033715bb60c80c8b932b80d558f364a5c5
Don't keep the flag for "no kernel support" set indefinitely as
conditions might change, re-enabling kernel support at a later time.
Change-Id: Id8f456b653f1ea3d6a9db1ff3a0800d3cca8fcc5
Create a dedicated struct to hold certain attributes shared by both sink
handlers and media subscriptions, as a preparation to simplify handling
these attributs.
Change-Id: I866159c33ed6d6a2873d2cf68c4906ea705d253e
Zero SSRC are technically invalid, but the code accepts them as valid
and therefore sets up things like crypto contexts for zero SSRCs.
Consequently it's possible to have a zero SSRC first in the list of
SSRCs and other valid SSRCs later in the list, which means we can't use
the presence of a non-zero SSRC first in the list as a flag to determine
whether SSRC tracking is in use or not. Use an explicit flag instead.
Change-Id: I88736e5d6b0f66c58f8d675137231760951e7610
Don't increase the index pointer before using it. This fixes slots 1 and
2 being filled before slot 0, which ends up filling slots 0 and 2 first
(due to swapping with slot 0), leaving slot 1 empty.
Change-Id: If34cf561fcb153edde6408252c3286c8c80991bc
When ports are closed early (while the call is still running), we must
first update a slave rtpengine with this new information (that these
ports are now closed) before actually releasing the ports ourselves. Not
doing so leads to a race condition where the master instance re-uses a
port that was just closed before the slave instance knows about the port
being closed.
We implement this using a thread-local list to keep track of ports that
were released while processing a control message, and process this list
to actually close the ports only after Redis has been updated.
Additional calls to the function to close the ports are placed in
strategic locations to make sure this is triggered in every code path.
closes#1495
Change-Id: I803f4594f30ca315da0b84c6e76893f54ca3a7c9
Initialising the other members of this struct is not really necessary as
they're not used in the hash lookup. But let's do it anyway.
Change-Id: Ia7cf982fe91e9c4d273b1fc2d2ee8b19ce345a13
Warned-by: coverity
There's no need to open ports on non-primary interfaces if ICE is not in
use as these ports will not be used or seen by anyone.
This mostly obsoletes the `save-interface-ports` config option, with the
exception of ICE advertised by the offerer. We currently have no option
to reject ICE from the offerer during the offer phase, so ports would
always be opened on that side.
Relevant to #1164 and 001abe5
Change-Id: I43df70bc0ec49b81f63aec97c776e48617b2acfd
We must now hold the master lock for reads from the socket as the socket
may get closed after the poller has already fired an event for it.
Change-Id: I1ab4b38f09988e8569a70c449de17c208ef2aa96
This is useful for functions which are used both from a timer and from
other callers. These functions would reset the logging context at their
end to free the reference held by the logging context, which would
wrongly reset the logging context when the same function was called from
a different code path. Using a stack with push/pop semantics makes it
safe to use these functions from any code path.
Additionally introduce an explicit reset function that clears the entire
stack regardless of context. This reset function is called at the end of
every work iteration in every worker thread, just in case not everything
was popped from the stack.
Change-Id: I0e2c142b95806b26473c65a882737e39d161d24d
Not only check for the presence of a sink, but also check for a sink FD.
Treat a sink without an FD as if there is no sink.
Closes#1401
Change-Id: I04c0be33f8cae39399674ca0a87185a729daa843
Flag a socket with an error strike when packets are received too fast,
and refuse processing once too many strikes have occurred. This should
prevent forwarding loops from taking down the system.
Change-Id: Idc574f2f1dbbcb156efc37a80e903dc4e60ef1b1
Distinguish between unconfirming the learned peer address and
retriggering the kernel stream. In particular we don't want to unconfirm
the sinks every time we confirmed our own peer, as that starts an
unconfirm/reconfirm loop.
Change-Id: I1f172385aefeacbc4585729bce25fbc68f04c2bd
We may have multiple subscribers, some of which may be dead/unused. We
don't care if we have these since we don't forward to them anyway.
possibly relevant for #1337
Change-Id: I3cded5080aa2005e9dd615cccf60bd4cba5feb7d
Set NO_KERNEL_SUPPORT when we don't actually kernelise the stream, and
use that flag when trying to pull stream stats.
probably closes#1337
Change-Id: I46af55e353d87c5afdda3c106d1f3470273105bf
The advertised address might be empty (trickle ICE) so use the FILLED
flag instead to see if the sink is eligible.
Change-Id: I114bd7400ccfcc3ecbc871bdcc5aee4e7d699816
This fixes a race condition: Peer sends updated SDP with new address,
but an older RTP packet from the old address is received afterwards.
Thsi triggers learning of this old address is the "correct" endpoint.
Afterwards the peer stops sending RTP until a packet to the new endpoint
is received there, which never happens because the new endpoint has been
discarded in favour of the "learned" old one.
closes#817
Change-Id: I508f465a669f03e35ddcc6e770d5e7859e57569f
Move RTCP processing down into the egress section and run the processing
function once for each output, because the output media must be known
when processing RTCP RRs during transcoding.
closes#1298
Change-Id: I1797bef336e27a7064b9f42ab8c25f0aade02e47
This solves problems when the same SSRC is looped through the same call
multiple times in different mono/dialogues, with different parameters.
Change-Id: I1d033cb1f012574d82b5bcbfffe11eb5f983cfd8
GLib 2.68 deprecates g_memdup() in favour of g_memdup2() as the former
was using a guint second argument which could lead to integer overflows
(gsize should be used instead).
Change-Id: Iaa3e3b1ecaab00d1ac887c915397b15b7204dd11
The SSRC mapping strategy can change if a re-invite disengages
transcoding, therefore we always need to update the output SSRC mapping
even if the SSRC entry has already existed, to avoid stray SSRC changes.
Change-Id: Ib6f14ede1a4e615ff5eb8372cc68bf1acdd4b6c8
(cherry picked from commit dd7acd2644)
When set to `false`, no changes at all. (default)
When set to `true`, bind only one desired family local address.
Also add info in rtpengine.pod file.
Also add log for sfd with no call.
The previous approach causes problems during re-invites with updated
port (or address) information. The UA might delay actually using the new
endpoint until after the answer is seen, in which case rtpengine would
erroneously immediately latch on to the old endpoint. We need to
reinstate the endpoint learning delay in all cases, and make sure
previously learned endpoints are forgotten whenever a new signal is
seen.
Change-Id: If42ed13c43710616c02cdf018b36a4543d7f6bfe
Useful when someone needs to:
- completely drop early media, but stop dropping after call is answered.
- completely drop initial invite media, but stop dropping after re-invite
fix cleanup being skipped on redis slaves
fixes an SDES related Redis mem leak
adds a hash for the ports free list to avoid duplicate entries
fixes#898
Change-Id: I34aad67290ff5ef8824142682aac03cb600d0ecb
If `strict source` is set, we can now also kernelise RTCP ports. This
will engage the kernel module's source address checking. If the check
fails, the packet is discarded. Otherwise it's passed to user space
as usual.
Change-Id: Ieedf39fba2263045b0f1faafa7f5826a27b5a115
Instead of just remembering the last seen RTP payload type, this adds a
tracker that keeps track of the last 32 seen payload types and keep the
list in order of how often each type was seen.
Change-Id: I062a43b7bfc9413b755dca548d72953ff8245477