| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 int reset_after_frame_num_; | 493 int reset_after_frame_num_; |
| 494 int delete_decoder_state_; | 494 int delete_decoder_state_; |
| 495 ClientState state_; | 495 ClientState state_; |
| 496 int num_skipped_fragments_; | 496 int num_skipped_fragments_; |
| 497 int num_queued_fragments_; | 497 int num_queued_fragments_; |
| 498 int num_decoded_frames_; | 498 int num_decoded_frames_; |
| 499 int num_done_bitstream_buffers_; | 499 int num_done_bitstream_buffers_; |
| 500 PictureBufferById picture_buffers_by_id_; | 500 PictureBufferById picture_buffers_by_id_; |
| 501 base::TimeTicks initialize_done_ticks_; | 501 base::TimeTicks initialize_done_ticks_; |
| 502 int profile_; | 502 int profile_; |
| 503 GLenum texture_target_; |
| 503 bool suppress_rendering_; | 504 bool suppress_rendering_; |
| 504 std::vector<base::TimeTicks> frame_delivery_times_; | 505 std::vector<base::TimeTicks> frame_delivery_times_; |
| 505 int delay_reuse_after_frame_num_; | 506 int delay_reuse_after_frame_num_; |
| 506 scoped_ptr<ThrottlingVDAClient> throttling_client_; | 507 scoped_ptr<ThrottlingVDAClient> throttling_client_; |
| 507 | 508 |
| 508 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); | 509 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); |
| 509 }; | 510 }; |
| 510 | 511 |
| 511 GLRenderingVDAClient::GLRenderingVDAClient( | 512 GLRenderingVDAClient::GLRenderingVDAClient( |
| 512 RenderingHelper* rendering_helper, | 513 RenderingHelper* rendering_helper, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 533 note_(note), | 534 note_(note), |
| 534 remaining_play_throughs_(num_play_throughs), | 535 remaining_play_throughs_(num_play_throughs), |
| 535 reset_after_frame_num_(reset_after_frame_num), | 536 reset_after_frame_num_(reset_after_frame_num), |
| 536 delete_decoder_state_(delete_decoder_state), | 537 delete_decoder_state_(delete_decoder_state), |
| 537 state_(CS_CREATED), | 538 state_(CS_CREATED), |
| 538 num_skipped_fragments_(0), | 539 num_skipped_fragments_(0), |
| 539 num_queued_fragments_(0), | 540 num_queued_fragments_(0), |
| 540 num_decoded_frames_(0), | 541 num_decoded_frames_(0), |
| 541 num_done_bitstream_buffers_(0), | 542 num_done_bitstream_buffers_(0), |
| 542 profile_(profile), | 543 profile_(profile), |
| 544 texture_target_(0), |
| 543 suppress_rendering_(suppress_rendering), | 545 suppress_rendering_(suppress_rendering), |
| 544 delay_reuse_after_frame_num_(delay_reuse_after_frame_num) { | 546 delay_reuse_after_frame_num_(delay_reuse_after_frame_num) { |
| 545 CHECK_GT(num_in_flight_decodes, 0); | 547 CHECK_GT(num_in_flight_decodes, 0); |
| 546 CHECK_GT(num_play_throughs, 0); | 548 CHECK_GT(num_play_throughs, 0); |
| 547 CHECK_GE(rendering_fps, 0); | 549 CHECK_GE(rendering_fps, 0); |
| 548 if (rendering_fps > 0) | 550 if (rendering_fps > 0) |
| 549 throttling_client_.reset(new ThrottlingVDAClient( | 551 throttling_client_.reset(new ThrottlingVDAClient( |
| 550 this, | 552 this, |
| 551 rendering_fps, | 553 rendering_fps, |
| 552 base::Bind(&GLRenderingVDAClient::NotifyFrameDropped, | 554 base::Bind(&GLRenderingVDAClient::NotifyFrameDropped, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 } | 607 } |
| 606 | 608 |
| 607 void GLRenderingVDAClient::ProvidePictureBuffers( | 609 void GLRenderingVDAClient::ProvidePictureBuffers( |
| 608 uint32 requested_num_of_buffers, | 610 uint32 requested_num_of_buffers, |
| 609 const gfx::Size& dimensions, | 611 const gfx::Size& dimensions, |
| 610 uint32 texture_target) { | 612 uint32 texture_target) { |
| 611 if (decoder_deleted()) | 613 if (decoder_deleted()) |
| 612 return; | 614 return; |
| 613 std::vector<media::PictureBuffer> buffers; | 615 std::vector<media::PictureBuffer> buffers; |
| 614 | 616 |
| 617 texture_target_ = texture_target; |
| 615 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { | 618 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { |
| 616 uint32 id = picture_buffers_by_id_.size(); | 619 uint32 id = picture_buffers_by_id_.size(); |
| 617 uint32 texture_id; | 620 uint32 texture_id; |
| 618 base::WaitableEvent done(false, false); | 621 base::WaitableEvent done(false, false); |
| 619 rendering_helper_->CreateTexture( | 622 rendering_helper_->CreateTexture( |
| 620 rendering_window_id_, texture_target, &texture_id, &done); | 623 rendering_window_id_, texture_target_, &texture_id, &done); |
| 621 done.Wait(); | 624 done.Wait(); |
| 622 CHECK(outstanding_texture_ids_.insert(texture_id).second); | 625 CHECK(outstanding_texture_ids_.insert(texture_id).second); |
| 623 media::PictureBuffer* buffer = | 626 media::PictureBuffer* buffer = |
| 624 new media::PictureBuffer(id, dimensions, texture_id); | 627 new media::PictureBuffer(id, dimensions, texture_id); |
| 625 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); | 628 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); |
| 626 buffers.push_back(*buffer); | 629 buffers.push_back(*buffer); |
| 627 } | 630 } |
| 628 decoder_->AssignPictureBuffers(buffers); | 631 decoder_->AssignPictureBuffers(buffers); |
| 629 } | 632 } |
| 630 | 633 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 658 decoder_->Reset(); | 661 decoder_->Reset(); |
| 659 // Re-start decoding from the beginning of the stream to avoid needing to | 662 // Re-start decoding from the beginning of the stream to avoid needing to |
| 660 // know how to find I-frames and so on in this test. | 663 // know how to find I-frames and so on in this test. |
| 661 encoded_data_next_pos_to_decode_ = 0; | 664 encoded_data_next_pos_to_decode_ = 0; |
| 662 } | 665 } |
| 663 | 666 |
| 664 media::PictureBuffer* picture_buffer = | 667 media::PictureBuffer* picture_buffer = |
| 665 picture_buffers_by_id_[picture.picture_buffer_id()]; | 668 picture_buffers_by_id_[picture.picture_buffer_id()]; |
| 666 CHECK(picture_buffer); | 669 CHECK(picture_buffer); |
| 667 if (!suppress_rendering_) { | 670 if (!suppress_rendering_) { |
| 668 rendering_helper_->RenderTexture(picture_buffer->texture_id()); | 671 rendering_helper_->RenderTexture(texture_target_, |
| 672 picture_buffer->texture_id()); |
| 669 } | 673 } |
| 670 | 674 |
| 671 if (num_decoded_frames() > delay_reuse_after_frame_num_) { | 675 if (num_decoded_frames() > delay_reuse_after_frame_num_) { |
| 672 base::MessageLoop::current()->PostDelayedTask( | 676 base::MessageLoop::current()->PostDelayedTask( |
| 673 FROM_HERE, | 677 FROM_HERE, |
| 674 base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, | 678 base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, |
| 675 decoder_->AsWeakPtr(), | 679 decoder_->AsWeakPtr(), |
| 676 picture.picture_buffer_id()), | 680 picture.picture_buffer_id()), |
| 677 kReuseDelay); | 681 kReuseDelay); |
| 678 } else { | 682 } else { |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 if (it->first == "v" || it->first == "vmodule") | 1329 if (it->first == "v" || it->first == "vmodule") |
| 1326 continue; | 1330 continue; |
| 1327 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1331 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1328 } | 1332 } |
| 1329 | 1333 |
| 1330 base::ShadowingAtExitManager at_exit_manager; | 1334 base::ShadowingAtExitManager at_exit_manager; |
| 1331 | 1335 |
| 1332 #if defined(OS_WIN) | 1336 #if defined(OS_WIN) |
| 1333 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 1337 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
| 1334 #elif defined(OS_CHROMEOS) | 1338 #elif defined(OS_CHROMEOS) |
| 1335 #if defined(ARCH_CPU_ARMEL) | 1339 #if defined(ARCH_CPU_X86_FAMILY) |
| 1336 content::ExynosVideoDecodeAccelerator::PreSandboxInitialization(); | |
| 1337 #elif defined(ARCH_CPU_X86_FAMILY) | |
| 1338 content::VaapiWrapper::PreSandboxInitialization(); | 1340 content::VaapiWrapper::PreSandboxInitialization(); |
| 1339 #endif // ARCH_CPU_ARMEL | 1341 #endif // ARCH_CPU_ARMEL |
| 1340 #endif // OS_CHROMEOS | 1342 #endif // OS_CHROMEOS |
| 1341 | 1343 |
| 1342 return RUN_ALL_TESTS(); | 1344 return RUN_ALL_TESTS(); |
| 1343 } | 1345 } |
| OLD | NEW |