This commit introduces a new RTP transport model,
based on the AmRtpTransport abstraction, providing a more modular and
efficient approach to RTP handling compared to the legacy model.
General things:
- Introduction of new RTP receiver and transport abstractions
- The new model coexists with the legacy RTP handling
to preserve backward compatibility
Architecture overview:
- A new AmRtpTransport layer is introduced to encapsulate RTP transport logic
and decouple it from AmRtpStream and session-level code
- Transport-specific functionality is implemented via dedicated classes:
- AmRtpTransport: base abstraction responsible for RTP/RTCP packet flow,
lifecycle management, and interaction with streams
- AmRtpUdpSocket: UDP-based RTP socket implementation
- AmRtpSocketPair: manages RTP/RTCP socket pairs and their coordination
- AmRtpStream is refactored to rely on the transport interface
instead of directly managing sockets and low-level I/O
Integration details:
- SIP session and dialog logic (AmSession, AmSipDialog) is updated to work with
the new transport model
- SBC call legs and call profiles are extended to support transport selection
and lifecycle handling
- SDP processing (AmSdp) is updated to reflect transport capabilities and
address handling changes
This refactoring improves separation of concerns, reduces coupling between RTP
streaming and transport mechanics, and provides a cleaner foundation for future
RTP extensions and optimizations.
Code provenance and license:
- part of the code was written by Fokus GmbH
- part of the code was written by Sipwise GmbH
- part of the code base copyrighted by Fokus GmbH was provided by them in
the form of backports under the GPL license.
- these changes are covered by the GPL, matching the existing project license
Change-Id: I313c4abd9b54f805c1e668c019cf6fb8c4a9e46d
Rework the payload to be a string instead of the raw char array.
This eliminates cases when we actually need to track that this char array
is indeed null-terminated and deprives us from doing other tricks to
properly maintain this char array.
Also no need to return const of payload anymore, because simply copied
during return. Data protection ensured by not giving a reference to the payload,
modifiable still during the first time setting this payload.
Rework also other users, such as nested call into AmSdp provided `parse()`.
Now `parse()` takes a string, and already in a local scope handles a char array
copy of this given string. This is only because the `parse_sdp_line_ex()` still
requires a refactor to be working with strings instead of char array.
Additionally: move parser helpers of AmSdp to const char pointers,
instead of working on a plain char pointer. This is because the SDP body
parser has been moved from the referenced pointer `char *&`
to the `const char *` pointer. This allows to not have additionally
heap allocated SDP body C-string for parsing purposes.
No functional change.
Change-Id: Ic3ee6c349b62e7e5e0cd4de722f9ed923862a7cb
Preamble: no functional changes.
AmSdp::parse() mixes int values with bool,
what makes the behavior not really clear, not defined
and can lead to the unpredicted result (even though the
compiler *should* actually fix that, but one ought to
not rely on this).
Hence make the parse method only be working with bool values.
Then, reverse the return value so that it's clear
that wrongly parsed is `false`, and good parsed is `true`.
Refactor all users accordingly.
Also rework those users, who indeed need `int` value
be returned, e.g. when having -1.
Do the same thing with the `parse_sdp_line_ex()` helper,
whereas parse() is the only user of it. And also reverse
the interpretation of true/false.
Then, make `parse()` working with a plain `char*`, so not a const.
Because doing a tricks like:
cast `char*` to const (user level) -> cast `const char*` to non-const
in a function (in a old C-like manner), has really no sense.
Refactor everything accordingly.
Other than that, refactor AmMimeBody:
Refactor it to work with a plain `char *` pointer instead of working
with `unsigned char *`, which nowadays has really no sense and
rather is a rudiment of C-like code base coming from the past.
Convert `payload` from `unsigned char*` to `char *` accordingly.
Refactor everything in AmMimeBody implementation accordingly.
Remove rudiment C-like casting everywhere, where possible.
Update `parseMultipart()` to work with a plain `const char *`
instead of `const unsigned char*`
P.S.: leave a list of TODO's for further rework, which
is not directly related to this scope of rework.
Change-Id: Ie1e132429245e0d2cc740d5b1c1fc17cf037a820
Before using the `clock_rate` or `payload_type`
always initialize, because might be used non-defined,
which will give whatever value.
Fixes:
Uninitialized scalar variable (UNINIT)
35. uninit_use_in_call: Using uninitialized
value (int)clock_rate when calling SdpPayload.
Change-Id: Ie7cea4289ace93a169ad2dce8a402b9a469c65f8
These are all instances of an object being put into a container just
before it goes out of scope. Use move semantics to avoid copying.
Change-Id: I9c40a56c4a67df2b8e244d51f068b50ec286f5bf
Warned-by: Coverity
Use overloading for the various flavours of str2int functions. This has
the benefit of automatically choosing the appropriate function for
aliased types that may be one or the other underlying type, such as
size_t.
Do a mass renaming of all relevant instances.
Change-Id: I7abb6b9031ee53332d2b04a6cba4a6cc667a4807
Don't store variables in a processor register
but store as usually in memory.
Resolves:
10: 32:12 AmSdp.cpp: In function 'bool parse_sdp_line_ex(AmSdp*, char*&)':
10: 32:12 AmSdp.cpp:571:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 571 | register parse_st state;
10: 32:12 | ^~~~~
10: 32:12 AmSdp.cpp: In function 'char* parse_sdp_connection(AmSdp*, char*, char)':
10: 32:12 AmSdp.cpp:757:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 757 | register sdp_connection_st state;
10: 32:12 | ^~~~~
10: 32:12 AmSdp.cpp: In function 'void parse_sdp_media(AmSdp*, char*)':
10: 32:12 AmSdp.cpp:838:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 838 | register sdp_media_st state;
10: 32:12 | ^~~~~
10: 32:12 AmSdp.cpp: In function 'char* parse_sdp_attr(AmSdp*, char*)':
10: 32:12 AmSdp.cpp:1038:31: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 1038 | register sdp_attr_rtpmap_st rtpmap_st;
10: 32:12 | ^~~~~~~~~
10: 32:12 AmSdp.cpp:1039:29: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 1039 | register sdp_attr_fmtp_st fmtp_st;
10: 32:12 | ^~~~~~~
10: 32:12 AmSdp.cpp: In function 'void parse_sdp_origin(AmSdp*, char*)':
10: 32:12 AmSdp.cpp:1253:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 1253 | register sdp_origin_st origin_st;
10: 32:12 |
Change-Id: Ice87c3659816003c94359f891a490db0910ff74a
SDP session origin id and version are limited by it's size
to 64 bits (8 bytes), that is because we are using `unsigned long long`
type for both id and version. Hence the maximum value it can hold
is two sixty-forth power, so equals: 18,446,744,073,709,551,615
In case one intentionally sets it to something like:
"o=- 18446744073709551615 18446744073709551615 IN IP4 192.168.0.1"
SEMS gets overwhelmed with that conversion inside the code make
it just to a string literal 'F'.
To overcome it, just use __uint128 (which is of 128bits size)
for the session origin id and version.
Change-Id: I2ad9659aa81dad79969749053dc3fd0d69e2cbd2
Use `unsigned long long` for SDP session id and version
instead of unsigned int.
Refactor all usage of them accordingly.
Additionally intrdouce new utils functions for conversion:
- `ulonglong2str()` - converts `unsigned long long` to `string`
- `str2ull()` - converts `string` to `unsigned long long`
Change-Id: I4210349a5442d4173b14227497f4a01d68cad7a4
This commit fixes that:
AmSdp.cpp: In function 'void parse_sdp_media(AmSdp*, char*)':
AmSdp.cpp:858:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
858 | if (next > media_line)
| ^~
AmSdp.cpp:860:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
860 | m.type = media_type(media);
| ^
Change-Id: Ie5b7760d3e11ec825ea68138d06eaeb150da202c