OLD | NEW |
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 #define DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(type) \ | 209 #define DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(type) \ |
210 template scoped_refptr<AudioBuffer> MakeAudioBuffer<type>( \ | 210 template scoped_refptr<AudioBuffer> MakeAudioBuffer<type>( \ |
211 SampleFormat format, \ | 211 SampleFormat format, \ |
212 ChannelLayout channel_layout, \ | 212 ChannelLayout channel_layout, \ |
213 size_t channel_count, \ | 213 size_t channel_count, \ |
214 int sample_rate, \ | 214 int sample_rate, \ |
215 type start, \ | 215 type start, \ |
216 type increment, \ | 216 type increment, \ |
217 size_t frames, \ | 217 size_t frames, \ |
218 base::TimeDelta start_time) | 218 base::TimeDelta start_time) |
219 DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(uint8); | 219 DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(uint8_t); |
220 DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(int16); | 220 DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(int16_t); |
221 DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(int32); | 221 DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(int32_t); |
222 DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(float); | 222 DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(float); |
223 | 223 |
224 static const char kFakeVideoBufferHeader[] = "FakeVideoBufferForTest"; | 224 static const char kFakeVideoBufferHeader[] = "FakeVideoBufferForTest"; |
225 | 225 |
226 scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest( | 226 scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest( |
227 const VideoDecoderConfig& config, | 227 const VideoDecoderConfig& config, |
228 base::TimeDelta timestamp, base::TimeDelta duration) { | 228 base::TimeDelta timestamp, base::TimeDelta duration) { |
229 base::Pickle pickle; | 229 base::Pickle pickle; |
230 pickle.WriteString(kFakeVideoBufferHeader); | 230 pickle.WriteString(kFakeVideoBufferHeader); |
231 pickle.WriteInt(config.coded_size().width()); | 231 pickle.WriteInt(config.coded_size().width()); |
232 pickle.WriteInt(config.coded_size().height()); | 232 pickle.WriteInt(config.coded_size().height()); |
233 pickle.WriteInt64(timestamp.InMilliseconds()); | 233 pickle.WriteInt64(timestamp.InMilliseconds()); |
234 | 234 |
235 scoped_refptr<DecoderBuffer> buffer = DecoderBuffer::CopyFrom( | 235 scoped_refptr<DecoderBuffer> buffer = |
236 static_cast<const uint8*>(pickle.data()), | 236 DecoderBuffer::CopyFrom(static_cast<const uint8_t*>(pickle.data()), |
237 static_cast<int>(pickle.size())); | 237 static_cast<int>(pickle.size())); |
238 buffer->set_timestamp(timestamp); | 238 buffer->set_timestamp(timestamp); |
239 buffer->set_duration(duration); | 239 buffer->set_duration(duration); |
240 buffer->set_is_key_frame(true); | 240 buffer->set_is_key_frame(true); |
241 | 241 |
242 return buffer; | 242 return buffer; |
243 } | 243 } |
244 | 244 |
245 bool VerifyFakeVideoBufferForTest( | 245 bool VerifyFakeVideoBufferForTest( |
246 const scoped_refptr<DecoderBuffer>& buffer, | 246 const scoped_refptr<DecoderBuffer>& buffer, |
247 const VideoDecoderConfig& config) { | 247 const VideoDecoderConfig& config) { |
(...skipping 21 matching lines...) Expand all Loading... |
269 EXPECT_FALSE(expecting_b_); | 269 EXPECT_FALSE(expecting_b_); |
270 expecting_b_ = true; | 270 expecting_b_ = true; |
271 } | 271 } |
272 | 272 |
273 void CallbackPairChecker::RecordBCalled() { | 273 void CallbackPairChecker::RecordBCalled() { |
274 EXPECT_TRUE(expecting_b_); | 274 EXPECT_TRUE(expecting_b_); |
275 expecting_b_ = false; | 275 expecting_b_ = false; |
276 } | 276 } |
277 | 277 |
278 } // namespace media | 278 } // namespace media |
OLD | NEW |