| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
| 6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
| 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or | 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or |
| 8 // Win/EGL. | 8 // Win/EGL. |
| 9 // - ClientState is an enum for the state of the decode client used by the test. | 9 // - ClientState is an enum for the state of the decode client used by the test. |
| 10 // - ClientStateNotification is a barrier abstraction that allows the test code | 10 // - ClientStateNotification is a barrier abstraction that allows the test code |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "ui/gfx/codec/png_codec.h" | 53 #include "ui/gfx/codec/png_codec.h" |
| 54 | 54 |
| 55 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
| 56 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 56 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 57 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 57 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 58 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 58 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" |
| 59 #include "content/common/gpu/media/v4l2_video_device.h" | 59 #include "content/common/gpu/media/v4l2_video_device.h" |
| 60 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 60 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 61 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 61 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
| 62 #include "content/common/gpu/media/vaapi_wrapper.h" | 62 #include "content/common/gpu/media/vaapi_wrapper.h" |
| 63 #if defined(USE_X11) | |
| 64 #include "ui/gl/gl_implementation.h" | |
| 65 #endif // USE_X11 | |
| 66 #else | 63 #else |
| 67 #error The VideoAccelerator tests are not supported on this platform. | 64 #error The VideoAccelerator tests are not supported on this platform. |
| 68 #endif // OS_WIN | 65 #endif // OS_WIN |
| 69 | 66 |
| 70 using media::VideoDecodeAccelerator; | 67 using media::VideoDecodeAccelerator; |
| 71 | 68 |
| 72 namespace content { | 69 namespace content { |
| 73 namespace { | 70 namespace { |
| 74 | 71 |
| 75 // Values optionally filled in from flags; see main() below. | 72 // Values optionally filled in from flags; see main() below. |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); | 401 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); |
| 405 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 402 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 406 | 403 |
| 407 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 404 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
| 408 if (!device.get()) { | 405 if (!device.get()) { |
| 409 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 406 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 410 return; | 407 return; |
| 411 } | 408 } |
| 412 decoder_.reset(new V4L2VideoDecodeAccelerator( | 409 decoder_.reset(new V4L2VideoDecodeAccelerator( |
| 413 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 410 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
| 414 static_cast<EGLContext>(rendering_helper_->GetGLContext()), | 411 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), |
| 415 weak_client, | 412 weak_client, base::Bind(&DoNothingReturnTrue), device.Pass(), |
| 416 base::Bind(&DoNothingReturnTrue), | |
| 417 device.Pass(), | |
| 418 base::MessageLoopProxy::current())); | 413 base::MessageLoopProxy::current())); |
| 419 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 414 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 420 CHECK_EQ(gfx::kGLImplementationDesktopGL, gfx::GetGLImplementation()) | 415 decoder_.reset( |
| 421 << "Hardware video decode does not work with OSMesa"; | 416 new VaapiVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); |
| 422 decoder_.reset(new VaapiVideoDecodeAccelerator( | |
| 423 static_cast<Display*>(rendering_helper_->GetGLDisplay()), | |
| 424 base::Bind(&DoNothingReturnTrue))); | |
| 425 #endif // OS_WIN | 417 #endif // OS_WIN |
| 426 CHECK(decoder_.get()); | 418 CHECK(decoder_.get()); |
| 427 weak_decoder_factory_.reset( | 419 weak_decoder_factory_.reset( |
| 428 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); | 420 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); |
| 429 SetState(CS_DECODER_SET); | 421 SetState(CS_DECODER_SET); |
| 430 if (decoder_deleted()) | 422 if (decoder_deleted()) |
| 431 return; | 423 return; |
| 432 | 424 |
| 433 CHECK(decoder_->Initialize(profile_, client)); | 425 CHECK(decoder_->Initialize(profile_, client)); |
| 434 FinishInitialization(); | 426 FinishInitialization(); |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 if (it->first == "v" || it->first == "vmodule") | 1451 if (it->first == "v" || it->first == "vmodule") |
| 1460 continue; | 1452 continue; |
| 1461 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1453 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1462 } | 1454 } |
| 1463 | 1455 |
| 1464 base::ShadowingAtExitManager at_exit_manager; | 1456 base::ShadowingAtExitManager at_exit_manager; |
| 1465 content::RenderingHelper::InitializeOneOff(); | 1457 content::RenderingHelper::InitializeOneOff(); |
| 1466 | 1458 |
| 1467 return RUN_ALL_TESTS(); | 1459 return RUN_ALL_TESTS(); |
| 1468 } | 1460 } |
| OLD | NEW |