aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cast/streaming/offer_messages.cc7
-rw-r--r--cast/streaming/offer_messages.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/cast/streaming/offer_messages.cc b/cast/streaming/offer_messages.cc
index ad88e82e..1795a692 100644
--- a/cast/streaming/offer_messages.cc
+++ b/cast/streaming/offer_messages.cc
@@ -315,8 +315,11 @@ bool VideoStream::IsValid() const {
}
// static
-Error Offer::Parse(const Json::Value& root, Offer* out) {
- return TryParse(root, out);
+ErrorOr<Offer> Offer::Parse(const Json::Value& root) {
+ Offer out;
+ Error error = TryParse(root, &out);
+ return error.ok() ? ErrorOr<Offer>(std::move(out))
+ : ErrorOr<Offer>(std::move(error));
}
// static
diff --git a/cast/streaming/offer_messages.h b/cast/streaming/offer_messages.h
index 30704112..c4899eec 100644
--- a/cast/streaming/offer_messages.h
+++ b/cast/streaming/offer_messages.h
@@ -101,7 +101,7 @@ enum class CastMode : uint8_t { kMirroring, kRemoting };
struct Offer {
// TODO(jophba): remove deprecated declaration in a separate patch.
- static Error Parse(const Json::Value& root, Offer* out);
+ static ErrorOr<Offer> Parse(const Json::Value& root);
static Error TryParse(const Json::Value& root, Offer* out);
Json::Value ToJson() const;
bool IsValid() const;