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

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

Issue 1207043002: Introduce a client minimum picture pool size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Documented actual may be larger than requested count. Created 5 years, 5 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 START_OF_STREAM_RESET = -3, 136 START_OF_STREAM_RESET = -3,
137 MID_STREAM_RESET = -2, 137 MID_STREAM_RESET = -2,
138 END_OF_STREAM_RESET = -1 138 END_OF_STREAM_RESET = -1
139 }; 139 };
140 140
141 const int kMaxResetAfterFrameNum = 100; 141 const int kMaxResetAfterFrameNum = 100;
142 const int kMaxFramesToDelayReuse = 64; 142 const int kMaxFramesToDelayReuse = 64;
143 const base::TimeDelta kReuseDelay = base::TimeDelta::FromSeconds(1); 143 const base::TimeDelta kReuseDelay = base::TimeDelta::FromSeconds(1);
144 // Simulate WebRTC and call VDA::Decode 30 times per second. 144 // Simulate WebRTC and call VDA::Decode 30 times per second.
145 const int kWebRtcDecodeCallsPerSecond = 30; 145 const int kWebRtcDecodeCallsPerSecond = 30;
146 // Simulate an adjustment to a larger number of pictures to make sure the
147 // decoder supports an upwards adjustment.
148 const int kExtraPictureBuffers = 2;
146 149
147 struct TestVideoFile { 150 struct TestVideoFile {
148 explicit TestVideoFile(base::FilePath::StringType file_name) 151 explicit TestVideoFile(base::FilePath::StringType file_name)
149 : file_name(file_name), 152 : file_name(file_name),
150 width(-1), 153 width(-1),
151 height(-1), 154 height(-1),
152 num_frames(-1), 155 num_frames(-1),
153 num_fragments(-1), 156 num_fragments(-1),
154 min_fps_render(-1), 157 min_fps_render(-1),
155 min_fps_no_render(-1), 158 min_fps_no_render(-1),
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 CreateV4L2SliceVDA(), 592 CreateV4L2SliceVDA(),
590 CreateVaapiVDA(), 593 CreateVaapiVDA(),
591 }; 594 };
592 595
593 for (size_t i = 0; i < arraysize(decoders); ++i) { 596 for (size_t i = 0; i < arraysize(decoders); ++i) {
594 if (!decoders[i]) 597 if (!decoders[i])
595 continue; 598 continue;
596 decoder_ = decoders[i].Pass(); 599 decoder_ = decoders[i].Pass();
597 weak_decoder_factory_.reset( 600 weak_decoder_factory_.reset(
598 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); 601 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get()));
599 if (decoder_->Initialize(profile_, client)) { 602 if (decoder_->Initialize(profile_, 0, client)) {
600 SetState(CS_DECODER_SET); 603 SetState(CS_DECODER_SET);
601 FinishInitialization(); 604 FinishInitialization();
602 return; 605 return;
603 } 606 }
604 } 607 }
605 // Decoders are all initialize failed. 608 // Decoders are all initialize failed.
606 LOG(ERROR) << "VideoDecodeAccelerator::Initialize() failed"; 609 LOG(ERROR) << "VideoDecodeAccelerator::Initialize() failed";
607 CHECK(false); 610 CHECK(false);
608 } 611 }
609 612
610 void GLRenderingVDAClient::ProvidePictureBuffers( 613 void GLRenderingVDAClient::ProvidePictureBuffers(
611 uint32 requested_num_of_buffers, 614 uint32 requested_num_of_buffers,
612 const gfx::Size& dimensions, 615 const gfx::Size& dimensions,
613 uint32 texture_target) { 616 uint32 texture_target) {
614 if (decoder_deleted()) 617 if (decoder_deleted())
615 return; 618 return;
616 std::vector<media::PictureBuffer> buffers; 619 std::vector<media::PictureBuffer> buffers;
617 620
621 requested_num_of_buffers += kExtraPictureBuffers;
622
618 texture_target_ = texture_target; 623 texture_target_ = texture_target;
619 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { 624 for (uint32 i = 0; i < requested_num_of_buffers; ++i) {
620 uint32 texture_id; 625 uint32 texture_id;
621 base::WaitableEvent done(false, false); 626 base::WaitableEvent done(false, false);
622 rendering_helper_->CreateTexture( 627 rendering_helper_->CreateTexture(
623 texture_target_, &texture_id, dimensions, &done); 628 texture_target_, &texture_id, dimensions, &done);
624 done.Wait(); 629 done.Wait();
625 630
626 int32 picture_buffer_id = next_picture_buffer_id_++; 631 int32 picture_buffer_id = next_picture_buffer_id_++;
627 CHECK(active_textures_ 632 CHECK(active_textures_
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 content::VaapiWrapper::PreSandboxInitialization(); 1645 content::VaapiWrapper::PreSandboxInitialization();
1641 #endif 1646 #endif
1642 1647
1643 content::g_env = 1648 content::g_env =
1644 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( 1649 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>(
1645 testing::AddGlobalTestEnvironment( 1650 testing::AddGlobalTestEnvironment(
1646 new content::VideoDecodeAcceleratorTestEnvironment())); 1651 new content::VideoDecodeAcceleratorTestEnvironment()));
1647 1652
1648 return RUN_ALL_TESTS(); 1653 return RUN_ALL_TESTS();
1649 } 1654 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698