| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 : public TestWithParam<std::tuple<AudioDecoderType, TestParams>> { | 124 : public TestWithParam<std::tuple<AudioDecoderType, TestParams>> { |
| 125 public: | 125 public: |
| 126 AudioDecoderTest() | 126 AudioDecoderTest() |
| 127 : decoder_type_(std::get<0>(GetParam())), | 127 : decoder_type_(std::get<0>(GetParam())), |
| 128 params_(std::get<1>(GetParam())), | 128 params_(std::get<1>(GetParam())), |
| 129 pending_decode_(false), | 129 pending_decode_(false), |
| 130 pending_reset_(false), | 130 pending_reset_(false), |
| 131 last_decode_status_(DecodeStatus::DECODE_ERROR) { | 131 last_decode_status_(DecodeStatus::DECODE_ERROR) { |
| 132 switch (decoder_type_) { | 132 switch (decoder_type_) { |
| 133 case FFMPEG: | 133 case FFMPEG: |
| 134 decoder_.reset(new FFmpegAudioDecoder(message_loop_.task_runner(), | 134 decoder_.reset( |
| 135 new MediaLog())); | 135 new FFmpegAudioDecoder(message_loop_.task_runner(), &media_log_)); |
| 136 break; | 136 break; |
| 137 #if defined(OS_ANDROID) | 137 #if defined(OS_ANDROID) |
| 138 case MEDIA_CODEC: | 138 case MEDIA_CODEC: |
| 139 decoder_.reset(new MediaCodecAudioDecoder(message_loop_.task_runner())); | 139 decoder_.reset(new MediaCodecAudioDecoder(message_loop_.task_runner())); |
| 140 break; | 140 break; |
| 141 #endif | 141 #endif |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 virtual ~AudioDecoderTest() { | 145 virtual ~AudioDecoderTest() { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 private: | 384 private: |
| 385 const AudioDecoderType decoder_type_; | 385 const AudioDecoderType decoder_type_; |
| 386 | 386 |
| 387 // Current TestParams used to initialize the test and decoder. The initial | 387 // Current TestParams used to initialize the test and decoder. The initial |
| 388 // valie is std::get<1>(GetParam()). Could be overridden by set_param() so | 388 // valie is std::get<1>(GetParam()). Could be overridden by set_param() so |
| 389 // that the decoder can be reinitialized with different parameters. | 389 // that the decoder can be reinitialized with different parameters. |
| 390 TestParams params_; | 390 TestParams params_; |
| 391 | 391 |
| 392 base::MessageLoop message_loop_; | 392 base::MessageLoop message_loop_; |
| 393 | 393 |
| 394 MediaLog media_log_; |
| 394 scoped_refptr<DecoderBuffer> data_; | 395 scoped_refptr<DecoderBuffer> data_; |
| 395 std::unique_ptr<InMemoryUrlProtocol> protocol_; | 396 std::unique_ptr<InMemoryUrlProtocol> protocol_; |
| 396 std::unique_ptr<AudioFileReader> reader_; | 397 std::unique_ptr<AudioFileReader> reader_; |
| 397 | 398 |
| 398 std::unique_ptr<AudioDecoder> decoder_; | 399 std::unique_ptr<AudioDecoder> decoder_; |
| 399 bool pending_decode_; | 400 bool pending_decode_; |
| 400 bool pending_reset_; | 401 bool pending_reset_; |
| 401 DecodeStatus last_decode_status_; | 402 DecodeStatus last_decode_status_; |
| 402 | 403 |
| 403 std::deque<scoped_refptr<AudioBuffer> > decoded_audio_; | 404 std::deque<scoped_refptr<AudioBuffer> > decoded_audio_; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 Combine(Values(FFMPEG), ValuesIn(kFFmpegTestParams))); | 642 Combine(Values(FFMPEG), ValuesIn(kFFmpegTestParams))); |
| 642 | 643 |
| 643 #if defined(OS_ANDROID) | 644 #if defined(OS_ANDROID) |
| 644 INSTANTIATE_TEST_CASE_P(MediaCodec, | 645 INSTANTIATE_TEST_CASE_P(MediaCodec, |
| 645 AudioDecoderTest, | 646 AudioDecoderTest, |
| 646 Combine(Values(MEDIA_CODEC), | 647 Combine(Values(MEDIA_CODEC), |
| 647 ValuesIn(kMediaCodecTestParams))); | 648 ValuesIn(kMediaCodecTestParams))); |
| 648 #endif // defined(OS_ANDROID) | 649 #endif // defined(OS_ANDROID) |
| 649 | 650 |
| 650 } // namespace media | 651 } // namespace media |
| OLD | NEW |