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

Side by Side Diff: media/audio/simple_sources.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 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
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 // MSVC++ requires this to be set before any other includes to get M_PI. 4 // MSVC++ requires this to be set before any other includes to get M_PI.
5 #define _USE_MATH_DEFINES 5 #define _USE_MATH_DEFINES
6 #include <cmath> 6 #include <cmath>
7 7
8 #include "media/audio/simple_sources.h" 8 #include "media/audio/simple_sources.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 &bytes_written); 224 &bytes_written);
225 wav_file_read_pos_ += bytes_written; 225 wav_file_read_pos_ += bytes_written;
226 return 1.0; 226 return 1.0;
227 } 227 }
228 228
229 void FileSource::OnError(AudioOutputStream* stream) { 229 void FileSource::OnError(AudioOutputStream* stream) {
230 } 230 }
231 231
232 BeepingSource::BeepingSource(const AudioParameters& params) 232 BeepingSource::BeepingSource(const AudioParameters& params)
233 : buffer_size_(params.GetBytesPerBuffer()), 233 : buffer_size_(params.GetBytesPerBuffer()),
234 buffer_(new uint8[buffer_size_]), 234 buffer_(new uint8_t[buffer_size_]),
235 params_(params), 235 params_(params),
236 last_callback_time_(base::TimeTicks::Now()), 236 last_callback_time_(base::TimeTicks::Now()),
237 beep_duration_in_buffers_(kBeepDurationMilliseconds * 237 beep_duration_in_buffers_(kBeepDurationMilliseconds *
238 params.sample_rate() / 238 params.sample_rate() /
239 params.frames_per_buffer() / 239 params.frames_per_buffer() /
240 1000), 240 1000),
241 beep_generated_in_buffers_(0), 241 beep_generated_in_buffers_(0),
242 beep_period_in_frames_(params.sample_rate() / kBeepFrequency) { 242 beep_period_in_frames_(params.sample_rate() / kBeepFrequency) {}
243 }
244 243
245 BeepingSource::~BeepingSource() { 244 BeepingSource::~BeepingSource() {
246 } 245 }
247 246
248 int BeepingSource::OnMoreData(AudioBus* audio_bus, 247 int BeepingSource::OnMoreData(AudioBus* audio_bus,
249 uint32_t total_bytes_delay, 248 uint32_t total_bytes_delay,
250 uint32_t frames_skipped) { 249 uint32_t frames_skipped) {
251 // Accumulate the time from the last beep. 250 // Accumulate the time from the last beep.
252 interval_from_last_beep_ += base::TimeTicks::Now() - last_callback_time_; 251 interval_from_last_beep_ += base::TimeTicks::Now() - last_callback_time_;
253 252
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 296 }
298 297
299 void BeepingSource::OnError(AudioOutputStream* stream) { 298 void BeepingSource::OnError(AudioOutputStream* stream) {
300 } 299 }
301 300
302 void BeepingSource::BeepOnce() { 301 void BeepingSource::BeepOnce() {
303 g_beep_context.Pointer()->SetBeepOnce(true); 302 g_beep_context.Pointer()->SetBeepOnce(true);
304 } 303 }
305 304
306 } // namespace media 305 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698