| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 virtual void SetUp() OVERRIDE { | 59 virtual void SetUp() OVERRIDE { |
| 60 JNIEnv* env = base::android::AttachCurrentThread(); | 60 JNIEnv* env = base::android::AttachCurrentThread(); |
| 61 media::RegisterJni(env); | 61 media::RegisterJni(env); |
| 62 // TODO(felipeg): fix GL bindings, so that the decoder can perform GL | 62 // TODO(felipeg): fix GL bindings, so that the decoder can perform GL |
| 63 // calls. | 63 // calls. |
| 64 scoped_ptr<gpu::gles2::MockGLES2Decoder> decoder( | 64 scoped_ptr<gpu::gles2::MockGLES2Decoder> decoder( |
| 65 new gpu::gles2::MockGLES2Decoder()); | 65 new gpu::gles2::MockGLES2Decoder()); |
| 66 scoped_ptr<MockVideoDecodeAcceleratorClient> client( | 66 scoped_ptr<MockVideoDecodeAcceleratorClient> client( |
| 67 new MockVideoDecodeAcceleratorClient()); | 67 new MockVideoDecodeAcceleratorClient()); |
| 68 accelerator_.reset(new AndroidVideoDecodeAccelerator( | 68 accelerator_.reset(new AndroidVideoDecodeAccelerator( |
| 69 client.get(), decoder->AsWeakPtr(), | 69 decoder->AsWeakPtr(), base::Bind(&MockMakeContextCurrent))); |
| 70 base::Bind(&MockMakeContextCurrent))); | |
| 71 } | 70 } |
| 72 | 71 |
| 73 bool Configure(media::VideoCodec codec) { | 72 bool Configure(media::VideoCodec codec) { |
| 74 AndroidVideoDecodeAccelerator* accelerator = | 73 AndroidVideoDecodeAccelerator* accelerator = |
| 75 static_cast<AndroidVideoDecodeAccelerator*>(accelerator_.get()); | 74 static_cast<AndroidVideoDecodeAccelerator*>(accelerator_.get()); |
| 76 accelerator->surface_texture_ = new gfx::SurfaceTexture(0); | 75 accelerator->surface_texture_ = new gfx::SurfaceTexture(0); |
| 77 accelerator->codec_ = codec; | 76 accelerator->codec_ = codec; |
| 78 return accelerator->ConfigureMediaCodec(); | 77 return accelerator->ConfigureMediaCodec(); |
| 79 } | 78 } |
| 80 | 79 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 93 return; | 92 return; |
| 94 EXPECT_TRUE(Configure(media::kCodecVP8)); | 93 EXPECT_TRUE(Configure(media::kCodecVP8)); |
| 95 } | 94 } |
| 96 | 95 |
| 97 } // namespace content | 96 } // namespace content |
| 98 | 97 |
| 99 int main(int argc, char **argv) { | 98 int main(int argc, char **argv) { |
| 100 testing::InitGoogleTest(&argc, argv); | 99 testing::InitGoogleTest(&argc, argv); |
| 101 return RUN_ALL_TESTS(); | 100 return RUN_ALL_TESTS(); |
| 102 } | 101 } |
| OLD | NEW |