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

Unified Diff: webrtc/common_types.cc

Issue 2805023002: Add read support of RtpStreamId/RepairedRtpStreamId header extensions. (Closed)
Patch Set: +one more comment Created 3 years, 8 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/common_types.h ('k') | webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_types.cc
diff --git a/webrtc/common_types.cc b/webrtc/common_types.cc
index 17bb2656748f0dce15b016228298914be1343797..b9c4737aeb511627bd1b3697269ef047d8a11ad1 100644
--- a/webrtc/common_types.cc
+++ b/webrtc/common_types.cc
@@ -10,8 +10,9 @@
#include "webrtc/common_types.h"
-#include <limits>
#include <string.h>
+#include <limits>
+#include <type_traits>
#include "webrtc/base/checks.h"
#include "webrtc/base/stringutils.h"
@@ -20,6 +21,20 @@ namespace webrtc {
StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {}
+constexpr size_t StreamId::kMaxSize;
+
+void StreamId::Set(const char* data, size_t size) {
+ // If |data| contains \0, the stream id size might become less than |size|.
+ RTC_DCHECK_LE(size, kMaxSize);
+ memcpy(value_, data, size);
+ if (size < kMaxSize)
+ value_[size] = 0;
+}
+
+// StreamId is used as member of RTPHeader that is sometimes copied with memcpy
+// and thus assume trivial destructibility.
+static_assert(std::is_trivially_destructible<StreamId>::value, "");
+
RTPHeaderExtension::RTPHeaderExtension()
: hasTransmissionTimeOffset(false),
transmissionTimeOffset(0),
« no previous file with comments | « webrtc/common_types.h ('k') | webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698