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

Side by Side Diff: media/cast/test/utility/audio_utility.cc

Issue 481193003: Remove AudioBuffersState usage in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix audio muter build buster. Created 6 years, 2 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 | « media/cast/test/receiver.cc ('k') | media/media.gyp » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <cmath> 5 #include <cmath>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 18 matching lines...) Expand all
29 CHECK_LE(volume_, 1.0f); 29 CHECK_LE(volume_, 1.0f);
30 } 30 }
31 31
32 TestAudioBusFactory::~TestAudioBusFactory() {} 32 TestAudioBusFactory::~TestAudioBusFactory() {}
33 33
34 scoped_ptr<AudioBus> TestAudioBusFactory::NextAudioBus( 34 scoped_ptr<AudioBus> TestAudioBusFactory::NextAudioBus(
35 const base::TimeDelta& duration) { 35 const base::TimeDelta& duration) {
36 const int num_samples = static_cast<int>((sample_rate_ * duration) / 36 const int num_samples = static_cast<int>((sample_rate_ * duration) /
37 base::TimeDelta::FromSeconds(1)); 37 base::TimeDelta::FromSeconds(1));
38 scoped_ptr<AudioBus> bus(AudioBus::Create(num_channels_, num_samples)); 38 scoped_ptr<AudioBus> bus(AudioBus::Create(num_channels_, num_samples));
39 source_.OnMoreData(bus.get(), AudioBuffersState()); 39 source_.OnMoreData(bus.get(), 0);
40 bus->Scale(volume_); 40 bus->Scale(volume_);
41 return bus.Pass(); 41 return bus.Pass();
42 } 42 }
43 43
44 int CountZeroCrossings(const float* samples, int length) { 44 int CountZeroCrossings(const float* samples, int length) {
45 // The sample values must pass beyond |kAmplitudeThreshold| on the opposite 45 // The sample values must pass beyond |kAmplitudeThreshold| on the opposite
46 // side of zero before a crossing will be counted. 46 // side of zero before a crossing will be counted.
47 const float kAmplitudeThreshold = 0.03f; // 3% of max amplitude. 47 const float kAmplitudeThreshold = 0.03f; // 3% of max amplitude.
48 48
49 int count = 0; 49 int count = 0;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 *timestamp = gray_coded; 181 *timestamp = gray_coded;
182 return true; 182 return true;
183 } 183 }
184 } 184 }
185 return false; 185 return false;
186 } 186 }
187 187
188 } // namespace cast 188 } // namespace cast
189 } // namespace media 189 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/receiver.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698