Send and receive color space information if available
Bug: webrtc:8651
Change-Id: I244647cb1ccbda66fce83ae925cf4273c5a6568b
Reviewed-on: https://webrtc-review.googlesource.com/c/112383
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25884}
diff --git a/api/rtpparameters.cc b/api/rtpparameters.cc
index 063d106..2b20c56 100644
--- a/api/rtpparameters.cc
+++ b/api/rtpparameters.cc
@@ -137,6 +137,10 @@
"http://www.webrtc.org/experiments/rtp-hdrext/generic-frame-descriptor-00";
const int RtpExtension::kGenericFrameDescriptorDefaultId = 11;
+const char RtpExtension::kColorSpaceUri[] =
+ "http://www.webrtc.org/experiments/rtp-hdrext/color-space";
+const int RtpExtension::kColorSpaceDefaultId = 12;
+
const char RtpExtension::kEncryptHeaderExtensionsUri[] =
"urn:ietf:params:rtp-hdrext:encrypt";
@@ -162,7 +166,8 @@
uri == webrtc::RtpExtension::kVideoTimingUri ||
uri == webrtc::RtpExtension::kMidUri ||
uri == webrtc::RtpExtension::kFrameMarkingUri ||
- uri == webrtc::RtpExtension::kGenericFrameDescriptorUri;
+ uri == webrtc::RtpExtension::kGenericFrameDescriptorUri ||
+ uri == webrtc::RtpExtension::kColorSpaceUri;
}
bool RtpExtension::IsEncryptionSupported(const std::string& uri) {
diff --git a/api/rtpparameters.h b/api/rtpparameters.h
index badda07..47df22e 100644
--- a/api/rtpparameters.h
+++ b/api/rtpparameters.h
@@ -309,6 +309,10 @@
// https://tools.ietf.org/html/rfc6904
static const char kEncryptHeaderExtensionsUri[];
+ // Header extension for color space information.
+ static const char kColorSpaceUri[];
+ static const int kColorSpaceDefaultId;
+
// Inclusive min and max IDs for two-byte header extensions and one-byte
// header extensions, per RFC8285 Section 4.2-4.3.
static constexpr int kMinId = 1;
diff --git a/api/video/color_space.h b/api/video/color_space.h
index ff022fe..58a04eb 100644
--- a/api/video/color_space.h
+++ b/api/video/color_space.h
@@ -121,12 +121,13 @@
MatrixID matrix,
RangeID range,
const HdrMetadata* hdr_metadata);
- bool operator==(const ColorSpace& other) const {
- return primaries_ == other.primaries() && transfer_ == other.transfer() &&
- matrix_ == other.matrix() && range_ == other.range() &&
- ((hdr_metadata_.has_value() && other.hdr_metadata() &&
- *hdr_metadata_ == *other.hdr_metadata()) ||
- (!hdr_metadata_.has_value() && other.hdr_metadata() == nullptr));
+ friend bool operator==(const ColorSpace& lhs, const ColorSpace& rhs) {
+ return lhs.primaries_ == rhs.primaries_ && lhs.transfer_ == rhs.transfer_ &&
+ lhs.matrix_ == rhs.matrix_ && lhs.range_ == rhs.range_ &&
+ lhs.hdr_metadata_ == rhs.hdr_metadata_;
+ }
+ friend bool operator!=(const ColorSpace& lhs, const ColorSpace& rhs) {
+ return !(lhs == rhs);
}
PrimaryID primaries() const;