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

Side by Side 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: fix issues discovered with initial preflight 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 unified diff | Download patch
OLDNEW
(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);
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);
35 }
36
37 } // namespace mixers
38 } // namespace audio
39 } // namespace media
40 } // namespace mojo
OLDNEW
« no previous file with comments | « services/media/audio/platform/generic/mixers/no_op.h ('k') | services/media/audio/platform/generic/mixers/point_sampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698