Index: webrtc/common_types.h |
diff --git a/webrtc/common_types.h b/webrtc/common_types.h |
index e1a4c77d37adf184bb43b0fd87070d635f54d917..1c16199cb1a1c9aa33fbfffca701c50feb35039c 100644 |
--- a/webrtc/common_types.h |
+++ b/webrtc/common_types.h |
@@ -19,6 +19,7 @@ |
#include <vector> |
#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" |
@@ -694,6 +695,33 @@ struct PlayoutDelay { |
int max_ms; |
}; |
+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; } |
+ void Set(rtc::ArrayView<const uint8_t> value) { |
+ Set(value.data(), value.size()); |
+ } |
+ void Set(const void* data, size_t size); |
nisse-webrtc
2017/04/10 12:25:00
I would have expected const char* or const uint8_t
danilchap
2017/04/10 13:27:05
changed to const char* and made the cast explicit.
|
+ |
+ friend bool operator==(const StreamId& lhs, const StreamId& rhs) { |
+ return strncmp(lhs.value_, rhs.value_, kMaxSize) == 0; |
+ } |
+ |
+ private: |
+ char value_[kMaxSize]; |
+}; |
+ |
struct RTPHeaderExtension { |
RTPHeaderExtension(); |
@@ -717,6 +745,12 @@ struct RTPHeaderExtension { |
VideoRotation videoRotation; |
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 { |