Chromium Code Reviews| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 bool suppress_rendering, | 414 bool suppress_rendering, |
| 415 int delay_reuse_after_frame_num, | 415 int delay_reuse_after_frame_num, |
| 416 int decode_calls_per_second, | 416 int decode_calls_per_second, |
| 417 bool render_as_thumbnails); | 417 bool render_as_thumbnails); |
| 418 ~GLRenderingVDAClient() override; | 418 ~GLRenderingVDAClient() override; |
| 419 void CreateAndStartDecoder(); | 419 void CreateAndStartDecoder(); |
| 420 | 420 |
| 421 // VideoDecodeAccelerator::Client implementation. | 421 // VideoDecodeAccelerator::Client implementation. |
| 422 // The heart of the Client. | 422 // The heart of the Client. |
| 423 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, | 423 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, |
| 424 VideoPixelFormat format, | |
| 424 uint32_t textures_per_buffer, | 425 uint32_t textures_per_buffer, |
| 425 const gfx::Size& dimensions, | 426 const gfx::Size& dimensions, |
| 426 uint32_t texture_target) override; | 427 uint32_t texture_target) override; |
| 427 void DismissPictureBuffer(int32_t picture_buffer_id) override; | 428 void DismissPictureBuffer(int32_t picture_buffer_id) override; |
| 428 void PictureReady(const media::Picture& picture) override; | 429 void PictureReady(const media::Picture& picture) override; |
| 429 // Simple state changes. | 430 // Simple state changes. |
| 430 void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) override; | 431 void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) override; |
| 431 void NotifyFlushDone() override; | 432 void NotifyFlushDone() override; |
| 432 void NotifyResetDone() override; | 433 void NotifyResetDone() override; |
| 433 void NotifyError(VideoDecodeAccelerator::Error error) override; | 434 void NotifyError(VideoDecodeAccelerator::Error error) override; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 633 weak_vda_ptr_factory_.reset( | 634 weak_vda_ptr_factory_.reset( |
| 634 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); | 635 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); |
| 635 weak_vda_ = weak_vda_ptr_factory_->GetWeakPtr(); | 636 weak_vda_ = weak_vda_ptr_factory_->GetWeakPtr(); |
| 636 | 637 |
| 637 SetState(CS_DECODER_SET); | 638 SetState(CS_DECODER_SET); |
| 638 FinishInitialization(); | 639 FinishInitialization(); |
| 639 } | 640 } |
| 640 | 641 |
| 641 void GLRenderingVDAClient::ProvidePictureBuffers( | 642 void GLRenderingVDAClient::ProvidePictureBuffers( |
| 642 uint32_t requested_num_of_buffers, | 643 uint32_t requested_num_of_buffers, |
| 644 VideoPixelFormat pixel_format, | |
| 643 uint32_t textures_per_buffer, | 645 uint32_t textures_per_buffer, |
| 644 const gfx::Size& dimensions, | 646 const gfx::Size& dimensions, |
| 645 uint32_t texture_target) { | 647 uint32_t texture_target) { |
| 646 if (decoder_deleted()) | 648 if (decoder_deleted()) |
| 647 return; | 649 return; |
| 648 LOG_ASSERT(textures_per_buffer == 1u); | 650 LOG_ASSERT(textures_per_buffer == 1u); |
| 649 std::vector<media::PictureBuffer> buffers; | 651 std::vector<media::PictureBuffer> buffers; |
| 650 | 652 |
| 651 requested_num_of_buffers += kExtraPictureBuffers; | 653 requested_num_of_buffers += kExtraPictureBuffers; |
| 652 | 654 |
| 653 texture_target_ = texture_target; | 655 texture_target_ = texture_target; |
| 656 if (pixel_format == media::PIXEL_FORMAT_UNKNOWN) | |
|
Pawel Osciak
2016/05/18 07:32:32
This is only needed inside the if() clause in l.67
| |
| 657 pixel_format = media::PIXEL_FORMAT_ARGB; | |
| 654 for (uint32_t i = 0; i < requested_num_of_buffers; ++i) { | 658 for (uint32_t i = 0; i < requested_num_of_buffers; ++i) { |
| 655 uint32_t texture_id; | 659 uint32_t texture_id; |
| 656 base::WaitableEvent done(false, false); | 660 base::WaitableEvent done(false, false); |
| 657 rendering_helper_->CreateTexture(texture_target_, &texture_id, dimensions, | 661 rendering_helper_->CreateTexture(texture_target_, &texture_id, dimensions, |
| 658 &done); | 662 &done); |
| 659 done.Wait(); | 663 done.Wait(); |
| 660 | 664 |
| 661 scoped_refptr<TextureRef> texture_ref; | 665 scoped_refptr<TextureRef> texture_ref; |
| 662 base::Closure delete_texture_cb = | 666 base::Closure delete_texture_cb = |
| 663 base::Bind(&RenderingHelper::DeleteTexture, | 667 base::Bind(&RenderingHelper::DeleteTexture, |
| 664 base::Unretained(rendering_helper_), texture_id); | 668 base::Unretained(rendering_helper_), texture_id); |
| 665 | 669 |
| 666 if (g_test_import) { | 670 if (g_test_import) { |
| 667 media::VideoPixelFormat pixel_format = decoder_->GetOutputFormat(); | |
| 668 if (pixel_format == media::PIXEL_FORMAT_UNKNOWN) | |
| 669 pixel_format = media::PIXEL_FORMAT_ARGB; | |
| 670 texture_ref = TextureRef::CreatePreallocated( | 671 texture_ref = TextureRef::CreatePreallocated( |
| 671 texture_id, delete_texture_cb, pixel_format, dimensions); | 672 texture_id, delete_texture_cb, pixel_format, dimensions); |
| 672 } else { | 673 } else { |
| 673 texture_ref = TextureRef::Create(texture_id, delete_texture_cb); | 674 texture_ref = TextureRef::Create(texture_id, delete_texture_cb); |
| 674 } | 675 } |
| 675 | 676 |
| 676 LOG_ASSERT(texture_ref); | 677 LOG_ASSERT(texture_ref); |
| 677 | 678 |
| 678 int32_t picture_buffer_id = next_picture_buffer_id_++; | 679 int32_t picture_buffer_id = next_picture_buffer_id_++; |
| 679 LOG_ASSERT( | 680 LOG_ASSERT( |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1712 media::VaapiWrapper::PreSandboxInitialization(); | 1713 media::VaapiWrapper::PreSandboxInitialization(); |
| 1713 #endif | 1714 #endif |
| 1714 | 1715 |
| 1715 media::g_env = | 1716 media::g_env = |
| 1716 reinterpret_cast<media::VideoDecodeAcceleratorTestEnvironment*>( | 1717 reinterpret_cast<media::VideoDecodeAcceleratorTestEnvironment*>( |
| 1717 testing::AddGlobalTestEnvironment( | 1718 testing::AddGlobalTestEnvironment( |
| 1718 new media::VideoDecodeAcceleratorTestEnvironment())); | 1719 new media::VideoDecodeAcceleratorTestEnvironment())); |
| 1719 | 1720 |
| 1720 return RUN_ALL_TESTS(); | 1721 return RUN_ALL_TESTS(); |
| 1721 } | 1722 } |
| OLD | NEW |