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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
10 #include "base/files/memory_mapped_file.h" | 11 #include "base/files/memory_mapped_file.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
15 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
16 #include "base/message_loop/message_loop_proxy.h" | 17 #include "base/message_loop/message_loop_proxy.h" |
17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
18 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
20 #include "chromecast/media/base/decrypt_context.h" | 21 #include "chromecast/media/base/decrypt_context.h" |
21 #include "chromecast/media/cma/backend/audio_pipeline_device.h" | 22 #include "chromecast/media/cma/backend/audio_pipeline_device.h" |
22 #include "chromecast/media/cma/backend/media_clock_device.h" | 23 #include "chromecast/media/cma/backend/media_clock_device.h" |
23 #include "chromecast/media/cma/backend/media_pipeline_device.h" | 24 #include "chromecast/media/cma/backend/media_pipeline_device.h" |
24 #include "chromecast/media/cma/backend/media_pipeline_device_params.h" | 25 #include "chromecast/media/cma/backend/media_pipeline_device_params.h" |
25 #include "chromecast/media/cma/backend/video_pipeline_device.h" | 26 #include "chromecast/media/cma/backend/video_pipeline_device.h" |
26 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" | 27 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" |
27 #include "chromecast/media/cma/base/decoder_buffer_base.h" | 28 #include "chromecast/media/cma/base/decoder_buffer_base.h" |
28 #include "chromecast/media/cma/base/decoder_config_adapter.h" | 29 #include "chromecast/media/cma/base/decoder_config_adapter.h" |
29 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" | 30 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" |
30 #include "chromecast/media/cma/test/media_component_device_feeder_for_test.h" | 31 #include "chromecast/media/cma/test/media_component_device_feeder_for_test.h" |
| 32 #include "chromecast/public/cast_media_shlib.h" |
31 #include "chromecast/public/media/decoder_config.h" | 33 #include "chromecast/public/media/decoder_config.h" |
32 #include "media/base/audio_decoder_config.h" | 34 #include "media/base/audio_decoder_config.h" |
33 #include "media/base/buffers.h" | 35 #include "media/base/buffers.h" |
34 #include "media/base/decoder_buffer.h" | 36 #include "media/base/decoder_buffer.h" |
35 #include "media/base/video_decoder_config.h" | 37 #include "media/base/video_decoder_config.h" |
36 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
37 | 39 |
38 namespace chromecast { | 40 namespace chromecast { |
39 namespace media { | 41 namespace media { |
40 | 42 |
(...skipping 23 matching lines...) Expand all Loading... |
64 PauseInfo(base::TimeDelta d, base::TimeDelta l) : delay(d), length(l) {} | 66 PauseInfo(base::TimeDelta d, base::TimeDelta l) : delay(d), length(l) {} |
65 ~PauseInfo() {} | 67 ~PauseInfo() {} |
66 | 68 |
67 base::TimeDelta delay; | 69 base::TimeDelta delay; |
68 base::TimeDelta length; | 70 base::TimeDelta length; |
69 }; | 71 }; |
70 | 72 |
71 AudioVideoPipelineDeviceTest(); | 73 AudioVideoPipelineDeviceTest(); |
72 ~AudioVideoPipelineDeviceTest() override; | 74 ~AudioVideoPipelineDeviceTest() override; |
73 | 75 |
| 76 void SetUp() override { |
| 77 CastMediaShlib::Initialize( |
| 78 base::CommandLine::ForCurrentProcess()->argv()); |
| 79 } |
| 80 |
| 81 void TearDown() override { |
| 82 CastMediaShlib::Finalize(); |
| 83 } |
| 84 |
74 void ConfigureForFile(std::string filename); | 85 void ConfigureForFile(std::string filename); |
75 void ConfigureForAudioOnly(std::string filename); | 86 void ConfigureForAudioOnly(std::string filename); |
76 void ConfigureForVideoOnly(std::string filename, bool raw_h264); | 87 void ConfigureForVideoOnly(std::string filename, bool raw_h264); |
77 | 88 |
78 // Pattern loops, waiting >= pattern[i].delay against media clock between | 89 // Pattern loops, waiting >= pattern[i].delay against media clock between |
79 // pauses, then pausing for >= pattern[i].length against MessageLoop | 90 // pauses, then pausing for >= pattern[i].length against MessageLoop |
80 // A pause with delay <0 signals to stop sequence and do not loop | 91 // A pause with delay <0 signals to stop sequence and do not loop |
81 void SetPausePattern(const std::vector<PauseInfo> pattern); | 92 void SetPausePattern(const std::vector<PauseInfo> pattern); |
82 | 93 |
83 // Adds a pause to the end of pause pattern | 94 // Adds a pause to the end of pause pattern |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 TEST_F(AudioVideoPipelineDeviceTest, WebmPlayback) { | 383 TEST_F(AudioVideoPipelineDeviceTest, WebmPlayback) { |
373 scoped_ptr<base::MessageLoop> message_loop(new base::MessageLoop()); | 384 scoped_ptr<base::MessageLoop> message_loop(new base::MessageLoop()); |
374 | 385 |
375 ConfigureForFile("bear-640x360.webm"); | 386 ConfigureForFile("bear-640x360.webm"); |
376 Start(); | 387 Start(); |
377 message_loop->Run(); | 388 message_loop->Run(); |
378 } | 389 } |
379 | 390 |
380 } // namespace media | 391 } // namespace media |
381 } // namespace chromecast | 392 } // namespace chromecast |
OLD | NEW |