Index: talk/app/webrtc/test/fakeaudiocapturemodule_unittest.cc |
diff --git a/talk/app/webrtc/test/fakeaudiocapturemodule_unittest.cc b/talk/app/webrtc/test/fakeaudiocapturemodule_unittest.cc |
index 56f1d070eddfdebc1b1d29bbfe976c219d45f402..fcfdf7e754607ea022214212dec33ea6d00f2ef0 100644 |
--- a/talk/app/webrtc/test/fakeaudiocapturemodule_unittest.cc |
+++ b/talk/app/webrtc/test/fakeaudiocapturemodule_unittest.cc |
@@ -29,6 +29,7 @@ |
#include <algorithm> |
+#include "webrtc/base/criticalsection.h" |
#include "webrtc/base/gunit.h" |
#include "webrtc/base/scoped_ref_ptr.h" |
#include "webrtc/base/thread.h" |
@@ -48,8 +49,7 @@ class FakeAdmTest : public testing::Test, |
} |
virtual void SetUp() { |
- fake_audio_capture_module_ = FakeAudioCaptureModule::Create( |
- rtc::Thread::Current()); |
+ fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); |
EXPECT_TRUE(fake_audio_capture_module_.get() != NULL); |
} |
@@ -65,6 +65,7 @@ class FakeAdmTest : public testing::Test, |
const uint32_t currentMicLevel, |
const bool keyPressed, |
uint32_t& newMicLevel) override { |
+ rtc::CritScope cs(&crit_); |
rec_buffer_bytes_ = nSamples * nBytesPerSample; |
if ((rec_buffer_bytes_ == 0) || |
(rec_buffer_bytes_ > FakeAudioCaptureModule::kNumberSamples * |
@@ -87,6 +88,7 @@ class FakeAdmTest : public testing::Test, |
uint32_t& nSamplesOut, |
int64_t* elapsed_time_ms, |
int64_t* ntp_time_ms) override { |
+ rtc::CritScope cs(&crit_); |
++pull_iterations_; |
const uint32_t audio_buffer_size = nSamples * nBytesPerSample; |
const uint32_t bytes_out = RecordedDataReceived() ? |
@@ -98,8 +100,14 @@ class FakeAdmTest : public testing::Test, |
return 0; |
} |
- int push_iterations() const { return push_iterations_; } |
- int pull_iterations() const { return pull_iterations_; } |
+ int push_iterations() const { |
+ rtc::CritScope cs(&crit_); |
+ return push_iterations_; |
+ } |
+ int pull_iterations() const { |
+ rtc::CritScope cs(&crit_); |
+ return pull_iterations_; |
+ } |
rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_; |
@@ -118,6 +126,8 @@ class FakeAdmTest : public testing::Test, |
return min_buffer_size; |
} |
+ mutable rtc::CriticalSection crit_; |
+ |
int push_iterations_; |
int pull_iterations_; |