Add a codec module for Codec 2, using libcodec2 for decoding and
encoding.
There is no RFC payload format for Codec 2, so this follows the
convention Asterisk uses: encoding name "codec2" at 8000 Hz, mono, with
one or more complete frames per RTP packet, each padded to whole bytes.
The mode is selected with the format parameter "mode=" (3200, 2400,
1600, 1400, 1300, 1200 or 700C) and defaults to 2400, the only mode
Asterisk supports. With the transcode option it can also be given as
the bit rate, e.g. "codec2/8000/1/3200".
Different modes are different bit streams, so payload types only match
when they use the same mode. Modes 1600 and below use 40 ms frames, so
their ptime is rounded up to a multiple of 40 ms. Modes not known to
rtpengine (e.g. 450) are passed through unchanged when both sides
agree, but can't be transcoded.
libcodec2 is optional. It is detected with pkg-config (or from
/usr/include/codec2) by utils/gen-codec2-flags. Without it, Codec 2 is
still recognised for SDP handling and passthrough. In a Debian build
the dependency can be dropped with the pkg.ngcp-rtpengine.nocodec2
build profile.
test-transcode gains Codec 2 tests for both directions in modes 2400,
3200 and 1300, plus passthrough. check_encoder() is no longer limited
to the extended AMR tests, as these use it too.
Closes#2226
Change-Id: I2cad021f48e2043f36c30f5e6290cb7d6eba8c1f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve file name conflicts between different components
Ensure shared log levels are identical across components
Encapsulates lib/*
Change-Id: If848d6fa0e4cd8eac88ce9e63ee77fc5a7a481fd
The bitmask `& 0x7f` on m_pt guarantees values 0-127, and the decoders
array has 128 entries, so out-of-bounds access is structurally impossible.
Add a compile-time static_assert documenting this invariant.
Closes#2107
Change-Id: I9debd6ddf4ac928ded71d2189775e10dee98e0de
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
since previous change relating to incomplete metafile's being read while
still being written, there are still circumstances that result in failure
This change tracks last_good_pos after each full section and advances
mf->pos once by parsed buffer prefix so the next read does not skip tail
bytes. The log lines have now been made dbg instead of warnings as they
should be handled correctly on subsequent reads of the file
Closes#2090
Change-Id: I88cf5a5d1702a818301cfc9448bbbc65ee0bf155
when under load it's possible that a metafile gets updated by rtpengine
while it's still being read by the recording daemon. this can result
in a WARNING being logged and the loop breaking. That section ends up
unprocessed and any changes in it don't get applied.
This change only updates the offset after a successful section read.
Therefore, if a section is incomplete and the loop breaks, the next
inotify event will retry that incomplete section and it should succeed
Closes#2008
Change-Id: Ie48b66e7578597f5b75f957e3b5cc793628282dd
The mix sink points into the tls_fwd object, so we must not free it
during operation, such as when a connection error occurs.
Separate out object creation and connection setup functions. Reset
object state at connection error, but don't free the object.
Make reconnect attempt part of checking the connection state.
Change-Id: Ib551532c47236afe5ec22711fcc161a8535338e4
Metadata might be empty, so we can't rely on that being set as a start
trigger. Use an explicit one.
Follow-up-to: I3bb58dff
Change-Id: I95f02a1179940cedc3f96ce70557658c43e79bdc