Implement turns#1434
Conversation
4922418 to
8c882d9
Compare
1457ee7 to
e3130a4
Compare
3a5da22 to
48a90d4
Compare
73ca077 to
80735e5
Compare
9bd9c56 to
fa28ad3
Compare
9e02eef to
91c559c
Compare
371e431 to
a881b38
Compare
0d3588b to
b0f66b9
Compare
|
Hi @sipsorcery, @ispysoftware, @jimm98y, @ha-ves and see how it goes? I hope it improves memory and CPU performance and, thus, latency. |
|
It would be good to get this merged... |
This doesn't need to be a all or nothing. We can do that in phases. |
Definitely needs to be in phases. There doesn't seem to be much this PR doesn't touch including a lot of foundation classes. Ideally some smaller PRs for less critical classes could be split off. That would help build the confidence for the more critical ones. |
|
I added it to my fork a while back - it's been working fine I dunno how it compares to this one with other changes in master. It wasn't very complicated and only touched a few files at the time. |
@ispysoftware, I opted by having a pipeline dedicated to TLS alongside UDP and TCP. Maybe we can simplify that. |
|
@paulomorgado I pushed a few changes including turns support |
@ispysoftware, I saw it, but didn't look at it in detail, yet. |
…g, polyfills Enable nullable reference types across the solution and set C# language version to 14.0. Replace TinyJson with System.Text.Json source-generated serialization (SipSorceryJsonSerializerContext) and add a single-pass sanitizer in RTCSessionDescriptionInit.TryParse that escapes raw CR/LF inside JSON string values without allocating when no escaping is needed. Introduce compile-time logging extensions (LoggerMessage) for every subsystem (Media, DTLS-SRTP, ICE, RTCP, RTP, SCTP, SDP, STUN, WebRTC, sys/Net) to eliminate boxing and string formatting on hot paths. Add Meziantou.Polyfill and CommunityToolkit.HighPerformance packages to back-fill modern APIs (Span, FrozenDictionary, SearchValues, etc.) on older target frameworks. Add System.Text.Json, System.IO.Pipelines, and Microsoft.Bcl.Cryptography conditional references per TFM. Extract reusable low-level helpers into sys/: ValueStringBuilder, MemoryOperations, BinaryOperations, EncodingExtensions, HashExtensions, BouncyCastleExtensions, PolyfillExtensions, SocketConnection hierarchy, IPAddressExtension, and more. Move UdpReceiver from net/RTP to sys/Net. Convert file-scoped namespaces throughout. Update all projects and test infrastructure accordingly.
NEW FEATURES:
PERFORMANCE OPTIMIZATIONS:
Memory Management:
PooledSegmentedBuffer<T>for efficient buffer pooling withArrayPool<T>integrationMemoryOperationshelper for optimized memory operationsValueStringBuilderfor stack-allocated string building to reduce heap allocationsSearchValuesfor optimized span-based searchingenumusage.Socket and Network Layer:
NetServiceswith connection pooling and reduced allocationsSocketConnectionabstraction with concrete implementations (SocketTcpConnection,SocketUdpConnection,SocketTlsConnection) for better resource managementIPSocketwith span-based parsing and reduced string allocationsPortRangewith improved allocation patternsSystem Utilities:
BinaryOperationsfor bit manipulation optimizationsEncodingExtensionsfor efficient encoding/decoding operationsHashExtensionsfor streamlined hash computationsCrypto and Security:
SslClientAuthenticationOptionsandSslStreamExtensionsfor down-level targetsData Serialization:
SipSorceryJsonSerializerContextfor AOT-friendly JSON serializationJSONWriterandJsonParserin favor ofSystem.Text.JsonProtocol Implementations:
ValueStringBuilderCodec Optimizations:
AudioEncoderwith more efficient buffer handlingHIGH-PERFORMANCE LOGGING:
Structured Logging Infrastructure:
LoggerMessageAttributesource generator pattern across all modulesBenefits:
MODERNIZATION:
BouncyCastleExtensionsfor down-level targetsRETARGETING:
SUPPORTING CHANGES:
Type System:
TypeExtensionsIByteSerializableinterface for consistent serializationProtocolTypeExtensionsfor protocol type handlingTesting:
Supersedes #1335, #1338, #1407, #1414, #1423
Related PRs: