| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 int reset_after_frame_num_; | 446 int reset_after_frame_num_; |
| 447 int delete_decoder_state_; | 447 int delete_decoder_state_; |
| 448 ClientState state_; | 448 ClientState state_; |
| 449 int num_skipped_fragments_; | 449 int num_skipped_fragments_; |
| 450 int num_queued_fragments_; | 450 int num_queued_fragments_; |
| 451 int num_decoded_frames_; | 451 int num_decoded_frames_; |
| 452 int num_done_bitstream_buffers_; | 452 int num_done_bitstream_buffers_; |
| 453 PictureBufferById picture_buffers_by_id_; | 453 PictureBufferById picture_buffers_by_id_; |
| 454 base::TimeTicks initialize_done_ticks_; | 454 base::TimeTicks initialize_done_ticks_; |
| 455 int profile_; | 455 int profile_; |
| 456 GLenum texture_target_; | |
| 457 bool suppress_rendering_; | 456 bool suppress_rendering_; |
| 458 std::vector<base::TimeTicks> frame_delivery_times_; | 457 std::vector<base::TimeTicks> frame_delivery_times_; |
| 459 int delay_reuse_after_frame_num_; | 458 int delay_reuse_after_frame_num_; |
| 460 scoped_ptr<ThrottlingVDAClient> throttling_client_; | 459 scoped_ptr<ThrottlingVDAClient> throttling_client_; |
| 461 // A map from bitstream buffer id to the decode start time of the buffer. | 460 // A map from bitstream buffer id to the decode start time of the buffer. |
| 462 std::map<int, base::TimeTicks> decode_start_time_; | 461 std::map<int, base::TimeTicks> decode_start_time_; |
| 463 // The decode time of all decoded frames. | 462 // The decode time of all decoded frames. |
| 464 std::vector<base::TimeDelta> decode_time_; | 463 std::vector<base::TimeDelta> decode_time_; |
| 465 // The number of VDA::Decode calls per second. This is to simulate webrtc. | 464 // The number of VDA::Decode calls per second. This is to simulate webrtc. |
| 466 int decode_calls_per_second_; | 465 int decode_calls_per_second_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 494 note_(note), | 493 note_(note), |
| 495 remaining_play_throughs_(num_play_throughs), | 494 remaining_play_throughs_(num_play_throughs), |
| 496 reset_after_frame_num_(reset_after_frame_num), | 495 reset_after_frame_num_(reset_after_frame_num), |
| 497 delete_decoder_state_(delete_decoder_state), | 496 delete_decoder_state_(delete_decoder_state), |
| 498 state_(CS_CREATED), | 497 state_(CS_CREATED), |
| 499 num_skipped_fragments_(0), | 498 num_skipped_fragments_(0), |
| 500 num_queued_fragments_(0), | 499 num_queued_fragments_(0), |
| 501 num_decoded_frames_(0), | 500 num_decoded_frames_(0), |
| 502 num_done_bitstream_buffers_(0), | 501 num_done_bitstream_buffers_(0), |
| 503 profile_(profile), | 502 profile_(profile), |
| 504 texture_target_(0), | |
| 505 suppress_rendering_(suppress_rendering), | 503 suppress_rendering_(suppress_rendering), |
| 506 delay_reuse_after_frame_num_(delay_reuse_after_frame_num), | 504 delay_reuse_after_frame_num_(delay_reuse_after_frame_num), |
| 507 decode_calls_per_second_(decode_calls_per_second) { | 505 decode_calls_per_second_(decode_calls_per_second) { |
| 508 CHECK_GT(num_in_flight_decodes, 0); | 506 CHECK_GT(num_in_flight_decodes, 0); |
| 509 CHECK_GT(num_play_throughs, 0); | 507 CHECK_GT(num_play_throughs, 0); |
| 510 CHECK_GE(rendering_fps, 0); | 508 CHECK_GE(rendering_fps, 0); |
| 511 // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0. | 509 // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0. |
| 512 if (decode_calls_per_second_ > 0) | 510 if (decode_calls_per_second_ > 0) |
| 513 CHECK_EQ(1, num_in_flight_decodes_); | 511 CHECK_EQ(1, num_in_flight_decodes_); |
| 514 if (rendering_fps > 0) | 512 if (rendering_fps > 0) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } | 569 } |
| 572 | 570 |
| 573 void GLRenderingVDAClient::ProvidePictureBuffers( | 571 void GLRenderingVDAClient::ProvidePictureBuffers( |
| 574 uint32 requested_num_of_buffers, | 572 uint32 requested_num_of_buffers, |
| 575 const gfx::Size& dimensions, | 573 const gfx::Size& dimensions, |
| 576 uint32 texture_target) { | 574 uint32 texture_target) { |
| 577 if (decoder_deleted()) | 575 if (decoder_deleted()) |
| 578 return; | 576 return; |
| 579 std::vector<media::PictureBuffer> buffers; | 577 std::vector<media::PictureBuffer> buffers; |
| 580 | 578 |
| 581 texture_target_ = texture_target; | |
| 582 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { | 579 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { |
| 583 uint32 id = picture_buffers_by_id_.size(); | 580 uint32 id = picture_buffers_by_id_.size(); |
| 584 uint32 texture_id; | 581 uint32 texture_id; |
| 585 base::WaitableEvent done(false, false); | 582 base::WaitableEvent done(false, false); |
| 586 rendering_helper_->CreateTexture( | 583 rendering_helper_->CreateTexture( |
| 587 rendering_window_id_, texture_target_, &texture_id, &done); | 584 rendering_window_id_, texture_target, &texture_id, &done); |
| 588 done.Wait(); | 585 done.Wait(); |
| 589 CHECK(outstanding_texture_ids_.insert(texture_id).second); | 586 CHECK(outstanding_texture_ids_.insert(texture_id).second); |
| 590 media::PictureBuffer* buffer = | 587 media::PictureBuffer* buffer = |
| 591 new media::PictureBuffer(id, dimensions, texture_id); | 588 new media::PictureBuffer(id, dimensions, texture_id); |
| 592 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); | 589 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); |
| 593 buffers.push_back(*buffer); | 590 buffers.push_back(*buffer); |
| 594 } | 591 } |
| 595 decoder_->AssignPictureBuffers(buffers); | 592 decoder_->AssignPictureBuffers(buffers); |
| 596 } | 593 } |
| 597 | 594 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 decoder_->Reset(); | 629 decoder_->Reset(); |
| 633 // Re-start decoding from the beginning of the stream to avoid needing to | 630 // Re-start decoding from the beginning of the stream to avoid needing to |
| 634 // know how to find I-frames and so on in this test. | 631 // know how to find I-frames and so on in this test. |
| 635 encoded_data_next_pos_to_decode_ = 0; | 632 encoded_data_next_pos_to_decode_ = 0; |
| 636 } | 633 } |
| 637 | 634 |
| 638 media::PictureBuffer* picture_buffer = | 635 media::PictureBuffer* picture_buffer = |
| 639 picture_buffers_by_id_[picture.picture_buffer_id()]; | 636 picture_buffers_by_id_[picture.picture_buffer_id()]; |
| 640 CHECK(picture_buffer); | 637 CHECK(picture_buffer); |
| 641 if (!suppress_rendering_) { | 638 if (!suppress_rendering_) { |
| 642 rendering_helper_->RenderTexture(texture_target_, | 639 rendering_helper_->RenderTexture(picture_buffer->texture_id()); |
| 643 picture_buffer->texture_id()); | |
| 644 } | 640 } |
| 645 | 641 |
| 646 if (num_decoded_frames() > delay_reuse_after_frame_num_) { | 642 if (num_decoded_frames() > delay_reuse_after_frame_num_) { |
| 647 base::MessageLoop::current()->PostDelayedTask( | 643 base::MessageLoop::current()->PostDelayedTask( |
| 648 FROM_HERE, | 644 FROM_HERE, |
| 649 base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, | 645 base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, |
| 650 decoder_->AsWeakPtr(), | 646 decoder_->AsWeakPtr(), |
| 651 picture.picture_buffer_id()), | 647 picture.picture_buffer_id()), |
| 652 kReuseDelay); | 648 kReuseDelay); |
| 653 } else { | 649 } else { |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 if (it->first == "v" || it->first == "vmodule") | 1510 if (it->first == "v" || it->first == "vmodule") |
| 1515 continue; | 1511 continue; |
| 1516 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1512 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1517 } | 1513 } |
| 1518 | 1514 |
| 1519 base::ShadowingAtExitManager at_exit_manager; | 1515 base::ShadowingAtExitManager at_exit_manager; |
| 1520 | 1516 |
| 1521 #if defined(OS_WIN) | 1517 #if defined(OS_WIN) |
| 1522 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 1518 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
| 1523 #elif defined(OS_CHROMEOS) | 1519 #elif defined(OS_CHROMEOS) |
| 1524 #if defined(ARCH_CPU_X86_FAMILY) | 1520 #if defined(ARCH_CPU_ARMEL) |
| 1521 content::ExynosVideoDecodeAccelerator::PreSandboxInitialization(); |
| 1522 #elif defined(ARCH_CPU_X86_FAMILY) |
| 1525 content::VaapiWrapper::PreSandboxInitialization(); | 1523 content::VaapiWrapper::PreSandboxInitialization(); |
| 1526 #endif // ARCH_CPU_ARMEL | 1524 #endif // ARCH_CPU_ARMEL |
| 1527 #endif // OS_CHROMEOS | 1525 #endif // OS_CHROMEOS |
| 1528 | 1526 |
| 1529 return RUN_ALL_TESTS(); | 1527 return RUN_ALL_TESTS(); |
| 1530 } | 1528 } |
| OLD | NEW |