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

Side by Side Diff: webkit/glue/webaudiodevice_impl.cc

Issue 6002005: Implement renderer AudioDevice API for low-latency audio output... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 "webkit/glue/webaudiodevice_impl.h"
6
7 using WebKit::WebAudioDevice;
8 using WebKit::WebVector;
9
10 namespace webkit_glue {
11
12 WebAudioDeviceImpl::WebAudioDeviceImpl(size_t buffer_size,
13 unsigned channels,
14 double sample_rate,
15 WebAudioDevice::RenderCallback* callback)
16 : audio_device_(buffer_size,
scherkus (not reviewing) 2011/01/10 23:42:32 nit: should be indented extra 2 spaces nit: the a
Chris Rogers 2011/01/11 23:01:02 Done.
17 channels,
18 sample_rate,
19 this),
20 client_callback_(callback) {
21 }
22
23 WebAudioDeviceImpl::~WebAudioDeviceImpl() {
24 stop();
25 }
26
27 void WebAudioDeviceImpl::start() {
28 audio_device_.Start();
29 }
30
31 void WebAudioDeviceImpl::stop() {
32 audio_device_.Stop();
33 }
34
35 void WebAudioDeviceImpl::render(const std::vector<float*>& audio_data,
36 size_t number_of_frames) {
37 // Make the client callback to get rendered audio.
38 if (client_callback_) {
scherkus (not reviewing) 2011/01/10 23:42:32 is client_callback_ allowed to be NULL? looks lik
Chris Rogers 2011/01/11 23:01:02 It's not allowed to be NULL. This is just a safet
39 // Wrap the pointers using WebVector.
40 WebVector<float*> web_audio_data(audio_data.size());
41 for (unsigned i = 0; i < audio_data.size(); ++i)
scherkus (not reviewing) 2011/01/10 23:42:32 unsigned -> size_t
Chris Rogers 2011/01/11 23:01:02 Done.
42 web_audio_data[i] = audio_data[i];
43
44 client_callback_->render(web_audio_data, number_of_frames);
45 }
46 }
47
48 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698