| 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 |
| 63 #else | 66 #else |
| 64 #error The VideoAccelerator tests are not supported on this platform. | 67 #error The VideoAccelerator tests are not supported on this platform. |
| 65 #endif // OS_WIN | 68 #endif // OS_WIN |
| 66 | 69 |
| 67 using media::VideoDecodeAccelerator; | 70 using media::VideoDecodeAccelerator; |
| 68 | 71 |
| 69 namespace content { | 72 namespace content { |
| 70 namespace { | 73 namespace { |
| 71 | 74 |
| 72 // Values optionally filled in from flags; see main() below. | 75 // Values optionally filled in from flags; see main() below. |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); | 404 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); |
| 402 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 405 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 403 | 406 |
| 404 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 407 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
| 405 if (!device.get()) { | 408 if (!device.get()) { |
| 406 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 409 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 407 return; | 410 return; |
| 408 } | 411 } |
| 409 decoder_.reset(new V4L2VideoDecodeAccelerator( | 412 decoder_.reset(new V4L2VideoDecodeAccelerator( |
| 410 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 413 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
| 411 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | 414 static_cast<EGLContext>(rendering_helper_->GetGLContext()), |
| 412 weak_client, base::Bind(&DoNothingReturnTrue), device.Pass(), | 415 weak_client, |
| 416 base::Bind(&DoNothingReturnTrue), |
| 417 device.Pass(), |
| 413 base::MessageLoopProxy::current())); | 418 base::MessageLoopProxy::current())); |
| 414 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 419 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 415 decoder_.reset( | 420 CHECK_EQ(gfx::kGLImplementationDesktopGL, gfx::GetGLImplementation()) |
| 416 new VaapiVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); | 421 << "Hardware video decode does not work with OSMesa"; |
| 422 decoder_.reset(new VaapiVideoDecodeAccelerator( |
| 423 static_cast<Display*>(rendering_helper_->GetGLDisplay()), |
| 424 base::Bind(&DoNothingReturnTrue))); |
| 417 #endif // OS_WIN | 425 #endif // OS_WIN |
| 418 CHECK(decoder_.get()); | 426 CHECK(decoder_.get()); |
| 419 weak_decoder_factory_.reset( | 427 weak_decoder_factory_.reset( |
| 420 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); | 428 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); |
| 421 SetState(CS_DECODER_SET); | 429 SetState(CS_DECODER_SET); |
| 422 if (decoder_deleted()) | 430 if (decoder_deleted()) |
| 423 return; | 431 return; |
| 424 | 432 |
| 425 CHECK(decoder_->Initialize(profile_, client)); | 433 CHECK(decoder_->Initialize(profile_, client)); |
| 426 FinishInitialization(); | 434 FinishInitialization(); |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 if (it->first == "v" || it->first == "vmodule") | 1459 if (it->first == "v" || it->first == "vmodule") |
| 1452 continue; | 1460 continue; |
| 1453 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1461 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1454 } | 1462 } |
| 1455 | 1463 |
| 1456 base::ShadowingAtExitManager at_exit_manager; | 1464 base::ShadowingAtExitManager at_exit_manager; |
| 1457 content::RenderingHelper::InitializeOneOff(); | 1465 content::RenderingHelper::InitializeOneOff(); |
| 1458 | 1466 |
| 1459 return RUN_ALL_TESTS(); | 1467 return RUN_ALL_TESTS(); |
| 1460 } | 1468 } |
| OLD | NEW |