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

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

Issue 8922016: Compile fix for gcc 4.6 (unused variable). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/audio_renderer_impl.h" 5 #include "content/renderer/media/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 size_t number_of_frames, 196 size_t number_of_frames,
197 size_t audio_delay_milliseconds) { 197 size_t audio_delay_milliseconds) {
198 if (stopped_ || GetPlaybackRate() == 0.0f) { 198 if (stopped_ || GetPlaybackRate() == 0.0f) {
199 // Output silence if stopped. 199 // Output silence if stopped.
200 for (size_t i = 0; i < audio_data.size(); ++i) 200 for (size_t i = 0; i < audio_data.size(); ++i)
201 memset(audio_data[i], 0, sizeof(float) * number_of_frames); 201 memset(audio_data[i], 0, sizeof(float) * number_of_frames);
202 return; 202 return;
203 } 203 }
204 204
205 // Adjust the playback delay. 205 // Adjust the playback delay.
206 base::Time current_time = base::Time::Now();
207
208 base::TimeDelta request_delay = 206 base::TimeDelta request_delay =
209 base::TimeDelta::FromMilliseconds(audio_delay_milliseconds); 207 base::TimeDelta::FromMilliseconds(audio_delay_milliseconds);
210 208
211 // Finally we need to adjust the delay according to playback rate. 209 // Finally we need to adjust the delay according to playback rate.
212 if (GetPlaybackRate() != 1.0f) { 210 if (GetPlaybackRate() != 1.0f) {
213 request_delay = base::TimeDelta::FromMicroseconds( 211 request_delay = base::TimeDelta::FromMicroseconds(
214 static_cast<int64>(ceil(request_delay.InMicroseconds() * 212 static_cast<int64>(ceil(request_delay.InMicroseconds() *
215 GetPlaybackRate()))); 213 GetPlaybackRate())));
216 } 214 }
217 215
(...skipping 22 matching lines...) Expand all
240 bytes_per_frame / channels, 238 bytes_per_frame / channels,
241 filled_frames); 239 filled_frames);
242 240
243 // If FillBuffer() didn't give us enough data then zero out the remainder. 241 // If FillBuffer() didn't give us enough data then zero out the remainder.
244 if (filled_frames < number_of_frames) { 242 if (filled_frames < number_of_frames) {
245 int frames_to_zero = number_of_frames - filled_frames; 243 int frames_to_zero = number_of_frames - filled_frames;
246 memset(audio_data[channel_index], 0, sizeof(float) * frames_to_zero); 244 memset(audio_data[channel_index], 0, sizeof(float) * frames_to_zero);
247 } 245 }
248 } 246 }
249 } 247 }
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