Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(989)

Unified Diff: talk/app/webrtc/test/fakeaudiocapturemodule_unittest.cc

Issue 1236023010: In PeerConnectionTestWrapper, put audio input on a separate thread. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: resolving patch conflicts due to splitting this CL Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/test/fakeaudiocapturemodule.cc ('k') | talk/app/webrtc/test/peerconnectiontestwrapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « talk/app/webrtc/test/fakeaudiocapturemodule.cc ('k') | talk/app/webrtc/test/peerconnectiontestwrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698