aboutsummaryrefslogtreecommitdiff
path: root/cast/streaming/answer_messages.h
diff options
context:
space:
mode:
Diffstat (limited to 'cast/streaming/answer_messages.h')
-rw-r--r--cast/streaming/answer_messages.h32
1 files changed, 12 insertions, 20 deletions
diff --git a/cast/streaming/answer_messages.h b/cast/streaming/answer_messages.h
index 1f62706a..7095e455 100644
--- a/cast/streaming/answer_messages.h
+++ b/cast/streaming/answer_messages.h
@@ -15,6 +15,7 @@
#include <vector>
#include "absl/types/optional.h"
+#include "cast/streaming/resolution.h"
#include "cast/streaming/ssrc.h"
#include "json/value.h"
#include "platform/base/error.h"
@@ -28,14 +29,14 @@ namespace cast {
// readability of the structs provided in this file by cutting down on the
// amount of obscuring boilerplate code. For each of the following struct
// definitions, the following method definitions are shared:
-// (1) ParseAndValidate. Shall return a boolean indicating whether the out
+// (1) TryParse. Shall return a boolean indicating whether the out
// parameter is in a valid state after checking bounds and restrictions.
// (2) ToJson. Should return a proper JSON object. Assumes that IsValid()
// has been called already, OSP_DCHECKs if not IsValid().
-// (3) IsValid. Used by both ParseAndValidate and ToJson to ensure that the
+// (3) IsValid. Used by both TryParse and ToJson to ensure that the
// object is in a good state.
struct AudioConstraints {
- static bool ParseAndValidate(const Json::Value& value, AudioConstraints* out);
+ static bool TryParse(const Json::Value& value, AudioConstraints* out);
Json::Value ToJson() const;
bool IsValid() const;
@@ -46,23 +47,13 @@ struct AudioConstraints {
absl::optional<std::chrono::milliseconds> max_delay = {};
};
-struct Dimensions {
- static bool ParseAndValidate(const Json::Value& value, Dimensions* out);
- Json::Value ToJson() const;
- bool IsValid() const;
-
- int width = 0;
- int height = 0;
- SimpleFraction frame_rate;
-};
-
struct VideoConstraints {
- static bool ParseAndValidate(const Json::Value& value, VideoConstraints* out);
+ static bool TryParse(const Json::Value& value, VideoConstraints* out);
Json::Value ToJson() const;
bool IsValid() const;
absl::optional<double> max_pixels_per_second = {};
- absl::optional<Dimensions> min_dimensions = {};
+ absl::optional<Dimensions> min_resolution = {};
Dimensions max_dimensions = {};
int min_bit_rate = 0; // optional
int max_bit_rate = 0;
@@ -70,7 +61,7 @@ struct VideoConstraints {
};
struct Constraints {
- static bool ParseAndValidate(const Json::Value& value, Constraints* out);
+ static bool TryParse(const Json::Value& value, Constraints* out);
Json::Value ToJson() const;
bool IsValid() const;
@@ -84,7 +75,7 @@ struct Constraints {
enum class AspectRatioConstraint : uint8_t { kVariable = 0, kFixed };
struct AspectRatio {
- static bool ParseAndValidate(const Json::Value& value, AspectRatio* out);
+ static bool TryParse(const Json::Value& value, AspectRatio* out);
bool IsValid() const;
bool operator==(const AspectRatio& other) const {
@@ -96,8 +87,7 @@ struct AspectRatio {
};
struct DisplayDescription {
- static bool ParseAndValidate(const Json::Value& value,
- DisplayDescription* out);
+ static bool TryParse(const Json::Value& value, DisplayDescription* out);
Json::Value ToJson() const;
bool IsValid() const;
@@ -109,7 +99,10 @@ struct DisplayDescription {
};
struct Answer {
+ // TODO(jophba): DEPRECATED, remove separately.
static bool ParseAndValidate(const Json::Value& value, Answer* out);
+
+ static bool TryParse(const Json::Value& value, Answer* out);
Json::Value ToJson() const;
bool IsValid() const;
@@ -123,7 +116,6 @@ struct Answer {
absl::optional<DisplayDescription> display;
std::vector<int> receiver_rtcp_event_log;
std::vector<int> receiver_rtcp_dscp;
- bool supports_wifi_status_reporting = false;
// RTP extensions should be empty, but not null.
std::vector<std::string> rtp_extensions = {};