webrtc-apm: Replace deprected Json::Reader call.
Never versions of jsoncpp have deprectated the use of Json::Reader and
replaced it with a factory pattern. This change allows us to uprev
jsoncpp.
No change in functionality.
BUG=b:157880485
TEST=FEATURES=test emerge-betty media-libs/webrtc-apm
Change-Id: I18d12fbd4c7e1a9e5878a7083630c390acce2199
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/webrtc-apm/+/2265532
Tested-by: Stuart Langley <slangley@chromium.org>
Auto-Submit: Stuart Langley <slangley@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
diff --git a/api/audio/echo_canceller3_config_json.cc b/api/audio/echo_canceller3_config_json.cc
index 4c8c8ab..02c4d99 100644
--- a/api/audio/echo_canceller3_config_json.cc
+++ b/api/audio/echo_canceller3_config_json.cc
@@ -121,9 +121,16 @@
*parsing_successful = true;
Json::Value root;
- bool success = Json::Reader().parse(std::string(json_string), root);
+ Json::CharReaderBuilder builder;
+ std::unique_pre<Json::CharReader> reader(builder.newCharReader());
+ std::string error;
+
+ bool success = reader->parse(json_string.data(),
+ json_string.data() + json_string.size(),
+ &root, &error);
if (!success) {
- RTC_LOG(LS_ERROR) << "Incorrect JSON format: " << json_string;
+ RTC_LOG(LS_ERROR) << "Incorrect JSON format: " << json_string
+ << " error: " << error;
*parsing_successful = false;
return;
}