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

Side by Side Diff: media/base/loopback_audio_converter.cc

Issue 1483433003: Second layer of mixing for audio elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: That fix Created 5 years 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
« no previous file with comments | « media/base/loopback_audio_converter.h ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bit_reader.h" 5 #include "media/base/loopback_audio_converter.h"
6 6
7 namespace media { 7 namespace media {
8 8
9 BitReader::BitReader(const uint8* data, int size) 9 LoopbackAudioConverter::LoopbackAudioConverter(
10 : initial_size_(size), 10 const AudioParameters& input_params,
11 data_(data), 11 const AudioParameters& output_params,
12 bytes_left_(size), 12 bool disable_fifo)
13 bit_reader_core_(this) { 13 : audio_converter_(input_params, output_params, disable_fifo) {}
14 DCHECK(data != NULL);
15 DCHECK_GE(size, 0);
16 }
17 14
18 BitReader::~BitReader() {} 15 LoopbackAudioConverter::~LoopbackAudioConverter() {}
19 16
20 int BitReader::GetBytes(int max_nbytes, const uint8** out) { 17 double LoopbackAudioConverter::ProvideInput(AudioBus* audio_bus,
21 DCHECK_GE(max_nbytes, 0); 18 base::TimeDelta buffer_delay) {
22 DCHECK(out); 19 audio_converter_.ConvertWithDelay(buffer_delay, audio_bus);
23 20 return 1.0;
24 int nbytes = max_nbytes;
25 if (nbytes > bytes_left_)
26 nbytes = bytes_left_;
27
28 *out = data_;
29 data_ += nbytes;
30 bytes_left_ -= nbytes;
31 return nbytes;
32 } 21 }
33 22
34 } // namespace media 23 } // namespace media
OLDNEW
« no previous file with comments | « media/base/loopback_audio_converter.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698