AEC3: Corrected the reading/creation of the json parameter file

Bug: webrtc:8671
Change-Id: Ide8693b3be023e56d3acca38e703c95ba0e9b69b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133623
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27714}
diff --git a/api/audio/echo_canceller3_config_json.cc b/api/audio/echo_canceller3_config_json.cc
index 9c4824c..249a48c 100644
--- a/api/audio/echo_canceller3_config_json.cc
+++ b/api/audio/echo_canceller3_config_json.cc
@@ -137,7 +137,7 @@
   }
 
   Json::Value section;
-  if (rtc::GetValueFromJsonObject(root, "buffering", &section)) {
+  if (rtc::GetValueFromJsonObject(aec3_root, "buffering", &section)) {
     ReadParam(section, "excess_render_detection_interval_blocks",
               &cfg.buffering.excess_render_detection_interval_blocks);
     ReadParam(section, "max_allowed_excess_render_blocks",
@@ -324,6 +324,13 @@
   rtc::StringBuilder ost;
   ost << "{";
   ost << "\"aec3\": {";
+  ost << "\"buffering\": {";
+  ost << "\"excess_render_detection_interval_blocks\": "
+      << config.buffering.excess_render_detection_interval_blocks << ",";
+  ost << "\"max_allowed_excess_render_blocks\": "
+      << config.buffering.max_allowed_excess_render_blocks;
+  ost << "},";
+
   ost << "\"delay\": {";
   ost << "\"default_delay\": " << config.delay.default_delay << ",";
   ost << "\"down_sampling_factor\": " << config.delay.down_sampling_factor