Fix RTP header extension encryption
Previously, RTP header extensions with encryption had been filtered if the encryption had been activated (not the other way around) which was likely an unintended logic inversion. In addition, it ensures that encrypted RTP header extensions are only negotiated if RTP header extension encryption is turned on. Formerly, which extensions had been negotiated depended on the order in which they were inserted, regardless of whether or not header encryption was actually enabled, leading to no extensions being sent on the wire. Further changes: - If RTP header encryption enabled, prefer encrypted extensions over non-encrypted extensions - Add most extensions to list of extensions supported for encryption - Discard encrypted extensions in a session description in case encryption is not supported for that extension Note that this depends on https://github.com/cisco/libsrtp/pull/491 to get into libwebrtc (cherry-pick or bump libsrtp version). Otherwise, two-byte header extensions will prevent any RTP packets being sent/received. Bug: webrtc:11713 Change-Id: Ia0779453d342fa11e06996d9bc2d3c826f3466d3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177980 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Taylor <deadbeef@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33723}
This commit is contained in:
committed by
Commit Bot
parent
84ba1643c2
commit
a743303211
@ -27,6 +27,7 @@ constexpr size_t kFixedHeaderSize = 12;
|
||||
constexpr uint8_t kRtpVersion = 2;
|
||||
constexpr uint16_t kOneByteExtensionProfileId = 0xBEDE;
|
||||
constexpr uint16_t kTwoByteExtensionProfileId = 0x1000;
|
||||
constexpr uint16_t kTwobyteExtensionProfileIdAppBitsFilter = 0xfff0;
|
||||
constexpr size_t kOneByteExtensionHeaderLength = 1;
|
||||
constexpr size_t kTwoByteExtensionHeaderLength = 2;
|
||||
constexpr size_t kDefaultPacketSize = 1500;
|
||||
@ -501,7 +502,8 @@ bool RtpPacket::ParseBuffer(const uint8_t* buffer, size_t size) {
|
||||
return false;
|
||||
}
|
||||
if (profile != kOneByteExtensionProfileId &&
|
||||
profile != kTwoByteExtensionProfileId) {
|
||||
(profile & kTwobyteExtensionProfileIdAppBitsFilter) !=
|
||||
kTwoByteExtensionProfileId) {
|
||||
RTC_LOG(LS_WARNING) << "Unsupported rtp extension " << profile;
|
||||
} else {
|
||||
size_t extension_header_length = profile == kOneByteExtensionProfileId
|
||||
|
||||
Reference in New Issue
Block a user