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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
415 bool suppress_rendering, | 415 bool suppress_rendering, |
416 int delay_reuse_after_frame_num, | 416 int delay_reuse_after_frame_num, |
417 int decode_calls_per_second, | 417 int decode_calls_per_second, |
418 bool render_as_thumbnails); | 418 bool render_as_thumbnails); |
419 ~GLRenderingVDAClient() override; | 419 ~GLRenderingVDAClient() override; |
420 void CreateAndStartDecoder(); | 420 void CreateAndStartDecoder(); |
421 | 421 |
422 // VideoDecodeAccelerator::Client implementation. | 422 // VideoDecodeAccelerator::Client implementation. |
423 // The heart of the Client. | 423 // The heart of the Client. |
424 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, | 424 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, |
425 VideoPixelFormat format, | |
425 uint32_t textures_per_buffer, | 426 uint32_t textures_per_buffer, |
426 const gfx::Size& dimensions, | 427 const gfx::Size& dimensions, |
427 uint32_t texture_target) override; | 428 uint32_t texture_target) override; |
428 void DismissPictureBuffer(int32_t picture_buffer_id) override; | 429 void DismissPictureBuffer(int32_t picture_buffer_id) override; |
429 void PictureReady(const media::Picture& picture) override; | 430 void PictureReady(const media::Picture& picture) override; |
430 // Simple state changes. | 431 // Simple state changes. |
431 void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) override; | 432 void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) override; |
432 void NotifyFlushDone() override; | 433 void NotifyFlushDone() override; |
433 void NotifyResetDone() override; | 434 void NotifyResetDone() override; |
434 void NotifyError(VideoDecodeAccelerator::Error error) override; | 435 void NotifyError(VideoDecodeAccelerator::Error error) override; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
634 weak_vda_ptr_factory_.reset( | 635 weak_vda_ptr_factory_.reset( |
635 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); | 636 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); |
636 weak_vda_ = weak_vda_ptr_factory_->GetWeakPtr(); | 637 weak_vda_ = weak_vda_ptr_factory_->GetWeakPtr(); |
637 | 638 |
638 SetState(CS_DECODER_SET); | 639 SetState(CS_DECODER_SET); |
639 FinishInitialization(); | 640 FinishInitialization(); |
640 } | 641 } |
641 | 642 |
642 void GLRenderingVDAClient::ProvidePictureBuffers( | 643 void GLRenderingVDAClient::ProvidePictureBuffers( |
643 uint32_t requested_num_of_buffers, | 644 uint32_t requested_num_of_buffers, |
645 VideoPixelFormat pixel_format, | |
644 uint32_t textures_per_buffer, | 646 uint32_t textures_per_buffer, |
645 const gfx::Size& dimensions, | 647 const gfx::Size& dimensions, |
646 uint32_t texture_target) { | 648 uint32_t texture_target) { |
647 if (decoder_deleted()) | 649 if (decoder_deleted()) |
648 return; | 650 return; |
649 LOG_ASSERT(textures_per_buffer == 1u); | 651 LOG_ASSERT(textures_per_buffer == 1u); |
650 std::vector<media::PictureBuffer> buffers; | 652 std::vector<media::PictureBuffer> buffers; |
651 | 653 |
652 requested_num_of_buffers += kExtraPictureBuffers; | 654 requested_num_of_buffers += kExtraPictureBuffers; |
Pawel Osciak
2016/05/26 08:54:07
We should refuse format change here as well.
| |
653 | 655 |
654 texture_target_ = texture_target; | 656 texture_target_ = texture_target; |
655 for (uint32_t i = 0; i < requested_num_of_buffers; ++i) { | 657 for (uint32_t i = 0; i < requested_num_of_buffers; ++i) { |
656 uint32_t texture_id; | 658 uint32_t texture_id; |
657 base::WaitableEvent done(false, false); | 659 base::WaitableEvent done(false, false); |
658 rendering_helper_->CreateTexture(texture_target_, &texture_id, dimensions, | 660 rendering_helper_->CreateTexture(texture_target_, &texture_id, dimensions, |
659 &done); | 661 &done); |
660 done.Wait(); | 662 done.Wait(); |
661 | 663 |
662 scoped_refptr<TextureRef> texture_ref; | 664 scoped_refptr<TextureRef> texture_ref; |
663 base::Closure delete_texture_cb = | 665 base::Closure delete_texture_cb = |
664 base::Bind(&RenderingHelper::DeleteTexture, | 666 base::Bind(&RenderingHelper::DeleteTexture, |
665 base::Unretained(rendering_helper_), texture_id); | 667 base::Unretained(rendering_helper_), texture_id); |
666 | 668 |
667 if (g_test_import) { | 669 if (g_test_import) { |
668 media::VideoPixelFormat pixel_format = decoder_->GetOutputFormat(); | |
669 if (pixel_format == media::PIXEL_FORMAT_UNKNOWN) | 670 if (pixel_format == media::PIXEL_FORMAT_UNKNOWN) |
670 pixel_format = media::PIXEL_FORMAT_ARGB; | 671 pixel_format = media::PIXEL_FORMAT_ARGB; |
671 texture_ref = TextureRef::CreatePreallocated( | 672 texture_ref = TextureRef::CreatePreallocated( |
672 texture_id, delete_texture_cb, pixel_format, dimensions); | 673 texture_id, delete_texture_cb, pixel_format, dimensions); |
673 } else { | 674 } else { |
674 texture_ref = TextureRef::Create(texture_id, delete_texture_cb); | 675 texture_ref = TextureRef::Create(texture_id, delete_texture_cb); |
675 } | 676 } |
676 | 677 |
677 LOG_ASSERT(texture_ref); | 678 LOG_ASSERT(texture_ref); |
678 | 679 |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1736 media::VaapiWrapper::PreSandboxInitialization(); | 1737 media::VaapiWrapper::PreSandboxInitialization(); |
1737 #endif | 1738 #endif |
1738 | 1739 |
1739 media::g_env = | 1740 media::g_env = |
1740 reinterpret_cast<media::VideoDecodeAcceleratorTestEnvironment*>( | 1741 reinterpret_cast<media::VideoDecodeAcceleratorTestEnvironment*>( |
1741 testing::AddGlobalTestEnvironment( | 1742 testing::AddGlobalTestEnvironment( |
1742 new media::VideoDecodeAcceleratorTestEnvironment())); | 1743 new media::VideoDecodeAcceleratorTestEnvironment())); |
1743 | 1744 |
1744 return RUN_ALL_TESTS(); | 1745 return RUN_ALL_TESTS(); |
1745 } | 1746 } |
OLD | NEW |