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

Unified Diff: media/audio/fake_audio_input_stream.cc

Issue 799983002: Adding WebRTC Auto Gain Control Test (linux) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed win compile Created 6 years 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 | « media/audio/fake_audio_input_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/fake_audio_input_stream.cc
diff --git a/media/audio/fake_audio_input_stream.cc b/media/audio/fake_audio_input_stream.cc
index 7fe3f825d28096114f6b4e867324765b1e8336e5..43804cb82689ab3497ea1e1c6ab231245600b0c9 100644
--- a/media/audio/fake_audio_input_stream.cc
+++ b/media/audio/fake_audio_input_stream.cc
@@ -185,7 +185,7 @@ void FakeAudioInputStream::DoCallback() {
next_callback_time = base::TimeDelta();
if (PlayingFromFile()) {
- PlayFileLooping();
+ PlayFile();
} else {
PlayBeep();
}
@@ -214,14 +214,16 @@ bool FakeAudioInputStream::PlayingFromFile() {
return wav_audio_handler_.get() != nullptr;
}
-void FakeAudioInputStream::PlayFileLooping() {
+void FakeAudioInputStream::PlayFile() {
+ // Stop playing if we've played out the whole file.
+ if (wav_audio_handler_->AtEnd(wav_file_read_pos_))
+ return;
+
// Unfilled frames will be zeroed by CopyTo.
size_t bytes_written;
wav_audio_handler_->CopyTo(audio_bus_.get(), wav_file_read_pos_,
&bytes_written);
wav_file_read_pos_ += bytes_written;
- if (wav_audio_handler_->AtEnd(wav_file_read_pos_))
- wav_file_read_pos_ = 0;
callback_->OnData(this, audio_bus_.get(), buffer_size_, 1.0);
}
« no previous file with comments | « media/audio/fake_audio_input_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698