Add support for sending RTP two-byte header extensions.

Automatic detection if one-byte header or two-byte header should be used based
on extension ID and extension length.

Bug: webrtc:7990
Change-Id: I9fc848ecc59458d1ca97bace0e57ea04d3d0ced6
Reviewed-on: https://webrtc-review.googlesource.com/c/103422
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25004}
This commit is contained in:
Johannes Kron
2018-10-05 10:00:46 +02:00
committed by Commit Bot
parent 7880be1799
commit 78cdde3df6
9 changed files with 217 additions and 23 deletions

View File

@ -462,9 +462,11 @@ bool BaseRtpStringExtension::Parse(rtc::ArrayView<const uint8_t> data,
bool BaseRtpStringExtension::Write(rtc::ArrayView<uint8_t> data,
const std::string& str) {
if (str.size() > StringRtpHeaderExtension::kMaxSize) {
return false;
}
RTC_DCHECK_EQ(data.size(), str.size());
RTC_DCHECK_GE(str.size(), 1);
RTC_DCHECK_LE(str.size(), StringRtpHeaderExtension::kMaxSize);
memcpy(data.data(), str.data(), str.size());
return true;
}