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