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

Side by Side Diff: content/renderer/media/renderer_webaudiodevice_impl.cc

Issue 10823175: Switch AudioRenderSink::Callback to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup MCR AudioBus usage. Created 8 years, 4 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
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 "content/renderer/media/renderer_webaudiodevice_impl.h" 5 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/media/audio_device_factory.h" 8 #include "content/renderer/media/audio_device_factory.h"
9 9
10 using content::AudioDeviceFactory; 10 using content::AudioDeviceFactory;
(...skipping 24 matching lines...) Expand all
35 if (is_running_) { 35 if (is_running_) {
36 audio_device_->Stop(); 36 audio_device_->Stop();
37 is_running_ = false; 37 is_running_ = false;
38 } 38 }
39 } 39 }
40 40
41 double RendererWebAudioDeviceImpl::sampleRate() { 41 double RendererWebAudioDeviceImpl::sampleRate() {
42 return 44100.0; 42 return 44100.0;
43 } 43 }
44 44
45 int RendererWebAudioDeviceImpl::Render(const std::vector<float*>& audio_data, 45 int RendererWebAudioDeviceImpl::Render(media::AudioBus* audio_bus,
46 int number_of_frames,
47 int audio_delay_milliseconds) { 46 int audio_delay_milliseconds) {
48 // Make the client callback to get rendered audio. 47 // Make the client callback to get rendered audio.
49 DCHECK(client_callback_); 48 DCHECK(client_callback_);
50 if (client_callback_) { 49 if (client_callback_) {
51 // Wrap the pointers using WebVector. 50 // Wrap the pointers using WebVector.
52 WebVector<float*> web_audio_data(audio_data.size()); 51 WebVector<float*> web_audio_data(
53 for (size_t i = 0; i < audio_data.size(); ++i) 52 static_cast<size_t>(audio_bus->channels()));
54 web_audio_data[i] = audio_data[i]; 53 for (int i = 0; i < audio_bus->channels(); ++i)
54 web_audio_data[i] = audio_bus->channel(i);
55 55
56 client_callback_->render(web_audio_data, number_of_frames); 56 client_callback_->render(web_audio_data, audio_bus->frames());
57 } 57 }
58 return number_of_frames; 58 return audio_bus->frames();
59 } 59 }
60 60
61 void RendererWebAudioDeviceImpl::OnRenderError() { 61 void RendererWebAudioDeviceImpl::OnRenderError() {
62 // TODO(crogers): implement error handling. 62 // TODO(crogers): implement error handling.
63 } 63 }
OLDNEW
« no previous file with comments | « content/renderer/media/renderer_webaudiodevice_impl.h ('k') | content/renderer/media/webrtc_audio_device_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698