Index: webrtc/common_types.cc |
diff --git a/webrtc/common_types.cc b/webrtc/common_types.cc |
index c9f7fa1e738fbbd1b61b704bb5d4458667a49e5d..5cbc452db33f82735092fd28460a56859f70e982 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,6 +24,11 @@ StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {} |
constexpr size_t StreamId::kMaxSize; |
+bool StreamId::IsLegalName(rtc::ArrayView<const char> name) { |
+ return (name.size() <= kMaxSize && name.size() > 0 && |
+ std::all_of(name.data(), name.data() + name.size(), isalnum)); |
+} |
+ |
void StreamId::Set(const char* data, size_t size) { |
// If |data| contains \0, the stream id size might become less than |size|. |
RTC_CHECK_LE(size, kMaxSize); |