Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/logging.h" | |
| 6 #include "services/media/audio/platform/generic/mixers/no_op.h" | |
| 7 | |
| 8 namespace mojo { | |
| 9 namespace media { | |
| 10 namespace audio { | |
| 11 namespace mixers { | |
| 12 | |
| 13 bool NoOp::Mix(void* dst, | |
| 14 uint32_t dst_frames, | |
| 15 uint32_t* dst_offset, | |
| 16 const void* src, | |
| 17 uint32_t frac_src_frames, | |
| 18 uint32_t* frac_src_offset, | |
| 19 uint32_t frac_step_size, | |
| 20 bool accumulate) { | |
| 21 DCHECK_LT(*dst_offset, dst_frames); | |
| 22 DCHECK_LT(*frac_src_offset, frac_src_frames); | |
| 23 | |
| 24 uint32_t frames_produced = ((frac_src_frames - *frac_src_offset) | |
| 25 + frac_step_size - 1) / frac_step_size; | |
| 26 | |
| 27 if (frames_produced > (dst_frames - *dst_offset)) { | |
| 28 frames_produced = (dst_frames - *dst_offset); | |
|
jeffbrown
2015/11/04 23:43:34
The mixer functions themselves might be a little s
johngro
2015/11/06 02:20:27
I'm confused; there is no sample clamping going on
| |
| 29 } | |
| 30 | |
| 31 *dst_offset += frames_produced; | |
| 32 *frac_src_offset += frames_produced * frac_step_size; | |
| 33 | |
| 34 return (*frac_src_offset >= frac_src_frames); | |
|
jeffbrown
2015/11/04 23:43:34
I don't see why we need to return this value since
johngro
2015/11/06 02:20:27
See above; the caller needs to know details about
| |
| 35 } | |
| 36 | |
| 37 } // namespace mixers | |
| 38 } // namespace audio | |
| 39 } // namespace media | |
| 40 } // namespace mojo | |
| OLD | NEW |