| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 VideoDecodeAccelerator::Config config(profile_); | 533 VideoDecodeAccelerator::Config config(profile_); |
| 534 gpu::GpuPreferences gpu_preferences; | 534 gpu::GpuPreferences gpu_preferences; |
| 535 decoder_ = vda_factory_->CreateVDA(this, config, gpu_preferences); | 535 decoder_ = vda_factory_->CreateVDA(this, config, gpu_preferences); |
| 536 } | 536 } |
| 537 | 537 |
| 538 LOG_ASSERT(decoder_) << "Failed creating a VDA"; | 538 LOG_ASSERT(decoder_) << "Failed creating a VDA"; |
| 539 | 539 |
| 540 decoder_->TryToSetupDecodeOnSeparateThread( | 540 decoder_->TryToSetupDecodeOnSeparateThread( |
| 541 weak_this_, base::ThreadTaskRunnerHandle::Get()); | 541 weak_this_, base::ThreadTaskRunnerHandle::Get()); |
| 542 | 542 |
| 543 weak_vda_ptr_factory_.reset( |
| 544 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); |
| 545 weak_vda_ = weak_vda_ptr_factory_->GetWeakPtr(); |
| 546 |
| 543 SetState(CS_DECODER_SET); | 547 SetState(CS_DECODER_SET); |
| 544 FinishInitialization(); | 548 FinishInitialization(); |
| 545 } | 549 } |
| 546 | 550 |
| 547 void GLRenderingVDAClient::ProvidePictureBuffers( | 551 void GLRenderingVDAClient::ProvidePictureBuffers( |
| 548 uint32_t requested_num_of_buffers, | 552 uint32_t requested_num_of_buffers, |
| 549 uint32_t textures_per_buffer, | 553 uint32_t textures_per_buffer, |
| 550 const gfx::Size& dimensions, | 554 const gfx::Size& dimensions, |
| 551 uint32_t texture_target) { | 555 uint32_t texture_target) { |
| 552 if (decoder_deleted()) | 556 if (decoder_deleted()) |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 } | 768 } |
| 765 | 769 |
| 766 for (int i = 0; i < num_in_flight_decodes_; ++i) | 770 for (int i = 0; i < num_in_flight_decodes_; ++i) |
| 767 DecodeNextFragment(); | 771 DecodeNextFragment(); |
| 768 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); | 772 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); |
| 769 } | 773 } |
| 770 | 774 |
| 771 void GLRenderingVDAClient::DeleteDecoder() { | 775 void GLRenderingVDAClient::DeleteDecoder() { |
| 772 if (decoder_deleted()) | 776 if (decoder_deleted()) |
| 773 return; | 777 return; |
| 774 weak_vda_ptr_factory_.reset(); | 778 weak_vda_ptr_factory_->InvalidateWeakPtrs(); |
| 775 decoder_.reset(); | 779 decoder_.reset(); |
| 776 STLClearObject(&encoded_data_); | 780 STLClearObject(&encoded_data_); |
| 777 active_textures_.clear(); | 781 active_textures_.clear(); |
| 778 | 782 |
| 779 // Cascade through the rest of the states to simplify test code below. | 783 // Cascade through the rest of the states to simplify test code below. |
| 780 for (int i = state_ + 1; i < CS_MAX; ++i) | 784 for (int i = state_ + 1; i < CS_MAX; ++i) |
| 781 SetState(static_cast<ClientState>(i)); | 785 SetState(static_cast<ClientState>(i)); |
| 782 } | 786 } |
| 783 | 787 |
| 784 std::string GLRenderingVDAClient::GetBytesForFirstFragment( | 788 std::string GLRenderingVDAClient::GetBytesForFirstFragment( |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 content::VaapiWrapper::PreSandboxInitialization(); | 1583 content::VaapiWrapper::PreSandboxInitialization(); |
| 1580 #endif | 1584 #endif |
| 1581 | 1585 |
| 1582 content::g_env = | 1586 content::g_env = |
| 1583 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( | 1587 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( |
| 1584 testing::AddGlobalTestEnvironment( | 1588 testing::AddGlobalTestEnvironment( |
| 1585 new content::VideoDecodeAcceleratorTestEnvironment())); | 1589 new content::VideoDecodeAcceleratorTestEnvironment())); |
| 1586 | 1590 |
| 1587 return RUN_ALL_TESTS(); | 1591 return RUN_ALL_TESTS(); |
| 1588 } | 1592 } |
| OLD | NEW |