Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(919)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc

Issue 2871813003: Add write support for the RtpStreamId and RepairedRtpStreamId header extensions. (Closed)
Patch Set: Patch 3 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_packet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc b/webrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc
index 13f488b09a8a2416968e072854540746df600146..ba512ef349c85ef3191d55af7c25ea0caea53f15 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc
@@ -257,6 +257,13 @@ bool RtpStreamId::Parse(rtc::ArrayView<const uint8_t> data, StreamId* rsid) {
return true;
}
+bool RtpStreamId::Write(uint8_t* data, const StreamId& rsid) {
+ RTC_DCHECK_GE(rsid.size(), 1);
+ RTC_DCHECK_LE(rsid.size(), StreamId::kMaxSize);
+ memcpy(data, rsid.data(), rsid.size());
+ return true;
+}
+
bool RtpStreamId::Parse(rtc::ArrayView<const uint8_t> data, std::string* rsid) {
if (data.empty() || data[0] == 0) // Valid rsid can't be empty.
return false;
@@ -268,6 +275,13 @@ bool RtpStreamId::Parse(rtc::ArrayView<const uint8_t> data, std::string* rsid) {
return true;
}
+bool RtpStreamId::Write(uint8_t* data, const std::string& rsid) {
+ RTC_DCHECK_GE(rsid.size(), 1);
+ RTC_DCHECK_LE(rsid.size(), StreamId::kMaxSize);
+ memcpy(data, rsid.data(), rsid.size());
+ return true;
+}
+
// RepairedRtpStreamId.
constexpr RTPExtensionType RepairedRtpStreamId::kId;
constexpr uint8_t RepairedRtpStreamId::kValueSizeBytes;
@@ -279,9 +293,25 @@ bool RepairedRtpStreamId::Parse(rtc::ArrayView<const uint8_t> data,
return RtpStreamId::Parse(data, rsid);
}
+size_t RepairedRtpStreamId::ValueSize(const StreamId& rsid) {
+ return RtpStreamId::ValueSize(rsid);
+}
+
+bool RepairedRtpStreamId::Write(uint8_t* data, const StreamId& rsid) {
+ return RtpStreamId::Write(data, rsid);
+}
+
bool RepairedRtpStreamId::Parse(rtc::ArrayView<const uint8_t> data,
std::string* rsid) {
return RtpStreamId::Parse(data, rsid);
}
+size_t RepairedRtpStreamId::ValueSize(const std::string& rsid) {
+ return RtpStreamId::ValueSize(rsid);
+}
+
+bool RepairedRtpStreamId::Write(uint8_t* data, const std::string& rsid) {
+ return RtpStreamId::Write(data, rsid);
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_packet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698