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/base/audio_bus.h" | 5 #include "media/base/audio_bus.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
9 #include "media/audio/audio_parameters.h" | 9 #include "media/audio/audio_parameters.h" |
10 #include "media/base/limits.h" | 10 #include "media/base/limits.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 } | 211 } |
212 | 212 |
213 void AudioBus::ZeroFrames(int frames) { | 213 void AudioBus::ZeroFrames(int frames) { |
214 ZeroFramesPartial(0, frames); | 214 ZeroFramesPartial(0, frames); |
215 } | 215 } |
216 | 216 |
217 void AudioBus::Zero() { | 217 void AudioBus::Zero() { |
218 ZeroFrames(frames_); | 218 ZeroFrames(frames_); |
219 } | 219 } |
220 | 220 |
221 bool AudioBus::AreFramesZero() const { | |
222 for (size_t i = 0; i < channel_data_.size(); ++i) { | |
223 for (int j = 0; j < frames_; j++) { | |
DaleCurtis
2015/06/22 22:49:43
++j
qinmin
2015/06/23 00:01:54
Done.
| |
224 if (channel_data_[i][j]) | |
225 return false; | |
226 } | |
227 } | |
228 return true; | |
229 } | |
230 | |
221 int AudioBus::CalculateMemorySize(const AudioParameters& params) { | 231 int AudioBus::CalculateMemorySize(const AudioParameters& params) { |
222 return CalculateMemorySizeInternal( | 232 return CalculateMemorySizeInternal( |
223 params.channels(), params.frames_per_buffer(), NULL); | 233 params.channels(), params.frames_per_buffer(), NULL); |
224 } | 234 } |
225 | 235 |
226 int AudioBus::CalculateMemorySize(int channels, int frames) { | 236 int AudioBus::CalculateMemorySize(int channels, int frames) { |
227 return CalculateMemorySizeInternal(channels, frames, NULL); | 237 return CalculateMemorySizeInternal(channels, frames, NULL); |
228 } | 238 } |
229 | 239 |
230 void AudioBus::BuildChannelData(int channels, int aligned_frames, float* data) { | 240 void AudioBus::BuildChannelData(int channels, int aligned_frames, float* data) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 return scoped_refptr<AudioBusRefCounted>( | 355 return scoped_refptr<AudioBusRefCounted>( |
346 new AudioBusRefCounted(channels, frames)); | 356 new AudioBusRefCounted(channels, frames)); |
347 } | 357 } |
348 | 358 |
349 AudioBusRefCounted::AudioBusRefCounted(int channels, int frames) | 359 AudioBusRefCounted::AudioBusRefCounted(int channels, int frames) |
350 : AudioBus(channels, frames) {} | 360 : AudioBus(channels, frames) {} |
351 | 361 |
352 AudioBusRefCounted::~AudioBusRefCounted() {} | 362 AudioBusRefCounted::~AudioBusRefCounted() {} |
353 | 363 |
354 } // namespace media | 364 } // namespace media |
OLD | NEW |