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

Unified Diff: webrtc/api/video/video_content_type.h

Issue 2986893002: Piggybacking simulcast id and ALR experiment id into video content type extension. (Closed)
Patch Set: Created 3 years, 5 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
Index: webrtc/api/video/video_content_type.h
diff --git a/webrtc/api/video/video_content_type.h b/webrtc/api/video/video_content_type.h
index 5c468c079d35ea2d20c115234cf38d7e7fcd42bd..4ce55bd26efc0c08214a408d8a135b9308169f94 100644
--- a/webrtc/api/video/video_content_type.h
+++ b/webrtc/api/video/video_content_type.h
@@ -15,10 +15,33 @@
namespace webrtc {
-enum class VideoContentType : uint8_t {
- UNSPECIFIED = 0,
- SCREENSHARE = 1,
- TOTAL_CONTENT_TYPES // Must be the last value in the enum.
+// Class designed to behave like enum to be included in RTP header structs.
+struct VideoContentType {
+ // Common content types used outside of experiments.
+ static const VideoContentType UNSPECIFIED;
sprang_webrtc 2017/07/26 14:13:42 Maybe declare these as constexpr instead?
ilnik 2017/07/26 14:49:48 In that case, I have to initialize it right here,
+ static const VideoContentType SCREENSHARE;
+
+ operator uint8_t() const;
sprang_webrtc 2017/07/26 14:13:42 Is this really needed? Would prefer to have the co
ilnik 2017/07/26 14:49:48 That is done, so we could replace this class with
+
+ // No conversion constructor because otherwise this struct and many structs
+ // it's included into will be considered 'complex' and many chromium style
+ // errors will be generated.
+
+ uint8_t operator=(const uint8_t& value);
+ bool operator==(const VideoContentType& other);
+ bool operator==(const uint8_t& value);
+
+ void SetExperimentId(const uint8_t& experiment_id);
+ void SetSimulcastId(const uint8_t& simulcast_id);
sprang_webrtc 2017/07/26 14:13:42 Pass uint8_t parameters by value rather than refer
ilnik 2017/07/26 14:49:48 Done.
+
+ uint8_t GetExperimentId();
+ uint8_t GetSimulcastId();
+
+ bool IsScreenshare();
sprang_webrtc 2017/07/26 14:13:42 Looks like these three methods can be const?
ilnik 2017/07/26 14:49:48 Done.
+
+ static bool IsValidContentType(uint8_t content_type);
+
+ uint8_t content_type;
sprang_webrtc 2017/07/26 14:13:42 Make it private and have a setter method?
ilnik 2017/07/26 14:49:48 For some usages it's easier to have it accessible
};
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698