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

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

Issue 10832123: Coverity: Fix a sizeof mismatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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 "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(audio_data[0]) * 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 if (client_) { 138 if (client_) {
139 // Inform WebKit about the audio stream format. 139 // Inform WebKit about the audio stream format.
140 client_->setFormat(channels_, sample_rate_); 140 client_->setFormat(channels_, sample_rate_);
141 } 141 }
142 142
143 is_initialized_ = true; 143 is_initialized_ = true;
144 } 144 }
145 145
146 RenderAudioSourceProvider::~RenderAudioSourceProvider() {} 146 RenderAudioSourceProvider::~RenderAudioSourceProvider() {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698