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