Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: content/common/gpu/media/video_decode_accelerator_unittest.cc

Issue 1751323002: Allow multiple texture ids per picture buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 return; 608 return;
608 } 609 }
609 } 610 }
610 // Decoders are all initialize failed. 611 // Decoders are all initialize failed.
611 LOG(ERROR) << "VideoDecodeAccelerator::Initialize() failed"; 612 LOG(ERROR) << "VideoDecodeAccelerator::Initialize() failed";
612 LOG_ASSERT(false); 613 LOG_ASSERT(false);
613 } 614 }
614 615
615 void GLRenderingVDAClient::ProvidePictureBuffers( 616 void GLRenderingVDAClient::ProvidePictureBuffers(
616 uint32_t requested_num_of_buffers, 617 uint32_t requested_num_of_buffers,
618 uint32_t textures_per_buffer,
617 const gfx::Size& dimensions, 619 const gfx::Size& dimensions,
618 uint32_t texture_target) { 620 uint32_t texture_target) {
619 if (decoder_deleted()) 621 if (decoder_deleted())
620 return; 622 return;
623 LOG_ASSERT(textures_per_buffer == 1u);
621 std::vector<media::PictureBuffer> buffers; 624 std::vector<media::PictureBuffer> buffers;
622 625
623 requested_num_of_buffers += kExtraPictureBuffers; 626 requested_num_of_buffers += kExtraPictureBuffers;
624 627
625 texture_target_ = texture_target; 628 texture_target_ = texture_target;
626 for (uint32_t i = 0; i < requested_num_of_buffers; ++i) { 629 for (uint32_t i = 0; i < requested_num_of_buffers; ++i) {
627 uint32_t texture_id; 630 uint32_t texture_id;
628 base::WaitableEvent done(false, false); 631 base::WaitableEvent done(false, false);
629 rendering_helper_->CreateTexture( 632 rendering_helper_->CreateTexture(
630 texture_target_, &texture_id, dimensions, &done); 633 texture_target_, &texture_id, dimensions, &done);
631 done.Wait(); 634 done.Wait();
632 635
633 int32_t picture_buffer_id = next_picture_buffer_id_++; 636 int32_t picture_buffer_id = next_picture_buffer_id_++;
634 LOG_ASSERT(active_textures_ 637 LOG_ASSERT(active_textures_
635 .insert(std::make_pair( 638 .insert(std::make_pair(
636 picture_buffer_id, 639 picture_buffer_id,
637 new TextureRef(texture_id, 640 new TextureRef(texture_id,
638 base::Bind(&RenderingHelper::DeleteTexture, 641 base::Bind(&RenderingHelper::DeleteTexture,
639 base::Unretained(rendering_helper_), 642 base::Unretained(rendering_helper_),
640 texture_id)))) 643 texture_id))))
641 .second); 644 .second);
642 645
643 buffers.push_back( 646 media::PictureBuffer::TextureIds ids;
644 media::PictureBuffer(picture_buffer_id, dimensions, texture_id)); 647 ids.push_back(texture_id);
648 buffers.push_back(media::PictureBuffer(picture_buffer_id, dimensions, ids));
645 } 649 }
646 decoder_->AssignPictureBuffers(buffers); 650 decoder_->AssignPictureBuffers(buffers);
647 } 651 }
648 652
649 void GLRenderingVDAClient::DismissPictureBuffer(int32_t picture_buffer_id) { 653 void GLRenderingVDAClient::DismissPictureBuffer(int32_t picture_buffer_id) {
650 LOG_ASSERT(1U == active_textures_.erase(picture_buffer_id)); 654 LOG_ASSERT(1U == active_textures_.erase(picture_buffer_id));
651 } 655 }
652 656
653 void GLRenderingVDAClient::PictureReady(const media::Picture& picture) { 657 void GLRenderingVDAClient::PictureReady(const media::Picture& picture) {
654 // We shouldn't be getting pictures delivered after Reset has completed. 658 // We shouldn't be getting pictures delivered after Reset has completed.
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 content::VaapiWrapper::PreSandboxInitialization(); 1650 content::VaapiWrapper::PreSandboxInitialization();
1647 #endif 1651 #endif
1648 1652
1649 content::g_env = 1653 content::g_env =
1650 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( 1654 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>(
1651 testing::AddGlobalTestEnvironment( 1655 testing::AddGlobalTestEnvironment(
1652 new content::VideoDecodeAcceleratorTestEnvironment())); 1656 new content::VideoDecodeAcceleratorTestEnvironment()));
1653 1657
1654 return RUN_ALL_TESTS(); 1658 return RUN_ALL_TESTS();
1655 } 1659 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698