In the file implementations follow the rules:
1. Firstly goes the correlated header file, then one empty row.
2. Secondly go system headers, so in angle-brackets, then one empty row.
3. Thirdly, go custom header files, so in double quotes,
then one empty row.
4. If there is "xt_RTPENGINE.h", it's mentioned next, but separately,
then one empty row.
5. If there are pre-processor definitions, they are added.
6. And eventually at least one empty row before the code.
In some situations it's allowed to step aside from the rules,
when inclusions are dependent on each other, so on the sequence,
and also possibly on some inline objects definitions, but if possible
to follow the rules, it's being done.
Change-Id: Ie512a970e230fe202398656d1942e8874bb14cd9
gcc <12 propagates the const-ness of the given value to the newly
declared variable with __auto_type, leading to silly "can't assign to
const variable" errors. Work around this with an ugly macro.
Change-Id: Ic952c094c24bd802379fc10ad19d559613b2c1d0
Allow codec_tracker_update to reference an existing codec_store. Then
when a supplemental codec type needs to be generated, make it look up
the type in the existing codec_store and re-use the existing payload
type if present instead of creating a new one. This allows payload type
numbers to remain unchanged during a re-invite.
Change-Id: I9e5edd897515a5e3eb5033aa6bbf21c8667d6133
During an offer, we update the codecs from the given list not only on
the side of the offerer, but also on the answerer's side, in order to
perform the codec answer routine during the answer phase. While doing
this, we empty out the existing list of codecs (on both sides) and
repopulate it fresh from the given list.
This can cause problems during a reverse re-invite, when the list of
codecs on the answerer's side already contained the codecs that had been
offered before. When setting up the new re-invite offer, we want to
retain codecs (and their payload types and format parameters) that were
already in place, instead of recreating a new list from scratch.
Improve this by adding a `merge_cs` option to the populating functions,
which points back to the stream_params codec_store. Codecs that would
have been removed from the codec_store during the repopulation are then
moved back into the stream_params codec_store instead. This then allows
the functions adding new codecs to the list (offer/transcode) to
reference these codecs that were previously in place, and so they can be
added back with the same options as they had existed before, instead of
recreating them from scratch.
Change-Id: I53e7ab10e9144a308a5c36be5ebfddd73c212f06
In case of repeated answers without additional offer in between, we
shouldn't reset the codec tracker status at the end of the codec answer
routine, so that we end up with the same state during the next answer.
Change-Id: I54f6136cc5684473553b4862c13ea9f4a3dcfe99
In the `dialogue_unconfirm()` (previously `dialogue_unkernelize()`)
use media subscriptions to find subscribers/subscriptions
and correlated to them medias to unconfirm them.
This change is bound to the switch from monologue
subscriptions to media subscriptions.
Additionally: Refactor unkernelize/unconfirm in `call.c`
To provide a sense of the functions clearer,
the namings of the following function singatures
have been changed:
- `dialogue_unkernelize()` -> `dialogue_unconfirm()`
- `__monologue_unkernelize()` -> `__monologue_unconfirm()`
Change-Id: If8cc2515eb26dcc4ffed02a420514f98d43cc5c6
If we're updating the handlers for one particular source -> sink flow,
only stop/reset the handlers matching this flow.
Change-Id: I1d046f47f8d26cac47c5d0f4318498eacb6c5677
Start using media subscriptions instead of call subscriptions
in the `codec_update_all_handlers()`, because older concept
gets deprecated.
Change-Id: I1cbd5379855e557099894f4b9a508a65ca78214c
previously, dtmf_inject wouldn't add the events as the dtmf_payload_type
was set to -1 as part of the delay buffer handling. However, as we
know we want this DTMF, this change updates the function to check for
and use the real_dtmf_payload_type value
Then, in codec_add_dtmf_event, we can check the injected bool and
if set, use the real_dtmf_payload_type again to decide whether to
push the event onto the queue
closes#1722
Change-Id: I34e35f92e014f4aed9e045737df7400155b86602
Start using the media subscriptions model
(based on newly introduced `media_subscription` objects)
in scope of `codec_update_all_source_handlers()`.
Change-Id: I29da49cdd2b5de8c6e6f9a6629f5b1f3867596ba
Previous implementation assumes that we use the `call_subscription`
objects in:
- `call_offer_answer_ng()`
- `call_update_lookup_udp()`
- `call_request_lookup_tcp()`
when appealing to the `call_get_mono_dialogue()`, in order to
get the `call_subscription` objects, in order to then pass it
for usage in the `monologue_offer_answer()`, where the most important
again is to use monologue references stored inside
the given `call_subscription` objects.
Instead of using the `call_subscription`, just use `call_monologue`
objects as a base data objects for this work,
which will allow us in the coming commits to deprecate
the `call_subscriptions` based model and
get to the subscription model based on medias.
Change-Id: Ia9ee5ba66522929acbceca28854ebccd3705635a
This HT is needed when updating UDPTL/T.38 handlers, on both sides of
the call. Make sure the HT exists.
Change-Id: Ic85684bbd2a746ff490d06008eadfae664e9f8a9
When we're duplicating the packet contents, we must also update the RTP
header pointer accordingly.
Fixup for fa819e3a73
Change-Id: I66117b2ad15a9adfaabaa1dbc67179bb1817f5e9
Transcoding is flow-specific, so it doesn't make sense to have a flag
for it in a call_media section. Instead we use the transcoding flag set
on the call_subscription objects (on subscribers), and set/unset a flag
on the monologue struct, depending on whether any media flows (going to
subscribers) have transcoding enabled.
Change-Id: Id671d56e56a22eaa8e56f6d449770b0c7b086cea
Pass the subscription object to codec_handlers_update to eliminate the
need for a return type and the subsequent if/else.
Change-Id: I311b3e8ca14ee5090cf329163975354385cee800
Simply stripping a supplemental codec doesn't actually affect the
remaining real codecs. Add a special-cased version of codec_touched() to
ignore such a manipulation.
Add a matching test case.
Change-Id: I4a91292dd38e1114837c2dc841afe07d87cff6cb
Don't try to interpret or schedule DTMF packets if we're just doing RTP
passthrough.
Without tracking the seqencing and timestamping of the primary media
stream, we cannot actually schedule DTMF packets properly. Use the
presence of a defined output sequence number to make this determination.
The other case that uses a predefined output sequence number is when
media is coming from a pre-coded media player stream. The same thing
applies: These packets are already scheduled, so we can skip trying to
schedule them again.
closes#1638
Change-Id: I2d2c20e731f20a3136ca3eee37f0b521062cdb11
This replicates the code to replace audio packets with injected DTMF
events. Unfortunately the code paths between forwarding audio and
processing/forwarding DTMF events is quite different, so some slight
duplication is needed.
Additionally the case of blocked DTMF + injected DTMF must be handled.
Change-Id: Ieb576b4b6644c9b154ba4c6ebd48fe12ff08e1de
Add special return value to indicate that an event was a duplicate and
should be discarded.
Functional no-op.
Change-Id: I5d40bcc4a0bc45ba7875f4132873e7b8d747e132
Add a flag to inhibit kernel mode while DTMF injection is active. Tie in
DTMF playback trigger function: Remove stream from kernel, set inhibit
flag, play DTMF, then unset inhibit flag when all events have been
injected.
Change-Id: I533ec95a676bc7edf4dd973217f8d9499f1e22b6
Support using the SSRC TS derived from received RTP packets as "encoder"
TS (the "next" expected TS) for passthrough RTP in addition to the FIFO
TS of an actual encoder.
Change-Id: I7c49c27651eb89c5349bbf290b1c0ad160f77e3b
Make the decision whether or not to use SSRC passthrough handlers in the
upper level calling function, instead of implicitly in
__make_passthrough_gsl()
Change-Id: Ied88120ea4f12d50e3c5afb96023bdd86c42c6e1
__make_passthrough_ssrc() is only used after a passthrough handler has
already been created via __make_passthrough(), and the two functions do
exactly the same thing other than using a different handler functions.
So we can skip completely shutting down the handler and creating a new
one, and only update the handler function instead.
Change-Id: I5acdb5f5508b385320dda6b8bbb18cccd315f99d
Instead of just setting the "force transcoding" flag when DTMF injection
is required, check it on a per-codec basis, so we can be more granular
with this decision.
Functional no-op.
Change-Id: I496f3d1fba5840e7870c373f94190243392db438
Using a pointer array instead of a linked lists allows us to directly
reference a media section by index number, without having to spool into
the linked list.
No functional changes.
Change-Id: I8b0e93f0c2e9addbcb4c938894118ed4a6aec768
Track audio writes in the mix buffer to set the `active` flag to true
whenever a write occurs, which makes it possible to create the buffer in
an inactivate state and implicitly set it active on demand.
Handle the mix buffer not returning any data in the RTP sending logic
(which is what happens for an inactive buffer) by simply not sending any
packets.
Change-Id: Iaeb0f6deadb3d90020c8c62872735cc94db80504
Similar to the existing media_player, but instead of simply producing
its own standalone output media stream, the audio_player takes over the
entire media stream flowing to the receiver, including media forwarded
from the opposite side of the call, as well as media produced by the
media_player.
Change-Id: Ic34ecf08fc73b04210cfffb1a7d795b462ece5ea
Extend __make_transcoder_full with a custom callback function to create
the SSRC handlers.
Functional no-op.
Change-Id: I79cfabf6e9758b105a89908f9023bd773b838d9e
Support creating transcoders with different "packet decoded" callback
functions.
Functional no-op.
Change-Id: I49ba720841161999dc0ae166ea0841dc094e8bc7
Split out the parts of __ssrc_handler_transcode_new that are related to
the decoder only, leaving the encoder-related code in a separate
function. Allow re-use of the decoder setup code.
Functional no-op.
Change-Id: Ifb91c388a872a4ca14c0cc4571f4d0578271407f
Only parse out a codec type if the codec is given with any parameters
set (and not just by name). Parsing out a codec type when just its name
is given leads to a codec type with default parameters set (such as the
number of channels) which can lead to a stricter matching than desired.
When a codec is given just by name we want to match all codecs of that
type, not just the ones with the same parameters as the default ones.
Change-Id: I583bf4045dbd55291d8dc596310730024853d386
Use dedicated functions and different code paths for the different use
cases, instead of just a single function which does if/else all the
time.
Change-Id: Ic3ab928c3605cfe4a2f48889e95a3a1ddccdbbec
This type is used as const everywhere except internally, so make it part
of the typedef for brevity.
Change-Id: Ic4afe037b392239a991d5380c6708903011da29e
1) Read dtxb->start while the lock is held (not strictly necessary as
the read should be atomic anyway)
2) Expect that dtxb->start can be larger than rtpe_now.tv
The latter can happen as `rtpe_now` in a timer thread is faked to be
exactly the time when the timer was supposed to run, and not the actual
current time, which means that a newly added packet can have a later
time stamp than the "now" the timer thread is using.
Change-Id: I48fd7f78af97c6d5b802e5151d69855a90f4032d
Some codecs (e.g. Opus) can natively encode audio with various clock
rates without producing an output that is locked to that clock rate and
without requiring resampling the input. Add an appropriate callback
function and adapt tests.
Change-Id: Id788c4d4c05e20f93cce7e910f9f265b381cbe34
This makes it possible to have codecs running at variable clock rates
that differ from their RTP clock rates.
Change-Id: Ia2f5effb82eefe8c3028573ba0a6697da28473b1
Instead of just having an integer multiplier, support a fractional
factor. This allows us to have the RTP clock rate run faster than the
audio clock rate, and not just slower by an integer factor.
Change-Id: I7681cf369c43d8424ca2d2ebeffe932595d271ec
Reset the iteration counter for the frequency list when codec handlers
are set up, which happens while setting a new block mode. This makes
sure that a newly set list of frequencies is iterated starting from the
top.
Change-Id: I7ab4e28a1a998c11e38e26cf5b1f17f01299d5ad
Support multiple tone frequencies for DTMF-security=tone to enable
audibly distinguishing multiple consecutive DTMF events from one
another.
Change-Id: I6fa33a5768aae198220d0b0cc4c53308c5661a52
The `dtmf_send` event might not have a matching entry while handling a
received DTMF event. Move bookkeeping of the random output event into
`dtmf_recv`.
Change-Id: I5507b0b7f5eca6e29cbcaccc905ab25249b22aa3
Usually supplemental RTP types (DTMF) are listed after the primary audio
codecs. In the case of the order being reversed, fix `single-codec` so
that it doesn't strip the actual audio codec that is listed after the
DTMF type.
Change-Id: I1b03b89e31bebf4de303b643dcf08d2ffb90ebaf
Similar to I7fd298669a4fd69e62edc4760ffd92eff074707b but for
codec-accept. This prefers accepting codecs that match the given
definiton exactly, but also accepts compatible codecs if no exact match
is found.
Change-Id: I52a2ab6e75f7334a85a8ef059a0d6703a07e4b7f
When adding codecs to the SDP for potential transcoding, use more
sophisticated logic to determine whether the desired codec is already
present. Previously only the raw RTP payload string was used, which
doesn't take codec-specific format options into account. The new
matching function will now also match against existing codecs with
slightly different but compatible a=fmtp options, but will not match
against those with incompatible options.
Change-Id: I7fd298669a4fd69e62edc4760ffd92eff074707b
Convenience function to get a list of all codecs that match a given
definition, including a possible exact match.
Change-Id: I2b7d49fb320ad1725b348f7d29be450e5fea925b
Make these functions return the newly created payload type object so
that it can be manipulated directly without having to do a lookup.
Change-Id: Ib035cf7d61c61d0de6d5f87dfd497d17ba28ca5f
Parse out the format parameters for a payload type object when the codec
definition is loaded. Parsing it out is done only once, and if done
early the parsed contents can be used for format checking, comparing,
matching, etc.
Change-Id: I2856e5a8d4d76e7e1e648eff4a91fc51d0ba20c2
Split up this function into two parts so that they can be used
individually. Eliminate the special 0x1 return value as this isn't used
anywhere else. Move the error reporting into
codec_make_payload_type_sup() where it belongs.
Change-Id: Id2060272d87596a3db32d8776930a98b0f226b3b
Introduce an additional function for codec matching. Different functions
match different parts of an RTP payload type object and the referenced
codecs.
Change-Id: I2e488eaa7f69a55322db748fd40c8d1195e38605
We have no use for -1/0/1 return values. Change the return type to bool
to make things more clear.
Change-Id: Iedf1d8278c6dfddddb328ce7b3b1dbae132a39b7
Parsing out the a=fmtp string has been left up to the codec init
function until now, with the values that resulted from the parsing being
stored only within the codec. Convert this to an explicit method to
parse the a=fmtp string, and introduce a dedicated struct to store the
resulting values.
Functionally this change is a no-op.
Change-Id: Ia84e26d632ed5209b4439fd82c1e4e38850fd024
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
Starting with release 5.1, ffmpeg obsoletes the `channels` and
`channel_layout` fields, replacing them with a unified `ch_layout`
struct of type AVChannelLayout. Add wrapper defines into the
compile-time build-test headers fix_frame_channel_layout*.h to
accommodate both new and old versions.
Change-Id: I3d43b85dc3140155a61b1cf2269cda166ad88e9a
Allow override the bitrate if one is already set, as opus_init()
initially sets a default bitrate, which is then overridden by codec-set.
Change-Id: Id0253d23a8f5de977e30d296872ea1df01fdbfbc
The PT tracker doesn't distinguish between audio/media types and
supplemental types, so in order not to break DTMF handling we must take
all combinations of primary (audio/media) types and supplemental types
as both input types and handler types into account.
Fix-up for 74075f6396
Fix-up for I57e1278e4fad157083d9526d4829f2940581687f
closes#1508
possibly also #1504
Change-Id: If7b242def2d35fbed14b11d204ea328b8bfe5d79
The codec answer routine resets the codec storage and so also resets the
clock rate tracker for "touched" codecs. This leads to all codecs seen
as "not touched" in the answer routine, which in turn leads to
supplemental codecs present in the answer SDP that should not be there.
Use the "for transcoding" flag for previously present codecs to retain
the "touched" status across the codec answer routine.
Change-Id: Idc4624606f7f10d7983e22ddf856432b07421157
DTX and delay buffers and their timers are shut down during the codec
negotiation phase, which also happens for the offer side while
processing an answer. If the codec negotiation routine determines that
the existing codec handlers can be kept intact, we must restart the DTX
and delay buffers that have previously been shut down.
Buffer objects are never freed during a shutdown, therefore we simply
need to restore the contained references to indicate that these buffers
are active again.
closes#1481
Change-Id: I57181ba1655fd781a7c543ee31aa67fd179ba89b