| 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 21 matching lines...) Expand all Loading... |
| 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 virtual ~MockVideoDecodeAcceleratorClient() {}; |
| 38 | 38 |
| 39 // VideoDecodeAccelerator::Client implementation. | 39 // VideoDecodeAccelerator::Client implementation. |
| 40 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 40 virtual 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 virtual void DismissPictureBuffer(int32 picture_buffer_id) override {}; |
| 44 virtual void PictureReady(const media::Picture& picture) OVERRIDE {}; | 44 virtual void PictureReady(const media::Picture& picture) override {}; |
| 45 virtual void NotifyEndOfBitstreamBuffer( | 45 virtual void NotifyEndOfBitstreamBuffer( |
| 46 int32 bitstream_buffer_id) OVERRIDE {}; | 46 int32 bitstream_buffer_id) override {}; |
| 47 virtual void NotifyFlushDone() OVERRIDE {}; | 47 virtual void NotifyFlushDone() override {}; |
| 48 virtual void NotifyResetDone() OVERRIDE {}; | 48 virtual void NotifyResetDone() override {}; |
| 49 virtual void NotifyError( | 49 virtual void NotifyError( |
| 50 media::VideoDecodeAccelerator::Error error) OVERRIDE {}; | 50 media::VideoDecodeAccelerator::Error error) override {}; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class AndroidVideoDecodeAcceleratorTest : public testing::Test { | 53 class AndroidVideoDecodeAcceleratorTest : public testing::Test { |
| 54 public: | 54 public: |
| 55 virtual ~AndroidVideoDecodeAcceleratorTest() {} | 55 virtual ~AndroidVideoDecodeAcceleratorTest() {} |
| 56 | 56 |
| 57 protected: | 57 protected: |
| 58 virtual void SetUp() OVERRIDE { | 58 virtual void SetUp() override { |
| 59 JNIEnv* env = base::android::AttachCurrentThread(); | 59 JNIEnv* env = base::android::AttachCurrentThread(); |
| 60 media::RegisterJni(env); | 60 media::RegisterJni(env); |
| 61 // TODO(felipeg): fix GL bindings, so that the decoder can perform GL | 61 // TODO(felipeg): fix GL bindings, so that the decoder can perform GL |
| 62 // calls. | 62 // calls. |
| 63 scoped_ptr<gpu::gles2::MockGLES2Decoder> decoder( | 63 scoped_ptr<gpu::gles2::MockGLES2Decoder> decoder( |
| 64 new gpu::gles2::MockGLES2Decoder()); | 64 new gpu::gles2::MockGLES2Decoder()); |
| 65 scoped_ptr<MockVideoDecodeAcceleratorClient> client( | 65 scoped_ptr<MockVideoDecodeAcceleratorClient> client( |
| 66 new MockVideoDecodeAcceleratorClient()); | 66 new MockVideoDecodeAcceleratorClient()); |
| 67 accelerator_.reset(new AndroidVideoDecodeAccelerator( | 67 accelerator_.reset(new AndroidVideoDecodeAccelerator( |
| 68 decoder->AsWeakPtr(), base::Bind(&MockMakeContextCurrent))); | 68 decoder->AsWeakPtr(), base::Bind(&MockMakeContextCurrent))); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 89 return; | 89 return; |
| 90 EXPECT_TRUE(Configure(media::kCodecVP8)); | 90 EXPECT_TRUE(Configure(media::kCodecVP8)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace content | 93 } // namespace content |
| 94 | 94 |
| 95 int main(int argc, char **argv) { | 95 int main(int argc, char **argv) { |
| 96 testing::InitGoogleTest(&argc, argv); | 96 testing::InitGoogleTest(&argc, argv); |
| 97 return RUN_ALL_TESTS(); | 97 return RUN_ALL_TESTS(); |
| 98 } | 98 } |
| OLD | NEW |