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

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

Issue 259453003: Introduce AudioDiscardHelper. Refactor audio decoders to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix x64 type. 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 | Annotate | Revision Log
« no previous file with comments | « media/base/audio_discard_helper_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.h » ('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 #include "media/base/test_helpers.h" 5 #include "media/base/test_helpers.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // start + increment 178 // start + increment
179 // start + 2 * increment, ... 179 // start + 2 * increment, ...
180 // While, values in channel 1 will be: 180 // While, values in channel 1 will be:
181 // start + frames * increment 181 // start + frames * increment
182 // start + (frames + 1) * increment 182 // start + (frames + 1) * increment
183 // start + (frames + 2) * increment, ... 183 // start + (frames + 2) * increment, ...
184 const size_t output_size = 184 const size_t output_size =
185 output->channel_data().size() == 1 ? frames * channels : frames; 185 output->channel_data().size() == 1 ? frames * channels : frames;
186 for (size_t ch = 0; ch < output->channel_data().size(); ++ch) { 186 for (size_t ch = 0; ch < output->channel_data().size(); ++ch) {
187 T* buffer = reinterpret_cast<T*>(output->channel_data()[ch]); 187 T* buffer = reinterpret_cast<T*>(output->channel_data()[ch]);
188 const T v = static_cast<T>(start + ch * output_size * increment);
188 for (size_t i = 0; i < output_size; ++i) { 189 for (size_t i = 0; i < output_size; ++i) {
189 buffer[i] = start; 190 buffer[i] = static_cast<T>(v + i * increment);
190 start += increment;
191 } 191 }
192 } 192 }
193 return output; 193 return output;
194 } 194 }
195 195
196 // Instantiate all the types of MakeAudioBuffer() and 196 // Instantiate all the types of MakeAudioBuffer() and
197 // MakeAudioBuffer() needed. 197 // MakeAudioBuffer() needed.
198 #define DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(type) \ 198 #define DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(type) \
199 template scoped_refptr<AudioBuffer> MakeAudioBuffer<type>( \ 199 template scoped_refptr<AudioBuffer> MakeAudioBuffer<type>( \
200 SampleFormat format, \ 200 SampleFormat format, \
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 int width = 0; 241 int width = 0;
242 int height = 0; 242 int height = 0;
243 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) && 243 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) &&
244 pickle.ReadInt(&height); 244 pickle.ReadInt(&height);
245 return (success && header == kFakeVideoBufferHeader && 245 return (success && header == kFakeVideoBufferHeader &&
246 width == config.coded_size().width() && 246 width == config.coded_size().width() &&
247 height == config.coded_size().height()); 247 height == config.coded_size().height());
248 } 248 }
249 249
250 } // namespace media 250 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_discard_helper_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698