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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); | 392 new DXVAVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); |
396 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 393 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
397 | 394 |
398 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 395 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
399 if (!device.get()) { | 396 if (!device.get()) { |
400 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 397 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
401 return; | 398 return; |
402 } | 399 } |
403 decoder_.reset(new V4L2VideoDecodeAccelerator( | 400 decoder_.reset(new V4L2VideoDecodeAccelerator( |
404 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 401 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
405 static_cast<EGLContext>(rendering_helper_->GetGLContext()), | 402 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), |
406 weak_client, | 403 weak_client, |
407 base::Bind(&DoNothingReturnTrue), | 404 base::Bind(&DoNothingReturnTrue), |
408 device.Pass(), | 405 device.Pass(), |
409 base::MessageLoopProxy::current())); | 406 base::MessageLoopProxy::current())); |
410 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 407 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
411 CHECK_EQ(gfx::kGLImplementationDesktopGL, gfx::GetGLImplementation()) | 408 CHECK_EQ(gfx::kGLImplementationDesktopGL, gfx::GetGLImplementation()) |
412 << "Hardware video decode does not work with OSMesa"; | 409 << "Hardware video decode does not work with OSMesa"; |
413 decoder_.reset(new VaapiVideoDecodeAccelerator( | 410 decoder_.reset(new VaapiVideoDecodeAccelerator( |
414 static_cast<Display*>(rendering_helper_->GetGLDisplay()), | 411 rendering_helper_->GetGLContext(), |
415 base::Bind(&DoNothingReturnTrue))); | 412 base::Bind(&DoNothingReturnTrue))); |
416 #endif // OS_WIN | 413 #endif // OS_WIN |
417 CHECK(decoder_.get()); | 414 CHECK(decoder_.get()); |
418 weak_decoder_factory_.reset( | 415 weak_decoder_factory_.reset( |
419 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); | 416 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); |
420 SetState(CS_DECODER_SET); | 417 SetState(CS_DECODER_SET); |
421 if (decoder_deleted()) | 418 if (decoder_deleted()) |
422 return; | 419 return; |
423 | 420 |
424 CHECK(decoder_->Initialize(profile_, client)); | 421 CHECK(decoder_->Initialize(profile_, client)); |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 if (it->first == "v" || it->first == "vmodule") | 1426 if (it->first == "v" || it->first == "vmodule") |
1430 continue; | 1427 continue; |
1431 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1428 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
1432 } | 1429 } |
1433 | 1430 |
1434 base::ShadowingAtExitManager at_exit_manager; | 1431 base::ShadowingAtExitManager at_exit_manager; |
1435 content::RenderingHelper::InitializeOneOff(); | 1432 content::RenderingHelper::InitializeOneOff(); |
1436 | 1433 |
1437 return RUN_ALL_TESTS(); | 1434 return RUN_ALL_TESTS(); |
1438 } | 1435 } |
OLD | NEW |