OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/common/gpu/media/android_video_decode_accelerator.h" | 5 #include "media/gpu/android_video_decode_accelerator.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "content/common/gpu/media/android_copying_backing_strategy.h" | |
16 #include "content/common/gpu/media/android_video_decode_accelerator.h" | |
17 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
18 #include "media/base/android/media_codec_util.h" | 16 #include "media/base/android/media_codec_util.h" |
19 #include "media/base/android/media_jni_registrar.h" | 17 #include "media/base/android/media_jni_registrar.h" |
| 18 #include "media/gpu/android_copying_backing_strategy.h" |
| 19 #include "media/gpu/android_video_decode_accelerator.h" |
20 #include "media/video/picture.h" | 20 #include "media/video/picture.h" |
21 #include "media/video/video_decode_accelerator.h" | 21 #include "media/video/video_decode_accelerator.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "ui/gl/android/surface_texture.h" | 23 #include "ui/gl/android/surface_texture.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 bool MockMakeContextCurrent() { | 27 bool MockMakeContextCurrent() { |
28 return true; | 28 return true; |
29 } | 29 } |
30 | 30 |
31 static base::WeakPtr<gpu::gles2::GLES2Decoder> MockGetGLES2Decoder( | 31 static base::WeakPtr<gpu::gles2::GLES2Decoder> MockGetGLES2Decoder( |
32 const base::WeakPtr<gpu::gles2::GLES2Decoder>& decoder) { | 32 const base::WeakPtr<gpu::gles2::GLES2Decoder>& decoder) { |
33 return decoder; | 33 return decoder; |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 namespace content { | 38 namespace media { |
39 | 39 |
40 class MockVideoDecodeAcceleratorClient | 40 class MockVideoDecodeAcceleratorClient |
41 : public media::VideoDecodeAccelerator::Client { | 41 : public media::VideoDecodeAccelerator::Client { |
42 public: | 42 public: |
43 MockVideoDecodeAcceleratorClient() {} | 43 MockVideoDecodeAcceleratorClient() {} |
44 ~MockVideoDecodeAcceleratorClient() override {} | 44 ~MockVideoDecodeAcceleratorClient() override {} |
45 | 45 |
46 // VideoDecodeAccelerator::Client implementation. | 46 // VideoDecodeAccelerator::Client implementation. |
47 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, | 47 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, |
48 uint32_t textures_per_buffer, | 48 uint32_t textures_per_buffer, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 TEST_F(AndroidVideoDecodeAcceleratorTest, ConfigureUnsupportedCodec) { | 97 TEST_F(AndroidVideoDecodeAcceleratorTest, ConfigureUnsupportedCodec) { |
98 EXPECT_FALSE(Configure(media::kUnknownVideoCodec)); | 98 EXPECT_FALSE(Configure(media::kUnknownVideoCodec)); |
99 } | 99 } |
100 | 100 |
101 TEST_F(AndroidVideoDecodeAcceleratorTest, ConfigureSupportedCodec) { | 101 TEST_F(AndroidVideoDecodeAcceleratorTest, ConfigureSupportedCodec) { |
102 if (!media::MediaCodecUtil::IsMediaCodecAvailable()) | 102 if (!media::MediaCodecUtil::IsMediaCodecAvailable()) |
103 return; | 103 return; |
104 EXPECT_TRUE(Configure(media::kCodecVP8)); | 104 EXPECT_TRUE(Configure(media::kCodecVP8)); |
105 } | 105 } |
106 | 106 |
107 } // namespace content | 107 } // namespace media |
108 | 108 |
109 int main(int argc, char **argv) { | 109 int main(int argc, char** argv) { |
110 testing::InitGoogleTest(&argc, argv); | 110 testing::InitGoogleTest(&argc, argv); |
111 return RUN_ALL_TESTS(); | 111 return RUN_ALL_TESTS(); |
112 } | 112 } |
OLD | NEW |