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 "content/common/gpu/media/android_video_decode_accelerator.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 // TODO(felipeg): Add more unit tests to test the ordinary behavior of | 30 // TODO(felipeg): Add more unit tests to test the ordinary behavior of |
31 // AndroidVideoDecodeAccelerator. | 31 // AndroidVideoDecodeAccelerator. |
32 // http://crbug.com/178647 | 32 // http://crbug.com/178647 |
33 class MockVideoDecodeAcceleratorClient | 33 class MockVideoDecodeAcceleratorClient |
34 : public media::VideoDecodeAccelerator::Client { | 34 : public media::VideoDecodeAccelerator::Client { |
35 public: | 35 public: |
36 MockVideoDecodeAcceleratorClient() {}; | 36 MockVideoDecodeAcceleratorClient() {} |
37 virtual ~MockVideoDecodeAcceleratorClient() {}; | 37 ~MockVideoDecodeAcceleratorClient() override {} |
38 | 38 |
39 // VideoDecodeAccelerator::Client implementation. | 39 // VideoDecodeAccelerator::Client implementation. |
40 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 40 void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
41 const gfx::Size& dimensions, | 41 const gfx::Size& dimensions, |
42 uint32 texture_target) override {}; | 42 uint32 texture_target) override {} |
43 virtual void DismissPictureBuffer(int32 picture_buffer_id) override {}; | 43 void DismissPictureBuffer(int32 picture_buffer_id) override {} |
44 virtual void PictureReady(const media::Picture& picture) override {}; | 44 void PictureReady(const media::Picture& picture) override {} |
45 virtual void NotifyEndOfBitstreamBuffer( | 45 void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override {} |
46 int32 bitstream_buffer_id) override {}; | 46 void NotifyFlushDone() override {} |
47 virtual void NotifyFlushDone() override {}; | 47 void NotifyResetDone() override {} |
48 virtual void NotifyResetDone() override {}; | 48 void NotifyError(media::VideoDecodeAccelerator::Error error) override {} |
49 virtual void NotifyError( | |
50 media::VideoDecodeAccelerator::Error error) override {}; | |
51 }; | 49 }; |
52 | 50 |
53 class AndroidVideoDecodeAcceleratorTest : public testing::Test { | 51 class AndroidVideoDecodeAcceleratorTest : public testing::Test { |
54 public: | 52 public: |
55 virtual ~AndroidVideoDecodeAcceleratorTest() {} | 53 ~AndroidVideoDecodeAcceleratorTest() override {} |
56 | 54 |
57 protected: | 55 protected: |
58 virtual void SetUp() override { | 56 void SetUp() override { |
59 JNIEnv* env = base::android::AttachCurrentThread(); | 57 JNIEnv* env = base::android::AttachCurrentThread(); |
60 media::RegisterJni(env); | 58 media::RegisterJni(env); |
61 // TODO(felipeg): fix GL bindings, so that the decoder can perform GL | 59 // TODO(felipeg): fix GL bindings, so that the decoder can perform GL |
62 // calls. | 60 // calls. |
63 scoped_ptr<gpu::gles2::MockGLES2Decoder> decoder( | 61 scoped_ptr<gpu::gles2::MockGLES2Decoder> decoder( |
64 new gpu::gles2::MockGLES2Decoder()); | 62 new gpu::gles2::MockGLES2Decoder()); |
65 scoped_ptr<MockVideoDecodeAcceleratorClient> client( | 63 scoped_ptr<MockVideoDecodeAcceleratorClient> client( |
66 new MockVideoDecodeAcceleratorClient()); | 64 new MockVideoDecodeAcceleratorClient()); |
67 accelerator_.reset(new AndroidVideoDecodeAccelerator( | 65 accelerator_.reset(new AndroidVideoDecodeAccelerator( |
68 decoder->AsWeakPtr(), base::Bind(&MockMakeContextCurrent))); | 66 decoder->AsWeakPtr(), base::Bind(&MockMakeContextCurrent))); |
(...skipping 20 matching lines...) Expand all Loading... |
89 return; | 87 return; |
90 EXPECT_TRUE(Configure(media::kCodecVP8)); | 88 EXPECT_TRUE(Configure(media::kCodecVP8)); |
91 } | 89 } |
92 | 90 |
93 } // namespace content | 91 } // namespace content |
94 | 92 |
95 int main(int argc, char **argv) { | 93 int main(int argc, char **argv) { |
96 testing::InitGoogleTest(&argc, argv); | 94 testing::InitGoogleTest(&argc, argv); |
97 return RUN_ALL_TESTS(); | 95 return RUN_ALL_TESTS(); |
98 } | 96 } |
OLD | NEW |