| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/audio/fake_audio_output_stream.h" | 5 #include "media/audio/fake_audio_output_stream.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "media/audio/audio_manager_base.h" | 9 #include "media/audio/audio_manager_base.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 FakeAudioOutputStream* FakeAudioOutputStream::GetCurrentFakeStream() { | 34 FakeAudioOutputStream* FakeAudioOutputStream::GetCurrentFakeStream() { |
| 35 return current_fake_stream_; | 35 return current_fake_stream_; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void FakeAudioOutputStream::Start(AudioSourceCallback* callback) { | 38 void FakeAudioOutputStream::Start(AudioSourceCallback* callback) { |
| 39 callback_ = callback; | 39 callback_ = callback; |
| 40 memset(buffer_.get(), 0, bytes_per_buffer_); | 40 memset(buffer_.get(), 0, bytes_per_buffer_); |
| 41 callback_->OnMoreData(this, buffer_.get(), bytes_per_buffer_, | 41 callback_->OnMoreData(buffer_.get(), bytes_per_buffer_, |
| 42 AudioBuffersState(0, 0)); | 42 AudioBuffersState(0, 0)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void FakeAudioOutputStream::Stop() { | 45 void FakeAudioOutputStream::Stop() { |
| 46 callback_ = NULL; | 46 callback_ = NULL; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void FakeAudioOutputStream::SetVolume(double volume) { | 49 void FakeAudioOutputStream::SetVolume(double volume) { |
| 50 volume_ = volume; | 50 volume_ = volume; |
| 51 } | 51 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 67 bytes_per_buffer_(params.GetBytesPerBuffer()), | 67 bytes_per_buffer_(params.GetBytesPerBuffer()), |
| 68 closed_(false) { | 68 closed_(false) { |
| 69 } | 69 } |
| 70 | 70 |
| 71 FakeAudioOutputStream::~FakeAudioOutputStream() { | 71 FakeAudioOutputStream::~FakeAudioOutputStream() { |
| 72 if (current_fake_stream_ == this) | 72 if (current_fake_stream_ == this) |
| 73 current_fake_stream_ = NULL; | 73 current_fake_stream_ = NULL; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace media | 76 } // namespace media |
| OLD | NEW |