| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" |
| 10 #include "media/audio/audio_manager_base.h" | 11 #include "media/audio/audio_manager_base.h" |
| 11 | 12 |
| 12 namespace media { | 13 namespace media { |
| 13 | 14 |
| 14 // static | 15 // static |
| 15 AudioOutputStream* FakeAudioOutputStream::MakeFakeStream( | 16 AudioOutputStream* FakeAudioOutputStream::MakeFakeStream( |
| 16 AudioManagerBase* manager, const AudioParameters& params) { | 17 AudioManagerBase* manager, const AudioParameters& params) { |
| 17 return new FakeAudioOutputStream(manager, params); | 18 return new FakeAudioOutputStream(manager, params); |
| 18 } | 19 } |
| 19 | 20 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Calculate our sleep duration for simulated playback. Sleep for at least | 76 // Calculate our sleep duration for simulated playback. Sleep for at least |
| 76 // one millisecond so we don't spin the CPU. | 77 // one millisecond so we don't spin the CPU. |
| 77 MessageLoop::current()->PostDelayedTask( | 78 MessageLoop::current()->PostDelayedTask( |
| 78 FROM_HERE, base::Bind( | 79 FROM_HERE, base::Bind( |
| 79 &FakeAudioOutputStream::OnMoreDataTask, weak_this_.GetWeakPtr()), | 80 &FakeAudioOutputStream::OnMoreDataTask, weak_this_.GetWeakPtr()), |
| 80 base::TimeDelta::FromMilliseconds( | 81 base::TimeDelta::FromMilliseconds( |
| 81 std::max(1.0f, frames_received / frames_per_millisecond_))); | 82 std::max(1.0f, frames_received / frames_per_millisecond_))); |
| 82 } | 83 } |
| 83 | 84 |
| 84 } // namespace media | 85 } // namespace media |
| OLD | NEW |