Chromium Code Reviews| 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 "media/gpu/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 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 ~AndroidVideoDecodeAcceleratorTest() override {} | 62 ~AndroidVideoDecodeAcceleratorTest() override {} |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 void SetUp() override { | 65 void SetUp() override { |
| 66 JNIEnv* env = base::android::AttachCurrentThread(); | 66 JNIEnv* env = base::android::AttachCurrentThread(); |
| 67 RegisterJni(env); | 67 RegisterJni(env); |
| 68 | 68 |
| 69 gl::init::ClearGLBindings(); | 69 gl::init::ClearGLBindings(); |
| 70 ASSERT_TRUE(gl::init::InitializeGLOneOff()); | 70 ASSERT_TRUE(gl::init::InitializeGLOneOff()); |
| 71 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size(1024, 1024)); | 71 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size(1024, 1024)); |
| 72 context_ = gl::init::CreateGLContext(nullptr, surface_.get(), | 72 gl::GLContextAttribs context_attribs; |
| 73 gl::PreferDiscreteGpu); | 73 context_attribs.gpu_preference = gl::PreferDiscreteGpu; |
|
piman
2016/11/07 21:01:01
nit: ditto, default is fine.
Geoff Lang
2016/11/07 21:36:20
Done.
| |
| 74 context_ = | |
| 75 gl::init::CreateGLContext(nullptr, surface_.get(), context_attribs); | |
| 74 context_->MakeCurrent(surface_.get()); | 76 context_->MakeCurrent(surface_.get()); |
| 75 | 77 |
| 76 // Start a message loop because AVDA starts a timer task. | 78 // Start a message loop because AVDA starts a timer task. |
| 77 message_loop_.reset(new base::MessageLoop()); | 79 message_loop_.reset(new base::MessageLoop()); |
| 78 gl_decoder_.reset(new testing::NiceMock<gpu::gles2::MockGLES2Decoder>()); | 80 gl_decoder_.reset(new testing::NiceMock<gpu::gles2::MockGLES2Decoder>()); |
| 79 client_.reset(new MockVideoDecodeAcceleratorClient()); | 81 client_.reset(new MockVideoDecodeAcceleratorClient()); |
| 80 | 82 |
| 81 vda_.reset(new AndroidVideoDecodeAccelerator( | 83 vda_.reset(new AndroidVideoDecodeAccelerator( |
| 82 base::Bind(&MakeContextCurrent), | 84 base::Bind(&MakeContextCurrent), |
| 83 base::Bind(&GetGLES2Decoder, gl_decoder_->AsWeakPtr()))); | 85 base::Bind(&GetGLES2Decoder, gl_decoder_->AsWeakPtr()))); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 105 } | 107 } |
| 106 | 108 |
| 107 TEST_F(AndroidVideoDecodeAcceleratorTest, ConfigureSupportedCodec) { | 109 TEST_F(AndroidVideoDecodeAcceleratorTest, ConfigureSupportedCodec) { |
| 108 if (!MediaCodecUtil::IsMediaCodecAvailable()) | 110 if (!MediaCodecUtil::IsMediaCodecAvailable()) |
| 109 return; | 111 return; |
| 110 // H264 is always supported by AVDA. | 112 // H264 is always supported by AVDA. |
| 111 ASSERT_TRUE(Initialize(H264PROFILE_BASELINE)); | 113 ASSERT_TRUE(Initialize(H264PROFILE_BASELINE)); |
| 112 } | 114 } |
| 113 | 115 |
| 114 } // namespace media | 116 } // namespace media |
| OLD | NEW |