Index: services/media/audio/platform/generic/mixers/no_op.cc |
diff --git a/services/media/audio/platform/generic/mixers/no_op.cc b/services/media/audio/platform/generic/mixers/no_op.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ded8df5c82e00a4fc94097f66c14dc375361ab68 |
--- /dev/null |
+++ b/services/media/audio/platform/generic/mixers/no_op.cc |
@@ -0,0 +1,40 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/logging.h" |
+#include "services/media/audio/platform/generic/mixers/no_op.h" |
+ |
+namespace mojo { |
+namespace media { |
+namespace audio { |
+namespace mixers { |
+ |
+bool NoOp::Mix(void* dst, |
+ uint32_t dst_frames, |
+ uint32_t* dst_offset, |
+ const void* src, |
+ uint32_t frac_src_frames, |
+ uint32_t* frac_src_offset, |
+ uint32_t frac_step_size, |
+ bool accumulate) { |
+ DCHECK_LT(*dst_offset, dst_frames); |
+ DCHECK_LT(*frac_src_offset, frac_src_frames); |
+ |
+ uint32_t frames_produced = ((frac_src_frames - *frac_src_offset) |
+ + frac_step_size - 1) / frac_step_size; |
+ |
+ if (frames_produced > (dst_frames - *dst_offset)) { |
+ 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
|
+ } |
+ |
+ *dst_offset += frames_produced; |
+ *frac_src_offset += frames_produced * frac_step_size; |
+ |
+ 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
|
+} |
+ |
+} // namespace mixers |
+} // namespace audio |
+} // namespace media |
+} // namespace mojo |