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/virtual_audio_output_stream.h" | 5 #include "media/audio/virtual_audio_output_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/audio/virtual_audio_input_stream.h" | 8 #include "media/audio/virtual_audio_input_stream.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 *volume = volume_; | 71 *volume = volume_; |
72 } | 72 } |
73 | 73 |
74 double VirtualAudioOutputStream::ProvideInput(AudioBus* audio_bus, | 74 double VirtualAudioOutputStream::ProvideInput(AudioBus* audio_bus, |
75 base::TimeDelta buffer_delay) { | 75 base::TimeDelta buffer_delay) { |
76 // Note: This method may be invoked on any one thread, depending on the | 76 // Note: This method may be invoked on any one thread, depending on the |
77 // platform. | 77 // platform. |
78 DCHECK(callback_); | 78 DCHECK(callback_); |
79 | 79 |
80 DCHECK_GE(buffer_delay, base::TimeDelta()); | 80 DCHECK_GE(buffer_delay, base::TimeDelta()); |
81 const int64 upstream_delay_in_bytes = | 81 const int64_t upstream_delay_in_bytes = params_.GetBytesPerSecond() * |
82 params_.GetBytesPerSecond() * buffer_delay / | 82 buffer_delay / |
83 base::TimeDelta::FromSeconds(1); | 83 base::TimeDelta::FromSeconds(1); |
84 const int frames = callback_->OnMoreData( | 84 const int frames = callback_->OnMoreData( |
85 audio_bus, static_cast<uint32>(upstream_delay_in_bytes), 0); | 85 audio_bus, static_cast<uint32_t>(upstream_delay_in_bytes), 0); |
86 if (frames < audio_bus->frames()) | 86 if (frames < audio_bus->frames()) |
87 audio_bus->ZeroFramesPartial(frames, audio_bus->frames() - frames); | 87 audio_bus->ZeroFramesPartial(frames, audio_bus->frames() - frames); |
88 | 88 |
89 return frames > 0 ? volume_ : 0; | 89 return frames > 0 ? volume_ : 0; |
90 } | 90 } |
91 | 91 |
92 } // namespace media | 92 } // namespace media |
OLD | NEW |