Index: webrtc/common_types.h |
diff --git a/webrtc/common_types.h b/webrtc/common_types.h |
index 750420196d957bde26f094368c9a3cee11519196..06733be168d6a08e351d0b954a2e84b03a7e4991 100644 |
--- a/webrtc/common_types.h |
+++ b/webrtc/common_types.h |
@@ -20,6 +20,7 @@ |
#include "webrtc/api/video/video_content_type.h" |
#include "webrtc/api/video/video_rotation.h" |
+#include "webrtc/base/array_view.h" |
#include "webrtc/base/checks.h" |
#include "webrtc/base/optional.h" |
#include "webrtc/typedefs.h" |
@@ -695,6 +696,42 @@ struct PlayoutDelay { |
int max_ms; |
}; |
+// Class to represent RtpStreamId which is a string. |
+// Unlike std::string, it can be copied with memcpy and cleared with memset. |
+// Empty value represent unset RtpStreamId. |
+class StreamId { |
+ public: |
+ // Stream id is limited to 16 bytes because it is the maximum length |
+ // that can be encoded with one-byte header extensions. |
+ static constexpr size_t kMaxSize = 16; |
+ |
+ StreamId() { value_[0] = 0; } |
+ explicit StreamId(rtc::ArrayView<const char> value) { |
+ Set(value.data(), value.size()); |
+ } |
+ StreamId(const StreamId&) = default; |
+ StreamId& operator=(const StreamId&) = default; |
+ |
+ bool empty() const { return value_[0] == 0; } |
+ const char* data() const { return value_; } |
+ size_t size() const { return strnlen(value_, kMaxSize); } |
+ |
+ void Set(rtc::ArrayView<const uint8_t> value) { |
+ Set(reinterpret_cast<const char*>(value.data()), value.size()); |
+ } |
+ void Set(const char* data, size_t size); |
+ |
+ friend bool operator==(const StreamId& lhs, const StreamId& rhs) { |
+ return strncmp(lhs.value_, rhs.value_, kMaxSize) == 0; |
+ } |
+ friend bool operator!=(const StreamId& lhs, const StreamId& rhs) { |
+ return !(lhs == rhs); |
+ } |
+ |
+ private: |
+ char value_[kMaxSize]; |
+}; |
+ |
struct RTPHeaderExtension { |
RTPHeaderExtension(); |
@@ -723,6 +760,12 @@ struct RTPHeaderExtension { |
VideoContentType videoContentType; |
PlayoutDelay playout_delay = {-1, -1}; |
+ |
+ // For identification of a stream when ssrc is not signaled. See |
+ // https://tools.ietf.org/html/draft-ietf-avtext-rid-09 |
+ // TODO(danilchap): Update url from draft to release version. |
+ StreamId stream_id; |
+ StreamId repaired_stream_id; |
}; |
struct RTPHeader { |