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

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

Issue 290003002: Remove OnMoreIOData() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the media unittests on mac. Created 6 years, 7 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
« no previous file with comments | « media/audio/simple_sources.h ('k') | media/audio/sounds/audio_stream_handler.cc » ('j') | 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 // 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 30 matching lines...) Expand all
41 std::min(audio_bus->frames(), cap_ - time_state_) : audio_bus->frames(); 41 std::min(audio_bus->frames(), cap_ - time_state_) : audio_bus->frames();
42 for (int i = 0; i < max_frames; ++i) 42 for (int i = 0; i < max_frames; ++i)
43 audio_bus->channel(0)[i] = sin(2.0 * M_PI * f_ * time_state_++); 43 audio_bus->channel(0)[i] = sin(2.0 * M_PI * f_ * time_state_++);
44 for (int i = 1; i < audio_bus->channels(); ++i) { 44 for (int i = 1; i < audio_bus->channels(); ++i) {
45 memcpy(audio_bus->channel(i), audio_bus->channel(0), 45 memcpy(audio_bus->channel(i), audio_bus->channel(0),
46 max_frames * sizeof(*audio_bus->channel(i))); 46 max_frames * sizeof(*audio_bus->channel(i)));
47 } 47 }
48 return max_frames; 48 return max_frames;
49 } 49 }
50 50
51 int SineWaveAudioSource::OnMoreIOData(AudioBus* source,
52 AudioBus* dest,
53 AudioBuffersState audio_buffers) {
54 return OnMoreData(dest, audio_buffers);
55 }
56
57 void SineWaveAudioSource::OnError(AudioOutputStream* stream) { 51 void SineWaveAudioSource::OnError(AudioOutputStream* stream) {
58 errors_++; 52 errors_++;
59 } 53 }
60 54
61 void SineWaveAudioSource::CapSamples(int cap) { 55 void SineWaveAudioSource::CapSamples(int cap) {
62 base::AutoLock auto_lock(time_lock_); 56 base::AutoLock auto_lock(time_lock_);
63 DCHECK_GT(cap, 0); 57 DCHECK_GT(cap, 0);
64 cap_ = cap; 58 cap_ = cap;
65 } 59 }
66 60
67 void SineWaveAudioSource::Reset() { 61 void SineWaveAudioSource::Reset() {
68 base::AutoLock auto_lock(time_lock_); 62 base::AutoLock auto_lock(time_lock_);
69 time_state_ = 0; 63 time_state_ = 0;
70 } 64 }
71 65
72 } // namespace media 66 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/simple_sources.h ('k') | media/audio/sounds/audio_stream_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698