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

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

Issue 10834033: Move AudioDevice and AudioInputDevice to media. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and fixed a few lint issues 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/render_audiosourceprovider.h" 5 #include "content/renderer/media/render_audiosourceprovider.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 vector<float*> v(audio_data.size()); 76 vector<float*> v(audio_data.size());
77 for (size_t i = 0; i < audio_data.size(); ++i) 77 for (size_t i = 0; i < audio_data.size(); ++i)
78 v[i] = audio_data[i]; 78 v[i] = audio_data[i];
79 79
80 // TODO(crogers): figure out if we should volume scale here or in common 80 // TODO(crogers): figure out if we should volume scale here or in common
81 // WebAudio code. In any case we need to take care of volume. 81 // WebAudio code. In any case we need to take care of volume.
82 renderer_->Render(v, number_of_frames, 0); 82 renderer_->Render(v, number_of_frames, 0);
83 } else { 83 } else {
84 // Provide silence if the source is not running. 84 // Provide silence if the source is not running.
85 for (size_t i = 0; i < audio_data.size(); ++i) 85 for (size_t i = 0; i < audio_data.size(); ++i)
86 memset(audio_data[i], 0, sizeof(float) * number_of_frames); 86 memset(audio_data[i], 0, sizeof(audio_data[0]) * number_of_frames);
87 } 87 }
88 } 88 }
89 89
90 void RenderAudioSourceProvider::Start() { 90 void RenderAudioSourceProvider::Start() {
91 base::AutoLock auto_lock(sink_lock_); 91 base::AutoLock auto_lock(sink_lock_);
92 if (!client_) 92 if (!client_)
93 default_sink_->Start(); 93 default_sink_->Start();
94 is_running_ = true; 94 is_running_ = true;
95 } 95 }
96 96
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 if (client_) { 144 if (client_) {
145 // Inform WebKit about the audio stream format. 145 // Inform WebKit about the audio stream format.
146 client_->setFormat(channels_, sample_rate_); 146 client_->setFormat(channels_, sample_rate_);
147 } 147 }
148 148
149 is_initialized_ = true; 149 is_initialized_ = true;
150 } 150 }
151 151
152 RenderAudioSourceProvider::~RenderAudioSourceProvider() {} 152 RenderAudioSourceProvider::~RenderAudioSourceProvider() {}
OLDNEW
« no previous file with comments | « content/renderer/media/render_audiosourceprovider.h ('k') | content/renderer/media/scoped_loop_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698