OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/audio/virtual_audio_output_stream.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" |
| 11 #include "media/audio/audio_manager_base.h" |
| 12 |
| 13 namespace media { |
| 14 |
| 15 // static |
| 16 AudioOutputStream* VirtualAudioOutputStream::MakeStream( |
| 17 AudioManagerBase* manager, const AudioParameters& params) { |
| 18 return new VirtualAudioOutputStream(manager, params); |
| 19 } |
| 20 |
| 21 VirtualAudioOutputStream::VirtualAudioOutputStream( |
| 22 AudioManagerBase* manager, const AudioParameters& params) |
| 23 : audio_manager_(manager), |
| 24 params_(params), |
| 25 callback_(NULL) { |
| 26 } |
| 27 |
| 28 VirtualAudioOutputStream::~VirtualAudioOutputStream() { |
| 29 DCHECK(!callback_); |
| 30 } |
| 31 |
| 32 bool VirtualAudioOutputStream::Open() { |
| 33 DCHECK(audio_manager_->GetMessageLoop()->BelongsToCurrentThread()); |
| 34 return true; |
| 35 } |
| 36 |
| 37 void VirtualAudioOutputStream::Start(AudioSourceCallback* callback) { |
| 38 DCHECK(audio_manager_->GetMessageLoop()->BelongsToCurrentThread()); |
| 39 callback_ = callback; |
| 40 // TODO(justinlin): Do we want videos to keep playing if the virtual |
| 41 // audio input device crashes for some reason? |
| 42 } |
| 43 |
| 44 void VirtualAudioOutputStream::Stop() { |
| 45 DCHECK(audio_manager_->GetMessageLoop()->BelongsToCurrentThread()); |
| 46 callback_ = NULL; |
| 47 } |
| 48 |
| 49 void VirtualAudioOutputStream::Close() { |
| 50 DCHECK(!callback_); |
| 51 DCHECK(audio_manager_->GetMessageLoop()->BelongsToCurrentThread()); |
| 52 audio_manager_->ReleaseOutputStream(this); |
| 53 } |
| 54 |
| 55 void VirtualAudioOutputStream::SetVolume(double volume) {} |
| 56 |
| 57 void VirtualAudioOutputStream::GetVolume(double* volume) { |
| 58 *volume = 0; |
| 59 } |
| 60 |
| 61 } // namespace media |
OLD | NEW |