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

Unified Diff: webrtc/common_types.cc

Issue 2920993002: Add RSID-based demuxing to RtpDemuxer (Closed)
Patch Set: 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
« webrtc/common_types.h ('K') | « webrtc/common_types.h ('k') | no next file » | 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 b9c4737aeb511627bd1b3697269ef047d8a11ad1..961dd6f15921a0ac8ea58b34089b4068f97aa3b4 100644
--- a/webrtc/common_types.cc
+++ b/webrtc/common_types.cc
@@ -11,6 +11,7 @@
#include "webrtc/common_types.h"
#include <string.h>
+#include <algorithm>
#include <limits>
#include <type_traits>
@@ -23,9 +24,14 @@ StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {}
constexpr size_t StreamId::kMaxSize;
+bool StreamId::IsLegalName(const char* data, size_t size) {
+ return (size <= kMaxSize && size > 0 &&
+ std::all_of(data, data + size, isalnum));
danilchap 2017/06/02 17:42:20 may be remove () around the expression. https://go
eladalon 2017/06/02 19:44:05 That link seems to suggest that the parenthesis ar
danilchap 2017/06/07 13:45:41 yep, in this case it is ok, thus 'may be'
+}
+
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);
+ RTC_DCHECK_LE(size, kMaxSize); // TODO(eladalon): IsLegalName?
danilchap 2017/06/02 17:42:20 probably not: Set is called by parser too. While p
eladalon 2017/06/02 19:44:05 My intention with this TODO is to come back to thi
danilchap 2017/06/07 13:45:41 I prefer to think about StreamId as a special impl
memcpy(value_, data, size);
if (size < kMaxSize)
value_[size] = 0;
« webrtc/common_types.h ('K') | « webrtc/common_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698