With hf-only=0 set and cmr=1 also set, we send a blank CMR with each
packet, which forces use of HF format packets. This in turn can lead to
size collisions (e.g. mode 1 = 18 bytes, + CMR + TOC = 20 bytes, which
is the same as mode 2) which can confuse the decoder. Add the required
size collision logic.
Change-Id: Icd540cfb321b4eaf77a0ed7d08be06d8681b6214
This allows usage of refcounted objects using custom allocators or
static storage. Use the magic size of -1 to indicate that the internal
free function should not be called.
Change-Id: I64b7581d15c120d030c13d6cb03e8ada26f46bdf
The poller-per-thread feature was broken with a division by zero. Take
the opportunity to rework it and eliminate the poller_map object. Use a
simple array of pollers for media sockets, plus one global poller for
control sockets. In the regular case only one poller is created and
everything points to that poller. In the poller-per-thread case, one
poller per thread is created, plus one poller (also with its own single
thread) for control connections. All control sockets use the single
control poller, while all media sockets get assigned one poller from the
pool in a round-robin fashion.
closes#1801
Change-Id: Iae91a3e10b7206455c6df33b1a472254c700ce21
As per [1], quote:
It’s very important that you recognize the limited scope in which
automatic variable values are available: they only have values within
the recipe. In particular, you cannot use them anywhere within the
target list of a rule; they have no value there and will expand to the
empty string. Also, they cannot be accessed directly within the
prerequisite list of a rule. A common mistake is attempting to use $@
within the prerequisites list; this will not work.
Based on the patch by S-P Chan <shihping.chan@gmail.com>
[1] https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.htmlcloses#1754
Thanks: S-P Chan <shihping.chan@gmail.com>
Change-Id: Ia5f9d7a75f04d9533afaace8ed49cc222e4307a8
Ref: https://github.com/sipwise/rtpengine/issues/1754
Try open an IPv4 socket if IPv6 fails with EAFNOSUPPORT in order to
support kernels without IPv6 support.
closes#1784
Change-Id: I2cf4065450a8b19b738c572e7d9ad6f8548ecc04
As we don't directly append to an existing GString any more anyway,
simplify the function signature by just returning a new GString if the
format string is known.
Change-Id: I9f8e6fbd93ea063eecb519cd57366effd4022f75
Some source strings are `const char *` and we don't have an alternative
`str` type pointing to a const buffer. Strictly speaking some buffers
aren't even char buffers, yet we use the `str` type to manage them. This
eliminates the need to explicitly cast every usage.
Change-Id: Ifd3cdd3d400fc483e6c488a95e9381938e63cc7f
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
Simple wrappers around glib's GHashTable functions that add type
information, instead of just using void* for everything.
Change-Id: I3e7c0f095f1f58b943ba80d1e14e763707ee1698
We rely on dpkg-buildflags to set -O2, but that may not be available on
the target system. Explicitly set -O3, and also enable LTO.
Change-Id: I593ec7ead08cb0a47922ba4db684b0292647f2bc
Fix all instances of argument-less function signatures.
Fix all instances of auto-cleanup variables declared after they need to
be in scope.
Change-Id: I3a005df03ede971e08d4f62d7c7711a1913fda5e
Whilst working on the Reproducible Builds effort [0], we noticed that
rtpengine could not be built reproducibly.
This is because the manpages generated by pandoc contained the current
build date.
An (upstreamable) patch is attached that uses the value from the
SOURCE_DATE_EPOCH environment variable if available.
[0] https://reproducible-builds.org/
Change-Id: I2eb22dc5f57af69d217fb06c1c126e7e40dbd451
*) Remove packaging for -gpu packages
*) Remove build profile restrictions, except for the build dependency
itself
*) Remove script to generate dh fragments for -gpu packages
*) Convert --cudecs switch to a path argument pointing to the .so
*) Don't link against libcudecs during build
*) Only include the single types.h header needed for usage as a plugin
*) Resolve all symbols during startup after loading the .so
Change-Id: Ide99eec2156d5d3be8c40594391cb1603add4b16
Consider errors from dlopen() or dlsym() as hard errors. Don't just log
an error message and continue startup. If we were instructed to load a
plugin, make sure that we could actually load it.
Change-Id: I1fcfa149a0eae277ef528fd3cef249ea7882e781
Evaluating the __VA_ARGS__ twice for printing a critical error can have
side effects. Avoid these by using an intermediate buffer.
Change-Id: I8ddace6ad06f47d6827f3f3ba3c5b882cbfb0140
Older glibc uses a strange (and seemingly broken) approach to verifying
the cmsg structures by inspecting the *next* cmsg header and using its
length to see if there is enough space in the buffer. Since we're
constructing the cmsg list, at this point there is no next cmsg yet,
therefore causing spurious failures of CMSG_NXTHDR.
Work around this by initialising the entire buffer first.
See 9c443ac455closes#1720
Change-Id: I00ce9bc5686ab0c1612aff51f1b3e75d8cbd8a69
Some gcc targets report ifunc as a supported attribute, while at the
same time actually trying to build the object fails with "ifunc not
supported on this target". Be more prejudicial with ifunc usage.
Change-Id: I5820338476938bf581d6d9e38fe0e6fd48f0b874
UDP packets sent in response to a UDP request should have the same
source address as the request's destination address.
This can be achieved with sockets bound to a specific address, but in
the case of ANY-bound sockets, we can use the PKTINFO mechanism to do
this.
Extend control_ng_process() to accept an extra socket address
corresponding to the local address to use. Extend the signature of the
callback function (to do the actual sending) accordingly.
Extend socket_sendiov() to be able to set the PKTINFO cmsg when sending
a packet.
Add socket_sendto_from() as a convenience wrapper.
Extend control_udp_incoming() to pass the address from
udp_buf->local_addr back to socket_sendiov().
Change-Id: Idd019fdcfd796098e7807427e6686d4b05de35d1
Looks like glib at some point started resetting an existing string array
that a config option is pointing to if that config option isn't present
at all. Work around this by explicitly resetting the pointed-to variable
to NULL, and then fixing up the contents on the second pass: either use
the setting from the config file or the one from the command line, and
free the other one.
Change-Id: Ida89d71e54fc30b4cce3277107e2185737f54a51
Similar to recvfrom_ts, this return the local (destination) address of
the received packet, extracted from the PKTINFO struct.
Change-Id: Icfed12eb7d9bf6c9d707318e85363fcff8d9aca6
It actually uses a shared config setting from the lib (stack size) so
the function itself also belongs in the lib.
Change an argument type to bool.
Change-Id: I8be68008fcfc058cb29069102eb00497b66897a5
Make silent this:
In file included from spandsp_logging-test.c:9:
spandsp_logging.h: In function ‘my_span_set_log’:
spandsp_logging.h:5:9: error: too few arguments to function ‘span_log_set_message_handler’
5 | span_log_set_message_handler(ls, h);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from spandsp_logging-test.c:7:
/usr/local/include/spandsp/logging.h:125:20: note: declared here
125 | SPAN_DECLARE(void) span_log_set_message_handler(logging_state_t *s, message_handler_func_t func, void *user_data);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from spandsp_logging-test.c:9:
spandsp_logging.h: In function ‘my_span_mh’:
spandsp_logging.h:8:9: error: too few arguments to function ‘span_set_message_handler’
8 | span_set_message_handler(h);
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from spandsp_logging-test.c:7:
/usr/local/include/spandsp/logging.h:127:20: note: declared here
127 | SPAN_DECLARE(void) span_set_message_handler(message_handler_func_t func, void *user_data);
| ^~~~~~~~~~~~~~~~~~~~~~~~
spandsp_logging-test.c: In function ‘main’:
spandsp_logging-test.c:18:29: warning: passing argument 2 of ‘my_span_set_log’ from incompatible pointer type [-Wincompatible-pointer-types]
18 | my_span_set_log(ls, logfunc);
| ^~~~~~~
| |
| void (*)(int, const char *)
In file included from spandsp_logging-test.c:9:
spandsp_logging.h:4:73: note: expected ‘message_handler_func_t’ {aka ‘void (*)(void *, int, const char *)’} but argument is of type ‘void (*)(int, const char *)’
4 | INLINE void my_span_set_log(logging_state_t *ls, message_handler_func_t h) {
| ~~~~~~~~~~~~~~~~~~~~~~~^
t38.c: In function ‘t38_gateway_pair’:
t38.c:419:29: warning: passing argument 2 of ‘my_span_set_log’ from incompatible pointer type [-Wincompatible-pointer-types]
419 | my_span_set_log(ls, spandsp_logging_func);
| ^~~~~~~~~~~~~~~~~~~~
| |
| void (*)(int, const char *)
In file included from t38.c:11:
spandsp_logging.h:4:73: note: expected ‘message_handler_func_t’ {aka ‘void (*)(void *, int, const char *)’} but argument is of type ‘void (*)(int, const char *)’
4 | INLINE void my_span_set_log(logging_state_t *ls, message_handler_func_t h) {
| ~~~~~~~~~~~~~~~~~~~~~~~^
Change-Id: Ib67db21e1d1ea684fd312bbaf9a8ec7a7542e3cb
This is a dependency of the poller and so is needed in lib/ as well to
make it usable.
Also consolidate the type.
Change-Id: I70ec8a200d6cd65710ac93636a9495cf24c35ef4
Make sure we don't try to send on closed sockets or to endpoints which
haven't been initialised.
Fixes unexpected fallout from 83c7336e
Change-Id: If73d61e52edeb72257515adab7428ecef82c2797
Introduce rtpe_has_cpu_flag() and associated enum to test for specific
CPU flags. Use singleton approach to do the CPUID only once.
Convert simd_float2int16_array() to float2int16_array() as an ifunc. The
resolver function uses rtpe_has_cpu_flag() to determine which
implementation to use.
If no SIMD implementation is available, use the linked evs_syn_output()
from the shared object as before, with an intermediate wrapper function,
which is needed as the dlopen() happens only after the
float2int16_array() is resolved.
Change-Id: I34fa03433ba5d6fa7d6d4f290455015db29fdd74
If the forwarded streams of a call are later combined without the inserted
silence, the resulting mix may end up with them out of sync. This
is already handled when outputting mixed files so the same functionality
from mix.c has been added for tls forwarding