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

Unified Diff: webrtc/test/fake_audio_device.cc

Issue 1674413004: Added A/V sync tests with drifting clocks. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 | « webrtc/test/fake_audio_device.h ('k') | webrtc/test/webrtc_test_common.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/fake_audio_device.cc
diff --git a/webrtc/test/fake_audio_device.cc b/webrtc/test/fake_audio_device.cc
index 31cebda6521a01455fbe17f5b789423d296aa82e..435c53f8783fc7f9ecb6bd8d149d9c0e6cd4215f 100644
--- a/webrtc/test/fake_audio_device.cc
+++ b/webrtc/test/fake_audio_device.cc
@@ -22,13 +22,16 @@
namespace webrtc {
namespace test {
-FakeAudioDevice::FakeAudioDevice(Clock* clock, const std::string& filename)
+FakeAudioDevice::FakeAudioDevice(Clock* clock,
+ const std::string& filename,
+ float speed)
: audio_callback_(NULL),
capturing_(false),
captured_audio_(),
playout_buffer_(),
+ speed_(speed),
last_playout_ms_(-1),
- clock_(clock),
+ clock_(clock, speed),
tick_(EventTimerWrapper::Create()),
thread_(FakeAudioDevice::Run, this, "FakeAudioDevice"),
file_utility_(new ModuleFileUtility(0)),
@@ -51,7 +54,7 @@ int32_t FakeAudioDevice::Init() {
if (file_utility_->InitPCMReading(*input_stream_.get()) != 0)
return -1;
- if (!tick_->StartTimer(true, 10))
+ if (!tick_->StartTimer(true, 10 / speed_))
return -1;
thread_.Start();
thread_.SetPriority(rtc::kHighPriority);
@@ -107,7 +110,7 @@ void FakeAudioDevice::CaptureAudio() {
false,
new_mic_level));
size_t samples_needed = kFrequencyHz / 100;
- int64_t now_ms = clock_->TimeInMilliseconds();
+ int64_t now_ms = clock_.TimeInMilliseconds();
uint32_t time_since_last_playout_ms = now_ms - last_playout_ms_;
if (last_playout_ms_ > 0 && time_since_last_playout_ms > 0) {
samples_needed = std::min(
« no previous file with comments | « webrtc/test/fake_audio_device.h ('k') | webrtc/test/webrtc_test_common.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698