Fix CallClient so that it calls Call::GetStats() on the right thread.

Bug: webrtc:10847
Change-Id: Id23a389b4d5bad8f2211b5ec87b37aefc81a9292
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148065
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28772}
diff --git a/test/scenario/call_client.cc b/test/scenario/call_client.cc
index aac70c8..e5e1726 100644
--- a/test/scenario/call_client.cc
+++ b/test/scenario/call_client.cc
@@ -241,7 +241,10 @@
 }
 
 Call::Stats CallClient::GetStats() {
-  return call_->GetStats();
+  // This call needs to be made on the thread that |call_| was constructed on.
+  Call::Stats stats;
+  SendTask([this, &stats] { stats = call_->GetStats(); });
+  return stats;
 }
 
 DataRate CallClient::target_rate() const {
diff --git a/test/scenario/stats_collection_unittest.cc b/test/scenario/stats_collection_unittest.cc
index 716691b..602da18 100644
--- a/test/scenario/stats_collection_unittest.cc
+++ b/test/scenario/stats_collection_unittest.cc
@@ -78,7 +78,7 @@
   EXPECT_NEAR(stats.call.stats().target_rate.Mean().kbps(), 75, 50);
   EXPECT_NEAR(stats.video_send.stats().media_bitrate.Mean().kbps(), 100, 50);
   EXPECT_NEAR(stats.video_receive.stats().resolution.Mean(), 180, 10);
-  EXPECT_NEAR(stats.audio_receive.stats().jitter_buffer.Mean().ms(), 45, 20);
+  EXPECT_NEAR(stats.audio_receive.stats().jitter_buffer.Mean().ms(), 45, 25);
 }
 
 TEST(ScenarioAnalyzerTest, CountsCapturedButNotRendered) {