Index: webrtc/common_types.h |
diff --git a/webrtc/common_types.h b/webrtc/common_types.h |
index 750420196d957bde26f094368c9a3cee11519196..3c4488111399074db808583c939d4d70fdf12fd7 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,39 @@ struct PlayoutDelay { |
int max_ms; |
}; |
+class StreamId { |
stefan-webrtc
2017/04/19 06:46:16
I think we need a comment on what the definition o
danilchap
2017/04/19 08:16:55
Done.
|
+ 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 +757,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 { |