Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: services/media/audio/platform/generic/mixers/no_op.cc

Issue 1424933002: Add an initial revision of an audio server. (Closed) Base URL: https://github.com/domokit/mojo.git@change4
Patch Set: refactor MixerKernel into a class to prepare for the addition of a linear interpolation sampler Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698