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

Side by Side Diff: media/base/audio_converter_unittest.cc

Issue 2517503003: Reland: Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Comments from chcunningham@ and Dale Created 4 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
« no previous file with comments | « media/base/audio_bus_perftest.cc ('k') | media/base/audio_hash_unittest.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 4
5 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "media/base/audio_converter.h" 8 #include "media/base/audio_converter.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return true; 108 return true;
109 } 109 }
110 110
111 // Runs a single Convert() stage, fills |expected_audio_bus_| appropriately, 111 // Runs a single Convert() stage, fills |expected_audio_bus_| appropriately,
112 // and validates equality with |audio_bus_| after |scale| is applied. 112 // and validates equality with |audio_bus_| after |scale| is applied.
113 bool RenderAndValidateAudioData(float scale) { 113 bool RenderAndValidateAudioData(float scale) {
114 // Render actual audio data. 114 // Render actual audio data.
115 converter_->Convert(audio_bus_.get()); 115 converter_->Convert(audio_bus_.get());
116 116
117 // Render expected audio data. 117 // Render expected audio data.
118 expected_callback_->Render(expected_audio_bus_.get(), 0, 0); 118 expected_callback_->Render(base::TimeDelta(), base::TimeTicks::Now(), 0,
119 expected_audio_bus_.get());
119 120
120 // Zero out unused channels in the expected AudioBus just as AudioConverter 121 // Zero out unused channels in the expected AudioBus just as AudioConverter
121 // would during channel mixing. 122 // would during channel mixing.
122 for (int i = input_parameters_.channels(); 123 for (int i = input_parameters_.channels();
123 i < output_parameters_.channels(); ++i) { 124 i < output_parameters_.channels(); ++i) {
124 memset(expected_audio_bus_->channel(i), 0, 125 memset(expected_audio_bus_->channel(i), 0,
125 audio_bus_->frames() * sizeof(*audio_bus_->channel(i))); 126 audio_bus_->frames() * sizeof(*audio_bus_->channel(i)));
126 } 127 }
127 128
128 return ValidateAudioData(0, audio_bus_->frames(), scale); 129 return ValidateAudioData(0, audio_bus_->frames(), scale);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // No resampling. No channel mixing. 259 // No resampling. No channel mixing.
259 std::tr1::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048), 260 std::tr1::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048),
260 261
261 // Upsampling. Channel upmixing. 262 // Upsampling. Channel upmixing.
262 std::tr1::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033), 263 std::tr1::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033),
263 264
264 // Downsampling. Channel downmixing. 265 // Downsampling. Channel downmixing.
265 std::tr1::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042))); 266 std::tr1::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042)));
266 267
267 } // namespace media 268 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_bus_perftest.cc ('k') | media/base/audio_hash_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698