aboutsummaryrefslogtreecommitdiff
path: root/cast/streaming/resolution.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cast/streaming/resolution.cc')
-rw-r--r--cast/streaming/resolution.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/cast/streaming/resolution.cc b/cast/streaming/resolution.cc
index 0bcf5067..9c763cfe 100644
--- a/cast/streaming/resolution.cc
+++ b/cast/streaming/resolution.cc
@@ -70,6 +70,10 @@ bool Resolution::operator!=(const Resolution& other) const {
return !(*this == other);
}
+bool Resolution::IsSupersetOf(const Resolution& other) const {
+ return width >= other.width && height >= other.height;
+}
+
bool Dimensions::TryParse(const Json::Value& root, Dimensions* out) {
if (!json::TryParseInt(root[kWidth], &(out->width)) ||
!json::TryParseInt(root[kHeight], &(out->height)) ||
@@ -104,5 +108,15 @@ bool Dimensions::operator!=(const Dimensions& other) const {
return !(*this == other);
}
+bool Dimensions::IsSupersetOf(const Dimensions& other) const {
+ if (static_cast<double>(frame_rate) !=
+ static_cast<double>(other.frame_rate)) {
+ return static_cast<double>(frame_rate) >=
+ static_cast<double>(other.frame_rate);
+ }
+
+ return ToResolution().IsSupersetOf(other.ToResolution());
+}
+
} // namespace cast
} // namespace openscreen