| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "media/audio/fake_audio_output_stream.h" | 6 #include "media/audio/fake_audio_output_stream.h" |
| 7 | 7 |
| 8 bool FakeAudioOutputStream::has_created_fake_stream_ = false; | 8 bool FakeAudioOutputStream::has_created_fake_stream_ = false; |
| 9 FakeAudioOutputStream* FakeAudioOutputStream::last_fake_stream_ = NULL; | 9 FakeAudioOutputStream* FakeAudioOutputStream::last_fake_stream_ = NULL; |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 void FakeAudioOutputStream::Start(AudioSourceCallback* callback) { | 33 void FakeAudioOutputStream::Start(AudioSourceCallback* callback) { |
| 34 callback_ = callback; | 34 callback_ = callback; |
| 35 memset(buffer_.get(), 0, packet_size_); | 35 memset(buffer_.get(), 0, packet_size_); |
| 36 callback_->OnMoreData(this, buffer_.get(), packet_size_, 0); | 36 callback_->OnMoreData(this, buffer_.get(), packet_size_, 0); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void FakeAudioOutputStream::Stop() { | 39 void FakeAudioOutputStream::Stop() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 void FakeAudioOutputStream::SetVolume(double left_level, double right_level) { | 42 void FakeAudioOutputStream::SetVolume(double volume) { |
| 43 left_volume_ = left_level; | 43 volume_ = volume; |
| 44 right_volume_ = right_level; | |
| 45 } | 44 } |
| 46 | 45 |
| 47 void FakeAudioOutputStream::GetVolume(double* left_level, double* right_level) { | 46 void FakeAudioOutputStream::GetVolume(double* volume) { |
| 48 *left_level = left_volume_; | 47 *volume = volume_; |
| 49 *right_level = right_volume_; | |
| 50 } | 48 } |
| 51 | 49 |
| 52 void FakeAudioOutputStream::Close() { | 50 void FakeAudioOutputStream::Close() { |
| 53 callback_->OnClose(this); | 51 callback_->OnClose(this); |
| 54 callback_ = NULL; | 52 callback_ = NULL; |
| 55 | 53 |
| 56 if (last_fake_stream_) | 54 if (last_fake_stream_) |
| 57 delete last_fake_stream_; | 55 delete last_fake_stream_; |
| 58 last_fake_stream_ = this; | 56 last_fake_stream_ = this; |
| 59 } | 57 } |
| 60 | 58 |
| 61 FakeAudioOutputStream::FakeAudioOutputStream() | 59 FakeAudioOutputStream::FakeAudioOutputStream() |
| 62 : left_volume_(0), | 60 : volume_(0), |
| 63 right_volume_(0), | |
| 64 callback_(NULL), | 61 callback_(NULL), |
| 65 packet_size_(0) { | 62 packet_size_(0) { |
| 66 } | 63 } |
| 67 | 64 |
| 68 // static | 65 // static |
| 69 void FakeAudioOutputStream::DestroyLastFakeStream(void* param) { | 66 void FakeAudioOutputStream::DestroyLastFakeStream(void* param) { |
| 70 if (last_fake_stream_) | 67 if (last_fake_stream_) |
| 71 delete last_fake_stream_; | 68 delete last_fake_stream_; |
| 72 } | 69 } |
| OLD | NEW |