| 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" |
| 11 #include "content/common/gpu/media/android_copying_backing_strategy.h" |
| 11 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 12 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 12 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 13 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| 13 #include "media/base/android/media_codec_bridge.h" | 14 #include "media/base/android/media_codec_bridge.h" |
| 14 #include "media/base/android/media_jni_registrar.h" | 15 #include "media/base/android/media_jni_registrar.h" |
| 15 #include "media/video/picture.h" | 16 #include "media/video/picture.h" |
| 16 #include "media/video/video_decode_accelerator.h" | 17 #include "media/video/video_decode_accelerator.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "ui/gl/android/surface_texture.h" | 19 #include "ui/gl/android/surface_texture.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void SetUp() override { | 57 void SetUp() override { |
| 57 JNIEnv* env = base::android::AttachCurrentThread(); | 58 JNIEnv* env = base::android::AttachCurrentThread(); |
| 58 media::RegisterJni(env); | 59 media::RegisterJni(env); |
| 59 // TODO(felipeg): fix GL bindings, so that the decoder can perform GL | 60 // TODO(felipeg): fix GL bindings, so that the decoder can perform GL |
| 60 // calls. | 61 // calls. |
| 61 scoped_ptr<gpu::gles2::MockGLES2Decoder> decoder( | 62 scoped_ptr<gpu::gles2::MockGLES2Decoder> decoder( |
| 62 new gpu::gles2::MockGLES2Decoder()); | 63 new gpu::gles2::MockGLES2Decoder()); |
| 63 scoped_ptr<MockVideoDecodeAcceleratorClient> client( | 64 scoped_ptr<MockVideoDecodeAcceleratorClient> client( |
| 64 new MockVideoDecodeAcceleratorClient()); | 65 new MockVideoDecodeAcceleratorClient()); |
| 65 accelerator_.reset(new AndroidVideoDecodeAccelerator( | 66 accelerator_.reset(new AndroidVideoDecodeAccelerator( |
| 66 decoder->AsWeakPtr(), base::Bind(&MockMakeContextCurrent))); | 67 decoder->AsWeakPtr(), base::Bind(&MockMakeContextCurrent), |
| 68 make_scoped_ptr(new AndroidCopyingBackingStrategy()))); |
| 67 } | 69 } |
| 68 | 70 |
| 69 bool Configure(media::VideoCodec codec) { | 71 bool Configure(media::VideoCodec codec) { |
| 70 AndroidVideoDecodeAccelerator* accelerator = | 72 AndroidVideoDecodeAccelerator* accelerator = |
| 71 static_cast<AndroidVideoDecodeAccelerator*>(accelerator_.get()); | 73 static_cast<AndroidVideoDecodeAccelerator*>(accelerator_.get()); |
| 72 accelerator->surface_texture_ = gfx::SurfaceTexture::Create(0); | 74 accelerator->surface_texture_ = gfx::SurfaceTexture::Create(0); |
| 73 accelerator->codec_ = codec; | 75 accelerator->codec_ = codec; |
| 74 return accelerator->ConfigureMediaCodec(); | 76 return accelerator->ConfigureMediaCodec(); |
| 75 } | 77 } |
| 76 | 78 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 87 return; | 89 return; |
| 88 EXPECT_TRUE(Configure(media::kCodecVP8)); | 90 EXPECT_TRUE(Configure(media::kCodecVP8)); |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace content | 93 } // namespace content |
| 92 | 94 |
| 93 int main(int argc, char **argv) { | 95 int main(int argc, char **argv) { |
| 94 testing::InitGoogleTest(&argc, argv); | 96 testing::InitGoogleTest(&argc, argv); |
| 95 return RUN_ALL_TESTS(); | 97 return RUN_ALL_TESTS(); |
| 96 } | 98 } |
| OLD | NEW |