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
This include only serves to define one type, which is used only as a
pointer. Use an empty typedef declaration instead.
Change-Id: I7d2cc8b97303b9363a5bfe363fffeea09ee56686
At least the recording daemon uses the linesize directly, so this needs
to be corrected after returning a frame from the resampler.
Change-Id: Ia940d8acbbee3fb2d6564474ecb93ae27422d8af
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
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
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1012766
> Whilst working on the Reproducible Builds effort [0] we noticed that
> rtpengine could not be built reproducibly.
>
> Whilst it did use the value from debian/changelog, the RELEASE_DATE
> variable changed due to underlying system timezone setting. A patch
> is attached that passes -u/--utc to the call to date(1).
>
> [0] https://reproducible-builds.org/
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
Handling of dual stack v4/v6 was previously done by the individual
listener objects for INADDR_ANY listening addresses. If listening on
INADDR_ANY was requested, then each listener would create two instances,
one for IPv4 and one for IPv6. This works fine for INADDR_ANY but fails
for listening on host names that resolve to multiple addresses, such as
`localhost`.
Solve this by relieving the listener objects from handling this and
instead handle it in the code setting up the listeners. If a host name
resolves to multiple addresses, then set up multiple listeners (up to
two supported currently). This allows us to listen on `localhost` by
default and have both 127.0.0.1 and ::1 active. INADDR_ANY is handled
specially by also setting up :: in that case.
Change-Id: I2a1e1d7090d7d23863c7a9bb1e89b85ad2ea44f4
Needed to be able to set graphite socket timeout.
Useful when one wants rtpengine to force the graphite connection
to fail faster, in case graphite server gets filtered while
connection is ongoing.
This is useful because we log to stderr, which technically would allow
unlimited log line length, but this is in fact turned over to syslog,
which truncates log lines that are too long.
Change-Id: Iee8994842335ab1cf94941c14eced01e29120bc9
libcs are implementing changes to fix the year 2038 issue on 32 bit
platforms (see [1]). musl libc already went ahead and implemented it,
starting with musl-1.2.0 (see [2]).
This commit adds a new definition to lib/loglib.h:
TIME_T_INT_FMT
If __USE_TIME_BITS64 is defined (by a time64 libc, see [1]), it's set to
the proper conversions for type int64_t, PRId64. If __USE_TIME_BITS64 is
not defined, the status quo remains unchanged ("%ld" is used).
The new definition is used in the different parts of rtpengine, where
appropriate.
Note: Richard confirmed that the "%u" format in daemon/cdr.c is not
needed, so this gets swept under the rug.
These changes get rid of the new warnings that appeared with musl-1.2.0.
Below an example warning:
In file included from ./log.h:6,
from ../include/obj.h:94,
from ../include/media_socket.h:9,
from ../include/call.h:26,
from ../include/redis.h:15,
from redis.c:1:
redis.c: In function 'redis_check_conn':
../lib/loglib.h:56:30: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'time_t' {aka 'long long int'} [-Wformat=]
56 | __ilog(prio, "[%s] " fmt, log_level_names[system], ##__VA_ARGS__); \
| ^~~~~~~
../lib/loglib.h:64:39: note: in expansion of macro 'ilogsn'
64 | #define ilogs(system, prio, fmt, ...) ilogsn(log_level_index_ ## system, prio, fmt, ##__VA_ARGS__)
| ^~~~~~
../lib/loglib.h:63:30: note: in expansion of macro 'ilogs'
63 | #define ilog(prio, fmt, ...) ilogs(core, prio, fmt, ##__VA_ARGS__)
| ^~~~~
redis.c:887:17: note: in expansion of macro 'ilog'
887 | ilog(LOG_WARNING, "Redis server %s is disabled. Don't try RE-Establishing for %ld more seconds",
| ^~~~
[1] https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
[2] https://musl.libc.org/time64.html
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
Rebuilding everything every time a header file changes might be
overkill, but it's easy addition and much less hassle than .d files.
Change-Id: I11aeddbcc5ecc48dfca2adf249129c936c7f6d30
commit b0c722da69ad088a2eddced12b37c0546a514890
Author: Daniel Hauptmann <dhauptmann@sipwise.com>
Date: Mon Jul 26 15:35:51 2021 +0200
changed flag bit length
in call_interfaces.h changed bit length of reuse_codec from 0 to 1
commit 0313a747532d5987f25fa9edb202aa460bf98dd1
Author: Daniel Hauptmann <dhauptmann@sipwise.com>
Date: Mon Jul 26 15:29:20 2021 +0200
inversed reuse_codec logic
in test-transcode.c and call.c, reuse_codec = 0 (default) will now result in using codec_store_populate instead of codec_store_populate_reuse
commit b876bd686bd30df21a5962aca16fc1c85574f554
Author: Daniel Hauptmann <dhauptmann@sipwise.com>
Date: Mon Jul 26 15:18:19 2021 +0200
adding option to minimalize changes in the codec_store_population
added function codec_store_populate_reuse in codec.c which replaces codec_store_populate but makes fewer changes to the GLists with the old and new codecs
added flag to enable this feature (disabled by default)
commit 6fd0b701c9589b2fae00300801e02a9b5cc397ab
Author: Daniel Hauptmann <dhauptmann@sipwise.com>
Date: Mon Jul 26 14:44:42 2021 +0200
Added Option to minimize change in the codecs
In codec.c added function to populate codec store with the fewest changes between the old and new GList which contains the codecs.
Added new testroutine in test-transcode.c line 1500
Added flag to call_interfaces.h to optionally enable this feature
Change-Id: If58d9a07d114b05dfb75553a87eb4372ae949fbb
commit 3bf554a8fbae7e948343699f40d935693618b764
Author: Daniel Hauptmann <dhauptmann@sipwise.com>
Date: Fri Jul 23 13:58:02 2021 +0200
changing codec-exchange behaviour
in codec.c line 3288 function codec_store_populate now doesnt empty dst and copy new codec from src to it, instead codecs from src will be appended to dst and codec from dst, which are not
being contained by src are being removed
Change-Id: Id6b7ee65595f9cc5c71ef557c7bac5ee38f97cbe
If encoder_config errors out for some reason, avpkt may end up
uninitialised. Make sure there is an avpkt when flushing/closing the
encoder. Also make the encoder input more resilient against
half-initialised encoders for the same reason.
closes#1312
Change-Id: I44ebcf6e35f1c383aa5c8202b5d9bbf968b0d5f1
Complete overhaul of the codec handling code:
*) obsolete flags `asymmetric codecs`, `symmetric codecs`, `reorder
codecs`
*) support proper codec offer/answer
*) split codec manipulation (strip/offer/accept/etc) into separate
functions for clarity and better code maintenance
*) fully update codec handlers in both directions after an answer
*) explicit allocation and handling of codecs and payload types in a
codec_store object
*) improve codec matchup logic during answer
*) more explicit handling of supplemental codecs (CN/DTMF)
*) remove now obsolete hacks for handling certain use cases
Change-Id: I996705ba8fe339524c2f70e6bb0fd854f9a1f4fb
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
Recent ffmpeg versions have removed AVPacket from the public ABI,
therefore deprecating av_init_packet on statically allocated objects.
The replacement is av_packet_alloc()/av_packet_free().
Change-Id: I5f93fbd19e43413c3328e143cc9147fbdf12d910
When building using with_transcoding=no we should not expect spandsp to
be available as it's not even being used.
closes#1267
Change-Id: I2c8e0407b4dd46cfdd5322cd377b664955ad7c74
Using GStringChunk as a general purpose allocator leads to unaligned
memory access, which is a no-no on some archs.
Change-Id: Iea896d574da056c94932503c26c7bdf7f49be178
This makes the type in line with string(3) functions and eliminates some
compiler warnings.
Also update the related bencode data type.
Change-Id: I7ef4024f4b5a0f737b3dbe03bcd078032395bce6
If the CFLAGS already contain -O0, skip adding the hardening flags, as
they force inclusion of -O2
Change-Id: I12ab0a61fff169954c73f3a714e563234c841483
If the length of the string is zero, the pointer to the buffer may be
null. ASAN flags these as invalid/undefined, so don't do that.
Change-Id: Ic55498465c53a78e1bd44c42d1a60f9bd3336473
Since dh_auto_test doesn't execute the test suites through make
directly, but instead runs `make -s -n` and then executes the output,
the integrated build tests fail since the sub-make doesn't return an
error as it should when attempting to build with the wrong .h
alternative, resulting in always the first .h alternative being used.
Fix this by using a wrapper script instead.
Also adjust some other related minor build details.
closes#1202
Change-Id: I4b6436295c6b39117bd06df53aa5afc7118ad6a1
Whether a bit-field is signed or unsigned is implementation specific, so
we should be explicit about this.
Change-Id: I744df3d24bc08e95fa816ba4135f19cd3a5dcb17
Warned-by: lgtm
While these usages are not supposed to be security sensitive, it's still
best to avoid the usage altogether so that we do not need to think about
it. Add a taint macro so that this does not regress in the future.
Change-Id: Ic75861ed1b7ce9dfca4f897de8be2408204ce3cb
Warned-by: coverity
We only do 1 decrements/increments so the check for the upper-bound will
always catch any downward wrap-around or an upward out-of-bound.
Change-Id: Ibdb9a69e1a55f34ffca56721c310efc505b86f99
Warned-by: coverity
The dtmf_freqs array contains one less element than the check was
allowing for.
Change-Id: I783fa6bcd0bd79fad9886ee53e7a990e504ecff8
Warned-by: coverity
Make sure G.722 rate multiplies is applied in the right places
Don't trust encoders to return proper timestamps, but instead track them
explicitly based on frame duration
Change-Id: Ia9fa96cf662da97159fa170c3a3f37516889e1bd
Link the attribute value to each RTP payload type and only output it if
PT is still present
Also merge PT attribute printing into a single loop
closes#1128
Change-Id: I494498ca806b795045e9e5bbb82174fa4aef8b2b
* use auto cleanup buffer variable
* use g_vasprintf instead of libc vasprintf
* rename length variable for clarity
Change-Id: Ibebb8cccd51aa2f5cf3704b73bf82472b73d6f19
On some systems (e.g. Github Travis) make seems to have a problem with
its job control, resulting in a race condition where multiple make
instances try to build the same file at the same time. For most files
this is not a problem, but those auto-generated using an append
operation (>>) the output file can become garbled. Solve this by using
an atomic file creation method.
Change-Id: I1acb2387e2ca6ca30ddc3742143fd910032bfbb0
Why:
* When running make clean, the following files are not cleaned:
daemon/dtmf_rx_fillin-test.c
daemon/dtmf_rx_fillin-test
daemon/fix_frame_channel_layout-test.c
daemon/fix_frame_channel_layout-test
...
required to distinguish between 20-ms and 30-ms modes, both for encoding
and decoding
add support for the iLBC mode= format parameter and dynamic mode
switching
closes#854
Change-Id: Icb6f0ec80df86d27681c689c168b24f163a2db06
Log lines written to stderr that are consumed by journald will already
have timestamps added to them. Drop the redundant unixtime output for
this use case.
Change-Id: I34886a69a0ef90de2eb84ee8f446cbad624302c1
Codecs that were implicitly accepted for transcoding had no option to
set their parameters (such as bitrate) for encoding. The codec-set
option adds this.
fixes#681
Change-Id: Ib238eb73a507af168c366579abc80da07250fe88
To avoid repeated strcmp()s and make use of switch()'s optimised binary
lookup, we employ a second build step that preprocesses certain .c files
and uses gperf to substitute pseudomacros with their respective constant
hash value.
Change-Id: Id89c4728a0fc7aa911691d4dd1ba8e7b3916a983
Adding a fixed length to the size of the buffer requested from the
packetizer was wrong, as this is not just the length of the working
buffer but also the size of the buffer to be returned for sample stream
(PCM) codecs. Instead, use the codec definition's bit per sample spec
to make AMR provide a larger buffer than the bare frame.
Change-Id: Ibff59b21d491e3327cc9e907e6515379a8ca9188
also eliminate `` in makefiles
document external bcg729 requirement for Debian building
closes#460
Change-Id: Iadecbc6df81c2fe876acc20c25c8be0e85391779
fixes a variable name collision and also converts AV_LOG constants to
their respective LOG_ values
closes#344
Change-Id: Ie577250fe1191619df9f8a4b38744c43d1ee8e4f