| Index: media/audio/simple_sources.cc
|
| diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc
|
| index f20343a4ee49c6c8bb25bc99e8a3d79e1d4189d2..fde0509d979f0dc24aa45a062620d7583425738b 100644
|
| --- a/media/audio/simple_sources.cc
|
| +++ b/media/audio/simple_sources.cc
|
| @@ -152,12 +152,13 @@ void SineWaveAudioSource::Reset() {
|
| }
|
|
|
| FileSource::FileSource(const AudioParameters& params,
|
| - const base::FilePath& path_to_wav_file)
|
| + const base::FilePath& path_to_wav_file,
|
| + bool loop)
|
| : params_(params),
|
| path_to_wav_file_(path_to_wav_file),
|
| wav_file_read_pos_(0),
|
| - load_failed_(false) {
|
| -}
|
| + load_failed_(false),
|
| + looping_(loop) {}
|
|
|
| FileSource::~FileSource() {
|
| }
|
| @@ -213,15 +214,22 @@ int FileSource::OnMoreData(AudioBus* audio_bus,
|
|
|
| DCHECK(wav_audio_handler_.get());
|
|
|
| - // Stop playing if we've played out the whole file.
|
| - if (wav_audio_handler_->AtEnd(wav_file_read_pos_))
|
| - return 0;
|
| + if (wav_audio_handler_->AtEnd(wav_file_read_pos_)) {
|
| + if (looping_)
|
| + Rewind();
|
| + else
|
| + return 0;
|
| + }
|
|
|
| // This pulls data from ProvideInput.
|
| file_audio_converter_->Convert(audio_bus);
|
| return audio_bus->frames();
|
| }
|
|
|
| +void FileSource::Rewind() {
|
| + wav_file_read_pos_ = 0;
|
| +}
|
| +
|
| double FileSource::ProvideInput(AudioBus* audio_bus_into_converter,
|
| uint32_t frames_delayed) {
|
| // Unfilled frames will be zeroed by CopyTo.
|
|
|