Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 #include "base/strings/stringize_macros.h" | 40 #include "base/strings/stringize_macros.h" |
| 41 #include "base/strings/stringprintf.h" | 41 #include "base/strings/stringprintf.h" |
| 42 #include "base/strings/utf_string_conversions.h" | 42 #include "base/strings/utf_string_conversions.h" |
| 43 #include "base/synchronization/condition_variable.h" | 43 #include "base/synchronization/condition_variable.h" |
| 44 #include "base/synchronization/lock.h" | 44 #include "base/synchronization/lock.h" |
| 45 #include "base/synchronization/waitable_event.h" | 45 #include "base/synchronization/waitable_event.h" |
| 46 #include "base/thread_task_runner_handle.h" | 46 #include "base/thread_task_runner_handle.h" |
| 47 #include "base/threading/thread.h" | 47 #include "base/threading/thread.h" |
| 48 #include "build/build_config.h" | 48 #include "build/build_config.h" |
| 49 #include "content/common/gpu/media/fake_video_decode_accelerator.h" | 49 #include "content/common/gpu/media/fake_video_decode_accelerator.h" |
| 50 #include "content/common/gpu/media/gpu_video_decode_accelerator_factory_impl.h" | |
| 50 #include "content/common/gpu/media/rendering_helper.h" | 51 #include "content/common/gpu/media/rendering_helper.h" |
| 51 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" | 52 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" |
| 53 #include "gpu/command_buffer/service/gpu_preferences.h" | |
|
hans
2016/04/08 01:29:43
I think you need a dependency on gpu.gyp:command_b
| |
| 52 #include "media/filters/h264_parser.h" | 54 #include "media/filters/h264_parser.h" |
| 53 #include "testing/gtest/include/gtest/gtest.h" | 55 #include "testing/gtest/include/gtest/gtest.h" |
| 54 #include "ui/gfx/codec/png_codec.h" | 56 #include "ui/gfx/codec/png_codec.h" |
| 55 #include "ui/gl/gl_image.h" | 57 #include "ui/gl/gl_image.h" |
| 56 | 58 |
| 57 #if defined(OS_WIN) | 59 #if defined(OS_WIN) |
| 58 #include "base/win/windows_version.h" | 60 #include "base/win/windows_version.h" |
| 59 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" | 61 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" |
| 60 #elif defined(OS_CHROMEOS) | 62 #elif defined(OS_CHROMEOS) |
| 61 #if defined(USE_V4L2_CODEC) | 63 #if defined(USE_V4L2_CODEC) |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 int num_queued_fragments() { return num_queued_fragments_; } | 354 int num_queued_fragments() { return num_queued_fragments_; } |
| 353 int num_decoded_frames() { return num_decoded_frames_; } | 355 int num_decoded_frames() { return num_decoded_frames_; } |
| 354 double frames_per_second(); | 356 double frames_per_second(); |
| 355 // Return the median of the decode time of all decoded frames. | 357 // Return the median of the decode time of all decoded frames. |
| 356 base::TimeDelta decode_time_median(); | 358 base::TimeDelta decode_time_median(); |
| 357 bool decoder_deleted() { return !decoder_.get(); } | 359 bool decoder_deleted() { return !decoder_.get(); } |
| 358 | 360 |
| 359 private: | 361 private: |
| 360 typedef std::map<int32_t, scoped_refptr<TextureRef>> TextureRefMap; | 362 typedef std::map<int32_t, scoped_refptr<TextureRef>> TextureRefMap; |
| 361 | 363 |
| 362 scoped_ptr<media::VideoDecodeAccelerator> CreateFakeVDA(); | |
| 363 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); | |
| 364 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); | |
| 365 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA(); | |
| 366 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); | |
| 367 | |
| 368 void BindImage(uint32_t client_texture_id, | |
| 369 uint32_t texture_target, | |
| 370 scoped_refptr<gl::GLImage> image, | |
| 371 bool can_bind_as_sampler); | |
| 372 | |
| 373 void SetState(ClientState new_state); | 364 void SetState(ClientState new_state); |
| 374 void FinishInitialization(); | 365 void FinishInitialization(); |
| 375 void ReturnPicture(int32_t picture_buffer_id); | 366 void ReturnPicture(int32_t picture_buffer_id); |
| 376 | 367 |
| 377 // Delete the associated decoder helper. | 368 // Delete the associated decoder helper. |
| 378 void DeleteDecoder(); | 369 void DeleteDecoder(); |
| 379 | 370 |
| 380 // Compute & return the first encoded bytes (including a start frame) to send | 371 // Compute & return the first encoded bytes (including a start frame) to send |
| 381 // to the decoder, starting at |start_pos| and returning one fragment. Skips | 372 // to the decoder, starting at |start_pos| and returning one fragment. Skips |
| 382 // to the first decodable position. | 373 // to the first decodable position. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 395 size_t window_id_; | 386 size_t window_id_; |
| 396 RenderingHelper* rendering_helper_; | 387 RenderingHelper* rendering_helper_; |
| 397 gfx::Size frame_size_; | 388 gfx::Size frame_size_; |
| 398 std::string encoded_data_; | 389 std::string encoded_data_; |
| 399 const int num_in_flight_decodes_; | 390 const int num_in_flight_decodes_; |
| 400 int outstanding_decodes_; | 391 int outstanding_decodes_; |
| 401 size_t encoded_data_next_pos_to_decode_; | 392 size_t encoded_data_next_pos_to_decode_; |
| 402 int next_bitstream_buffer_id_; | 393 int next_bitstream_buffer_id_; |
| 403 ClientStateNotification<ClientState>* note_; | 394 ClientStateNotification<ClientState>* note_; |
| 404 scoped_ptr<VideoDecodeAccelerator> decoder_; | 395 scoped_ptr<VideoDecodeAccelerator> decoder_; |
| 405 scoped_ptr<base::WeakPtrFactory<VideoDecodeAccelerator> > | 396 base::WeakPtr<VideoDecodeAccelerator> weak_vda_; |
| 406 weak_decoder_factory_; | 397 scoped_ptr<base::WeakPtrFactory<VideoDecodeAccelerator>> |
| 398 weak_vda_ptr_factory_; | |
| 399 scoped_ptr<GpuVideoDecodeAcceleratorFactoryImpl> vda_factory_; | |
| 407 int remaining_play_throughs_; | 400 int remaining_play_throughs_; |
| 408 int reset_after_frame_num_; | 401 int reset_after_frame_num_; |
| 409 int delete_decoder_state_; | 402 int delete_decoder_state_; |
| 410 ClientState state_; | 403 ClientState state_; |
| 411 int num_skipped_fragments_; | 404 int num_skipped_fragments_; |
| 412 int num_queued_fragments_; | 405 int num_queued_fragments_; |
| 413 int num_decoded_frames_; | 406 int num_decoded_frames_; |
| 414 int num_done_bitstream_buffers_; | 407 int num_done_bitstream_buffers_; |
| 415 base::TimeTicks initialize_done_ticks_; | 408 base::TimeTicks initialize_done_ticks_; |
| 416 media::VideoCodecProfile profile_; | 409 media::VideoCodecProfile profile_; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 434 // textures. | 427 // textures. |
| 435 TextureRefMap active_textures_; | 428 TextureRefMap active_textures_; |
| 436 | 429 |
| 437 // A map of the textures that are still pending in the renderer. | 430 // A map of the textures that are still pending in the renderer. |
| 438 // We check this to ensure all frames are rendered before entering the | 431 // We check this to ensure all frames are rendered before entering the |
| 439 // CS_RESET_State. | 432 // CS_RESET_State. |
| 440 TextureRefMap pending_textures_; | 433 TextureRefMap pending_textures_; |
| 441 | 434 |
| 442 int32_t next_picture_buffer_id_; | 435 int32_t next_picture_buffer_id_; |
| 443 | 436 |
| 437 base::WeakPtr<GLRenderingVDAClient> weak_this_; | |
| 438 base::WeakPtrFactory<GLRenderingVDAClient> weak_this_factory_; | |
| 439 | |
| 444 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); | 440 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); |
| 445 }; | 441 }; |
| 446 | 442 |
| 443 static bool DoNothingReturnTrue() { | |
| 444 return true; | |
| 445 } | |
| 446 | |
| 447 static bool DummyBindImage(uint32_t client_texture_id, | |
| 448 uint32_t texture_target, | |
| 449 const scoped_refptr<gl::GLImage>& image, | |
| 450 bool can_bind_to_sampler) { | |
| 451 return true; | |
| 452 } | |
| 453 | |
| 447 GLRenderingVDAClient::GLRenderingVDAClient( | 454 GLRenderingVDAClient::GLRenderingVDAClient( |
| 448 size_t window_id, | 455 size_t window_id, |
| 449 RenderingHelper* rendering_helper, | 456 RenderingHelper* rendering_helper, |
| 450 ClientStateNotification<ClientState>* note, | 457 ClientStateNotification<ClientState>* note, |
| 451 const std::string& encoded_data, | 458 const std::string& encoded_data, |
| 452 int num_in_flight_decodes, | 459 int num_in_flight_decodes, |
| 453 int num_play_throughs, | 460 int num_play_throughs, |
| 454 int reset_after_frame_num, | 461 int reset_after_frame_num, |
| 455 int delete_decoder_state, | 462 int delete_decoder_state, |
| 456 int frame_width, | 463 int frame_width, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 477 num_skipped_fragments_(0), | 484 num_skipped_fragments_(0), |
| 478 num_queued_fragments_(0), | 485 num_queued_fragments_(0), |
| 479 num_decoded_frames_(0), | 486 num_decoded_frames_(0), |
| 480 num_done_bitstream_buffers_(0), | 487 num_done_bitstream_buffers_(0), |
| 481 fake_decoder_(fake_decoder), | 488 fake_decoder_(fake_decoder), |
| 482 texture_target_(0), | 489 texture_target_(0), |
| 483 suppress_rendering_(suppress_rendering), | 490 suppress_rendering_(suppress_rendering), |
| 484 delay_reuse_after_frame_num_(delay_reuse_after_frame_num), | 491 delay_reuse_after_frame_num_(delay_reuse_after_frame_num), |
| 485 decode_calls_per_second_(decode_calls_per_second), | 492 decode_calls_per_second_(decode_calls_per_second), |
| 486 render_as_thumbnails_(render_as_thumbnails), | 493 render_as_thumbnails_(render_as_thumbnails), |
| 487 next_picture_buffer_id_(1) { | 494 next_picture_buffer_id_(1), |
| 495 weak_this_factory_(this) { | |
| 488 LOG_ASSERT(num_in_flight_decodes > 0); | 496 LOG_ASSERT(num_in_flight_decodes > 0); |
| 489 LOG_ASSERT(num_play_throughs > 0); | 497 LOG_ASSERT(num_play_throughs > 0); |
| 490 // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0. | 498 // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0. |
| 491 if (decode_calls_per_second_ > 0) | 499 if (decode_calls_per_second_ > 0) |
| 492 LOG_ASSERT(1 == num_in_flight_decodes_); | 500 LOG_ASSERT(1 == num_in_flight_decodes_); |
| 493 | 501 |
| 494 // Default to H264 baseline if no profile provided. | 502 // Default to H264 baseline if no profile provided. |
| 495 profile_ = (profile != media::VIDEO_CODEC_PROFILE_UNKNOWN | 503 profile_ = (profile != media::VIDEO_CODEC_PROFILE_UNKNOWN |
| 496 ? profile | 504 ? profile |
| 497 : media::H264PROFILE_BASELINE); | 505 : media::H264PROFILE_BASELINE); |
| 506 | |
| 507 weak_this_ = weak_this_factory_.GetWeakPtr(); | |
| 498 } | 508 } |
| 499 | 509 |
| 500 GLRenderingVDAClient::~GLRenderingVDAClient() { | 510 GLRenderingVDAClient::~GLRenderingVDAClient() { |
| 501 DeleteDecoder(); // Clean up in case of expected error. | 511 DeleteDecoder(); // Clean up in case of expected error. |
| 502 LOG_ASSERT(decoder_deleted()); | 512 LOG_ASSERT(decoder_deleted()); |
| 503 SetState(CS_DESTROYED); | 513 SetState(CS_DESTROYED); |
| 504 } | 514 } |
| 505 | 515 |
| 506 static bool DoNothingReturnTrue() { return true; } | |
| 507 | |
| 508 scoped_ptr<media::VideoDecodeAccelerator> | |
| 509 GLRenderingVDAClient::CreateFakeVDA() { | |
| 510 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 511 if (fake_decoder_) { | |
| 512 decoder.reset(new FakeVideoDecodeAccelerator( | |
| 513 static_cast<gfx::GLContext*> (rendering_helper_->GetGLContextHandle()), | |
| 514 frame_size_, | |
| 515 base::Bind(&DoNothingReturnTrue))); | |
| 516 } | |
| 517 return decoder; | |
| 518 } | |
| 519 | |
| 520 scoped_ptr<media::VideoDecodeAccelerator> | |
| 521 GLRenderingVDAClient::CreateDXVAVDA() { | |
| 522 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 523 #if defined(OS_WIN) | |
| 524 if (base::win::GetVersion() >= base::win::VERSION_WIN7) { | |
| 525 const bool enable_accelerated_vpx_decode = false; | |
| 526 decoder.reset(new DXVAVideoDecodeAccelerator( | |
| 527 base::Bind(&DoNothingReturnTrue), | |
| 528 rendering_helper_->GetGLContext().get(), | |
| 529 enable_accelerated_vpx_decode)); | |
| 530 } | |
| 531 #endif | |
| 532 return decoder; | |
| 533 } | |
| 534 | |
| 535 scoped_ptr<media::VideoDecodeAccelerator> | |
| 536 GLRenderingVDAClient::CreateV4L2VDA() { | |
| 537 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 538 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
| 539 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | |
| 540 if (device.get()) { | |
| 541 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr(); | |
| 542 decoder.reset(new V4L2VideoDecodeAccelerator( | |
| 543 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | |
| 544 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | |
| 545 weak_client, base::Bind(&DoNothingReturnTrue), device, | |
| 546 base::ThreadTaskRunnerHandle::Get())); | |
| 547 } | |
| 548 #endif | |
| 549 return decoder; | |
| 550 } | |
| 551 | |
| 552 scoped_ptr<media::VideoDecodeAccelerator> | |
| 553 GLRenderingVDAClient::CreateV4L2SliceVDA() { | |
| 554 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 555 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
| 556 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | |
| 557 if (device.get()) { | |
| 558 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr(); | |
| 559 decoder.reset(new V4L2SliceVideoDecodeAccelerator( | |
| 560 device, static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | |
| 561 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | |
| 562 weak_client, base::Bind(&DoNothingReturnTrue), | |
| 563 base::ThreadTaskRunnerHandle::Get())); | |
| 564 } | |
| 565 #endif | |
| 566 return decoder; | |
| 567 } | |
| 568 | |
| 569 scoped_ptr<media::VideoDecodeAccelerator> | |
| 570 GLRenderingVDAClient::CreateVaapiVDA() { | |
| 571 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 572 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | |
| 573 decoder.reset(new VaapiVideoDecodeAccelerator( | |
| 574 base::Bind(&DoNothingReturnTrue), | |
| 575 base::Bind(&GLRenderingVDAClient::BindImage, base::Unretained(this)))); | |
| 576 #endif | |
| 577 return decoder; | |
| 578 } | |
| 579 | |
| 580 void GLRenderingVDAClient::BindImage(uint32_t client_texture_id, | |
| 581 uint32_t texture_target, | |
| 582 scoped_refptr<gl::GLImage> image, | |
| 583 bool can_bind_to_sampler) {} | |
| 584 | |
| 585 void GLRenderingVDAClient::CreateAndStartDecoder() { | 516 void GLRenderingVDAClient::CreateAndStartDecoder() { |
| 586 LOG_ASSERT(decoder_deleted()); | 517 LOG_ASSERT(decoder_deleted()); |
| 587 LOG_ASSERT(!decoder_.get()); | 518 LOG_ASSERT(!decoder_.get()); |
| 588 | 519 |
| 589 VideoDecodeAccelerator::Client* client = this; | 520 if (fake_decoder_) { |
| 521 decoder_.reset(new FakeVideoDecodeAccelerator( | |
| 522 frame_size_, base::Bind(&DoNothingReturnTrue))); | |
| 523 LOG_ASSERT(decoder_->Initialize(profile_, this)); | |
| 524 } else { | |
| 525 if (!vda_factory_) { | |
| 526 vda_factory_ = GpuVideoDecodeAcceleratorFactoryImpl::Create( | |
| 527 base::Bind(&RenderingHelper::GetGLContext, | |
| 528 base::Unretained(rendering_helper_)), | |
| 529 base::Bind(&DoNothingReturnTrue), base::Bind(&DummyBindImage)); | |
| 530 LOG_ASSERT(vda_factory_); | |
| 531 } | |
| 590 | 532 |
| 591 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { | 533 VideoDecodeAccelerator::Config config(profile_); |
| 592 CreateFakeVDA(), | 534 gpu::GpuPreferences gpu_preferences; |
| 593 CreateDXVAVDA(), | 535 decoder_ = vda_factory_->CreateVDA(this, config, gpu_preferences); |
| 594 CreateV4L2VDA(), | 536 } |
| 595 CreateV4L2SliceVDA(), | |
| 596 CreateVaapiVDA(), | |
| 597 }; | |
| 598 | 537 |
| 599 for (size_t i = 0; i < arraysize(decoders); ++i) { | 538 LOG_ASSERT(decoder_) << "Failed creating a VDA"; |
| 600 if (!decoders[i]) | 539 |
| 601 continue; | 540 decoder_->TryToSetupDecodeOnSeparateThread( |
| 602 decoder_ = std::move(decoders[i]); | 541 weak_this_, base::ThreadTaskRunnerHandle::Get()); |
| 603 weak_decoder_factory_.reset( | 542 |
| 604 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); | 543 SetState(CS_DECODER_SET); |
| 605 if (decoder_->Initialize(profile_, client)) { | 544 FinishInitialization(); |
| 606 SetState(CS_DECODER_SET); | |
| 607 FinishInitialization(); | |
| 608 return; | |
| 609 } | |
| 610 } | |
| 611 // Decoders are all initialize failed. | |
| 612 LOG(ERROR) << "VideoDecodeAccelerator::Initialize() failed"; | |
| 613 LOG_ASSERT(false); | |
| 614 } | 545 } |
| 615 | 546 |
| 616 void GLRenderingVDAClient::ProvidePictureBuffers( | 547 void GLRenderingVDAClient::ProvidePictureBuffers( |
| 617 uint32_t requested_num_of_buffers, | 548 uint32_t requested_num_of_buffers, |
| 618 uint32_t textures_per_buffer, | 549 uint32_t textures_per_buffer, |
| 619 const gfx::Size& dimensions, | 550 const gfx::Size& dimensions, |
| 620 uint32_t texture_target) { | 551 uint32_t texture_target) { |
| 621 if (decoder_deleted()) | 552 if (decoder_deleted()) |
| 622 return; | 553 return; |
| 623 LOG_ASSERT(textures_per_buffer == 1u); | 554 LOG_ASSERT(textures_per_buffer == 1u); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 LOG_ASSERT(1U == pending_textures_.erase(picture_buffer_id)); | 641 LOG_ASSERT(1U == pending_textures_.erase(picture_buffer_id)); |
| 711 | 642 |
| 712 if (pending_textures_.empty() && state_ == CS_RESETTING) { | 643 if (pending_textures_.empty() && state_ == CS_RESETTING) { |
| 713 SetState(CS_RESET); | 644 SetState(CS_RESET); |
| 714 DeleteDecoder(); | 645 DeleteDecoder(); |
| 715 return; | 646 return; |
| 716 } | 647 } |
| 717 | 648 |
| 718 if (num_decoded_frames_ > delay_reuse_after_frame_num_) { | 649 if (num_decoded_frames_ > delay_reuse_after_frame_num_) { |
| 719 base::MessageLoop::current()->PostDelayedTask( | 650 base::MessageLoop::current()->PostDelayedTask( |
| 720 FROM_HERE, | 651 FROM_HERE, base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, |
| 721 base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, | 652 weak_vda_, picture_buffer_id), |
| 722 weak_decoder_factory_->GetWeakPtr(), | |
| 723 picture_buffer_id), | |
| 724 kReuseDelay); | 653 kReuseDelay); |
| 725 } else { | 654 } else { |
| 726 decoder_->ReusePictureBuffer(picture_buffer_id); | 655 decoder_->ReusePictureBuffer(picture_buffer_id); |
| 727 } | 656 } |
| 728 } | 657 } |
| 729 | 658 |
| 730 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( | 659 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( |
| 731 int32_t bitstream_buffer_id) { | 660 int32_t bitstream_buffer_id) { |
| 732 // TODO(fischman): this test currently relies on this notification to make | 661 // TODO(fischman): this test currently relies on this notification to make |
| 733 // forward progress during a Reset(). But the VDA::Reset() API doesn't | 662 // forward progress during a Reset(). But the VDA::Reset() API doesn't |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 835 } | 764 } |
| 836 | 765 |
| 837 for (int i = 0; i < num_in_flight_decodes_; ++i) | 766 for (int i = 0; i < num_in_flight_decodes_; ++i) |
| 838 DecodeNextFragment(); | 767 DecodeNextFragment(); |
| 839 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); | 768 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); |
| 840 } | 769 } |
| 841 | 770 |
| 842 void GLRenderingVDAClient::DeleteDecoder() { | 771 void GLRenderingVDAClient::DeleteDecoder() { |
| 843 if (decoder_deleted()) | 772 if (decoder_deleted()) |
| 844 return; | 773 return; |
| 845 weak_decoder_factory_.reset(); | 774 weak_vda_ptr_factory_.reset(); |
| 846 decoder_.reset(); | 775 decoder_.reset(); |
| 847 STLClearObject(&encoded_data_); | 776 STLClearObject(&encoded_data_); |
| 848 active_textures_.clear(); | 777 active_textures_.clear(); |
| 849 | 778 |
| 850 // Cascade through the rest of the states to simplify test code below. | 779 // Cascade through the rest of the states to simplify test code below. |
| 851 for (int i = state_ + 1; i < CS_MAX; ++i) | 780 for (int i = state_ + 1; i < CS_MAX; ++i) |
| 852 SetState(static_cast<ClientState>(i)); | 781 SetState(static_cast<ClientState>(i)); |
| 853 } | 782 } |
| 854 | 783 |
| 855 std::string GLRenderingVDAClient::GetBytesForFirstFragment( | 784 std::string GLRenderingVDAClient::GetBytesForFirstFragment( |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1650 content::VaapiWrapper::PreSandboxInitialization(); | 1579 content::VaapiWrapper::PreSandboxInitialization(); |
| 1651 #endif | 1580 #endif |
| 1652 | 1581 |
| 1653 content::g_env = | 1582 content::g_env = |
| 1654 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( | 1583 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( |
| 1655 testing::AddGlobalTestEnvironment( | 1584 testing::AddGlobalTestEnvironment( |
| 1656 new content::VideoDecodeAcceleratorTestEnvironment())); | 1585 new content::VideoDecodeAcceleratorTestEnvironment())); |
| 1657 | 1586 |
| 1658 return RUN_ALL_TESTS(); | 1587 return RUN_ALL_TESTS(); |
| 1659 } | 1588 } |
| OLD | NEW |