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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "base/strings/utf_string_conversions.h" | 45 #include "base/strings/utf_string_conversions.h" |
46 #include "base/synchronization/condition_variable.h" | 46 #include "base/synchronization/condition_variable.h" |
47 #include "base/synchronization/lock.h" | 47 #include "base/synchronization/lock.h" |
48 #include "base/synchronization/waitable_event.h" | 48 #include "base/synchronization/waitable_event.h" |
49 #include "base/threading/thread.h" | 49 #include "base/threading/thread.h" |
50 #include "content/common/gpu/media/rendering_helper.h" | 50 #include "content/common/gpu/media/rendering_helper.h" |
51 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" | 51 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" |
52 #include "content/public/common/content_switches.h" | 52 #include "content/public/common/content_switches.h" |
53 #include "media/filters/h264_parser.h" | 53 #include "media/filters/h264_parser.h" |
54 #include "ui/gfx/codec/png_codec.h" | 54 #include "ui/gfx/codec/png_codec.h" |
| 55 #include "ui/gl/gl_image.h" |
55 | 56 |
56 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
57 #include "base/win/windows_version.h" | 58 #include "base/win/windows_version.h" |
58 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 59 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
59 #elif defined(OS_CHROMEOS) | 60 #elif defined(OS_CHROMEOS) |
60 #if defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2) | 61 #if defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2) |
61 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" | 62 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" |
62 #endif // defined(ARCH_CPU_ARMEL) | 63 #endif // defined(ARCH_CPU_ARMEL) |
63 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) | 64 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) |
64 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 65 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 bool decoder_deleted() { return !decoder_.get(); } | 328 bool decoder_deleted() { return !decoder_.get(); } |
328 | 329 |
329 private: | 330 private: |
330 typedef std::map<int32, scoped_refptr<TextureRef>> TextureRefMap; | 331 typedef std::map<int32, scoped_refptr<TextureRef>> TextureRefMap; |
331 | 332 |
332 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); | 333 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); |
333 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); | 334 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); |
334 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA(); | 335 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA(); |
335 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); | 336 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); |
336 | 337 |
| 338 void BindImage(uint32 client_texture_id, |
| 339 uint32 texture_target, |
| 340 scoped_refptr<gfx::GLImage> image); |
| 341 |
337 void SetState(ClientState new_state); | 342 void SetState(ClientState new_state); |
338 void FinishInitialization(); | 343 void FinishInitialization(); |
339 void ReturnPicture(int32 picture_buffer_id); | 344 void ReturnPicture(int32 picture_buffer_id); |
340 | 345 |
341 // Delete the associated decoder helper. | 346 // Delete the associated decoder helper. |
342 void DeleteDecoder(); | 347 void DeleteDecoder(); |
343 | 348 |
344 // Compute & return the first encoded bytes (including a start frame) to send | 349 // Compute & return the first encoded bytes (including a start frame) to send |
345 // to the decoder, starting at |start_pos| and returning one fragment. Skips | 350 // to the decoder, starting at |start_pos| and returning one fragment. Skips |
346 // to the first decodable position. | 351 // to the first decodable position. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 device, | 513 device, |
509 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 514 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
510 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | 515 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), |
511 weak_client, | 516 weak_client, |
512 base::Bind(&DoNothingReturnTrue), | 517 base::Bind(&DoNothingReturnTrue), |
513 base::MessageLoopProxy::current())); | 518 base::MessageLoopProxy::current())); |
514 } | 519 } |
515 #endif | 520 #endif |
516 return decoder.Pass(); | 521 return decoder.Pass(); |
517 } | 522 } |
| 523 |
518 scoped_ptr<media::VideoDecodeAccelerator> | 524 scoped_ptr<media::VideoDecodeAccelerator> |
519 GLRenderingVDAClient::CreateVaapiVDA() { | 525 GLRenderingVDAClient::CreateVaapiVDA() { |
520 scoped_ptr<media::VideoDecodeAccelerator> decoder; | 526 scoped_ptr<media::VideoDecodeAccelerator> decoder; |
521 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 527 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
522 decoder.reset( | 528 decoder.reset(new VaapiVideoDecodeAccelerator( |
523 new VaapiVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); | 529 base::Bind(&DoNothingReturnTrue), |
| 530 base::Bind(&GLRenderingVDAClient::BindImage, base::Unretained(this)))); |
524 #endif | 531 #endif |
525 return decoder.Pass(); | 532 return decoder.Pass(); |
526 } | 533 } |
527 | 534 |
| 535 void GLRenderingVDAClient::BindImage(uint32 client_texture_id, |
| 536 uint32 texture_target, |
| 537 scoped_refptr<gfx::GLImage> image) { |
| 538 } |
| 539 |
528 void GLRenderingVDAClient::CreateAndStartDecoder() { | 540 void GLRenderingVDAClient::CreateAndStartDecoder() { |
529 CHECK(decoder_deleted()); | 541 CHECK(decoder_deleted()); |
530 CHECK(!decoder_.get()); | 542 CHECK(!decoder_.get()); |
531 | 543 |
532 VideoDecodeAccelerator::Client* client = this; | 544 VideoDecodeAccelerator::Client* client = this; |
533 | 545 |
534 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { | 546 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { |
535 CreateDXVAVDA(), | 547 CreateDXVAVDA(), |
536 CreateV4L2VDA(), | 548 CreateV4L2VDA(), |
537 CreateV4L2SliceVDA(), | 549 CreateV4L2SliceVDA(), |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 ui::OzonePlatform::InitializeForUI(); | 1589 ui::OzonePlatform::InitializeForUI(); |
1578 #endif | 1590 #endif |
1579 | 1591 |
1580 content::g_env = | 1592 content::g_env = |
1581 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( | 1593 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( |
1582 testing::AddGlobalTestEnvironment( | 1594 testing::AddGlobalTestEnvironment( |
1583 new content::VideoDecodeAcceleratorTestEnvironment())); | 1595 new content::VideoDecodeAcceleratorTestEnvironment())); |
1584 | 1596 |
1585 return RUN_ALL_TESTS(); | 1597 return RUN_ALL_TESTS(); |
1586 } | 1598 } |
OLD | NEW |