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

Unified 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, 12 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 side-by-side diff with in-line comments
Download patch
Index: webkit/glue/webaudiodevice_impl.cc
===================================================================
--- webkit/glue/webaudiodevice_impl.cc (revision 0)
+++ webkit/glue/webaudiodevice_impl.cc (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 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 "webkit/glue/webaudiodevice_impl.h"
+
+using WebKit::WebAudioDevice;
+using WebKit::WebVector;
+
+namespace webkit_glue {
+
+WebAudioDeviceImpl::WebAudioDeviceImpl(size_t buffer_size,
+ unsigned channels,
+ double sample_rate,
+ WebAudioDevice::RenderCallback* callback)
+ : 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.
+ channels,
+ sample_rate,
+ this),
+ client_callback_(callback) {
+}
+
+WebAudioDeviceImpl::~WebAudioDeviceImpl() {
+ stop();
+}
+
+void WebAudioDeviceImpl::start() {
+ audio_device_.Start();
+}
+
+void WebAudioDeviceImpl::stop() {
+ audio_device_.Stop();
+}
+
+void WebAudioDeviceImpl::render(const std::vector<float*>& audio_data,
+ size_t number_of_frames) {
+ // Make the client callback to get rendered audio.
+ 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
+ // Wrap the pointers using WebVector.
+ WebVector<float*> web_audio_data(audio_data.size());
+ 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.
+ web_audio_data[i] = audio_data[i];
+
+ client_callback_->render(web_audio_data, number_of_frames);
+ }
+}
+
+} // namespace webkit_glue
Property changes on: webkit/glue/webaudiodevice_impl.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698