| 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_input_stream.h" | 5 #include "media/audio/fake_audio_input_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "media/audio/audio_manager_base.h" | 8 #include "media/audio/audio_manager_base.h" |
| 9 | 9 |
| 10 using base::Time; | 10 using base::Time; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 last_callback_time_ = Time::Now(); | 41 last_callback_time_ = Time::Now(); |
| 42 thread_.Start(); | 42 thread_.Start(); |
| 43 thread_.message_loop()->PostDelayedTask( | 43 thread_.message_loop()->PostDelayedTask( |
| 44 FROM_HERE, | 44 FROM_HERE, |
| 45 base::Bind(&FakeAudioInputStream::DoCallback, base::Unretained(this)), | 45 base::Bind(&FakeAudioInputStream::DoCallback, base::Unretained(this)), |
| 46 callback_interval_); | 46 callback_interval_); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void FakeAudioInputStream::DoCallback() { | 49 void FakeAudioInputStream::DoCallback() { |
| 50 DCHECK(callback_); | 50 DCHECK(callback_); |
| 51 callback_->OnData(this, buffer_.get(), buffer_size_, buffer_size_); | 51 callback_->OnData(this, buffer_.get(), buffer_size_, buffer_size_, 0.0); |
| 52 | 52 |
| 53 Time now = Time::Now(); | 53 Time now = Time::Now(); |
| 54 base::TimeDelta next_callback_time = | 54 base::TimeDelta next_callback_time = |
| 55 last_callback_time_ + callback_interval_ * 2 - now; | 55 last_callback_time_ + callback_interval_ * 2 - now; |
| 56 | 56 |
| 57 // If we are falling behind, try to catch up as much as we can in the next | 57 // If we are falling behind, try to catch up as much as we can in the next |
| 58 // callback. | 58 // callback. |
| 59 if (next_callback_time < base::TimeDelta()) | 59 if (next_callback_time < base::TimeDelta()) |
| 60 next_callback_time = base::TimeDelta(); | 60 next_callback_time = base::TimeDelta(); |
| 61 | 61 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 double FakeAudioInputStream::GetMaxVolume() { | 81 double FakeAudioInputStream::GetMaxVolume() { |
| 82 return 0.0; | 82 return 0.0; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void FakeAudioInputStream::SetVolume(double volume) {} | 85 void FakeAudioInputStream::SetVolume(double volume) {} |
| 86 | 86 |
| 87 double FakeAudioInputStream::GetVolume() { | 87 double FakeAudioInputStream::GetVolume() { |
| 88 return 0.0; | 88 return 0.0; |
| 89 } | 89 } |
| 90 |
| 91 void FakeAudioInputStream::SetAutomaticGainControl(bool enabled) {} |
| 92 |
| 93 bool FakeAudioInputStream::GetAutomaticGainControl() { |
| 94 return false; |
| 95 } |
| OLD | NEW |