| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 bool suppress_rendering, | 327 bool suppress_rendering, |
| 328 int delay_reuse_after_frame_num, | 328 int delay_reuse_after_frame_num, |
| 329 int decode_calls_per_second, | 329 int decode_calls_per_second, |
| 330 bool render_as_thumbnails); | 330 bool render_as_thumbnails); |
| 331 ~GLRenderingVDAClient() override; | 331 ~GLRenderingVDAClient() override; |
| 332 void CreateAndStartDecoder(); | 332 void CreateAndStartDecoder(); |
| 333 | 333 |
| 334 // VideoDecodeAccelerator::Client implementation. | 334 // VideoDecodeAccelerator::Client implementation. |
| 335 // The heart of the Client. | 335 // The heart of the Client. |
| 336 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, | 336 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, |
| 337 uint32_t textures_per_buffer, |
| 337 const gfx::Size& dimensions, | 338 const gfx::Size& dimensions, |
| 338 uint32_t texture_target) override; | 339 uint32_t texture_target) override; |
| 339 void DismissPictureBuffer(int32_t picture_buffer_id) override; | 340 void DismissPictureBuffer(int32_t picture_buffer_id) override; |
| 340 void PictureReady(const media::Picture& picture) override; | 341 void PictureReady(const media::Picture& picture) override; |
| 341 // Simple state changes. | 342 // Simple state changes. |
| 342 void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) override; | 343 void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) override; |
| 343 void NotifyFlushDone() override; | 344 void NotifyFlushDone() override; |
| 344 void NotifyResetDone() override; | 345 void NotifyResetDone() override; |
| 345 void NotifyError(VideoDecodeAccelerator::Error error) override; | 346 void NotifyError(VideoDecodeAccelerator::Error error) override; |
| 346 | 347 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 return; | 609 return; |
| 609 } | 610 } |
| 610 } | 611 } |
| 611 // Decoders are all initialize failed. | 612 // Decoders are all initialize failed. |
| 612 LOG(ERROR) << "VideoDecodeAccelerator::Initialize() failed"; | 613 LOG(ERROR) << "VideoDecodeAccelerator::Initialize() failed"; |
| 613 LOG_ASSERT(false); | 614 LOG_ASSERT(false); |
| 614 } | 615 } |
| 615 | 616 |
| 616 void GLRenderingVDAClient::ProvidePictureBuffers( | 617 void GLRenderingVDAClient::ProvidePictureBuffers( |
| 617 uint32_t requested_num_of_buffers, | 618 uint32_t requested_num_of_buffers, |
| 619 uint32_t textures_per_buffer, |
| 618 const gfx::Size& dimensions, | 620 const gfx::Size& dimensions, |
| 619 uint32_t texture_target) { | 621 uint32_t texture_target) { |
| 620 if (decoder_deleted()) | 622 if (decoder_deleted()) |
| 621 return; | 623 return; |
| 624 LOG_ASSERT(textures_per_buffer == 1u); |
| 622 std::vector<media::PictureBuffer> buffers; | 625 std::vector<media::PictureBuffer> buffers; |
| 623 | 626 |
| 624 requested_num_of_buffers += kExtraPictureBuffers; | 627 requested_num_of_buffers += kExtraPictureBuffers; |
| 625 | 628 |
| 626 texture_target_ = texture_target; | 629 texture_target_ = texture_target; |
| 627 for (uint32_t i = 0; i < requested_num_of_buffers; ++i) { | 630 for (uint32_t i = 0; i < requested_num_of_buffers; ++i) { |
| 628 uint32_t texture_id; | 631 uint32_t texture_id; |
| 629 base::WaitableEvent done(false, false); | 632 base::WaitableEvent done(false, false); |
| 630 rendering_helper_->CreateTexture( | 633 rendering_helper_->CreateTexture( |
| 631 texture_target_, &texture_id, dimensions, &done); | 634 texture_target_, &texture_id, dimensions, &done); |
| 632 done.Wait(); | 635 done.Wait(); |
| 633 | 636 |
| 634 int32_t picture_buffer_id = next_picture_buffer_id_++; | 637 int32_t picture_buffer_id = next_picture_buffer_id_++; |
| 635 LOG_ASSERT(active_textures_ | 638 LOG_ASSERT(active_textures_ |
| 636 .insert(std::make_pair( | 639 .insert(std::make_pair( |
| 637 picture_buffer_id, | 640 picture_buffer_id, |
| 638 new TextureRef(texture_id, | 641 new TextureRef(texture_id, |
| 639 base::Bind(&RenderingHelper::DeleteTexture, | 642 base::Bind(&RenderingHelper::DeleteTexture, |
| 640 base::Unretained(rendering_helper_), | 643 base::Unretained(rendering_helper_), |
| 641 texture_id)))) | 644 texture_id)))) |
| 642 .second); | 645 .second); |
| 643 | 646 |
| 644 buffers.push_back( | 647 media::PictureBuffer::TextureIds ids; |
| 645 media::PictureBuffer(picture_buffer_id, dimensions, texture_id)); | 648 ids.ids[0] = texture_id; |
| 649 buffers.push_back(media::PictureBuffer(picture_buffer_id, dimensions, ids)); |
| 646 } | 650 } |
| 647 decoder_->AssignPictureBuffers(buffers); | 651 decoder_->AssignPictureBuffers(buffers); |
| 648 } | 652 } |
| 649 | 653 |
| 650 void GLRenderingVDAClient::DismissPictureBuffer(int32_t picture_buffer_id) { | 654 void GLRenderingVDAClient::DismissPictureBuffer(int32_t picture_buffer_id) { |
| 651 LOG_ASSERT(1U == active_textures_.erase(picture_buffer_id)); | 655 LOG_ASSERT(1U == active_textures_.erase(picture_buffer_id)); |
| 652 } | 656 } |
| 653 | 657 |
| 654 void GLRenderingVDAClient::PictureReady(const media::Picture& picture) { | 658 void GLRenderingVDAClient::PictureReady(const media::Picture& picture) { |
| 655 // We shouldn't be getting pictures delivered after Reset has completed. | 659 // We shouldn't be getting pictures delivered after Reset has completed. |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 content::VaapiWrapper::PreSandboxInitialization(); | 1651 content::VaapiWrapper::PreSandboxInitialization(); |
| 1648 #endif | 1652 #endif |
| 1649 | 1653 |
| 1650 content::g_env = | 1654 content::g_env = |
| 1651 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( | 1655 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( |
| 1652 testing::AddGlobalTestEnvironment( | 1656 testing::AddGlobalTestEnvironment( |
| 1653 new content::VideoDecodeAcceleratorTestEnvironment())); | 1657 new content::VideoDecodeAcceleratorTestEnvironment())); |
| 1654 | 1658 |
| 1655 return RUN_ALL_TESTS(); | 1659 return RUN_ALL_TESTS(); |
| 1656 } | 1660 } |
| OLD | NEW |