Chromium Code Reviews| 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. |
|
phoglund_chromium
2014/12/17 18:54:55
The AGC test is the only user of this anyway so I
|
| + 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); |
| } |