| 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" |
| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 int num_queued_fragments() { return num_queued_fragments_; } | 353 int num_queued_fragments() { return num_queued_fragments_; } |
| 352 int num_decoded_frames() { return num_decoded_frames_; } | 354 int num_decoded_frames() { return num_decoded_frames_; } |
| 353 double frames_per_second(); | 355 double frames_per_second(); |
| 354 // Return the median of the decode time of all decoded frames. | 356 // Return the median of the decode time of all decoded frames. |
| 355 base::TimeDelta decode_time_median(); | 357 base::TimeDelta decode_time_median(); |
| 356 bool decoder_deleted() { return !decoder_.get(); } | 358 bool decoder_deleted() { return !decoder_.get(); } |
| 357 | 359 |
| 358 private: | 360 private: |
| 359 typedef std::map<int32_t, scoped_refptr<TextureRef>> TextureRefMap; | 361 typedef std::map<int32_t, scoped_refptr<TextureRef>> TextureRefMap; |
| 360 | 362 |
| 361 scoped_ptr<media::VideoDecodeAccelerator> CreateFakeVDA(); | |
| 362 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); | |
| 363 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); | |
| 364 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA(); | |
| 365 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); | |
| 366 | |
| 367 void BindImage(uint32_t client_texture_id, | |
| 368 uint32_t texture_target, | |
| 369 scoped_refptr<gl::GLImage> image); | |
| 370 | |
| 371 void SetState(ClientState new_state); | 363 void SetState(ClientState new_state); |
| 372 void FinishInitialization(); | 364 void FinishInitialization(); |
| 373 void ReturnPicture(int32_t picture_buffer_id); | 365 void ReturnPicture(int32_t picture_buffer_id); |
| 374 | 366 |
| 375 // Delete the associated decoder helper. | 367 // Delete the associated decoder helper. |
| 376 void DeleteDecoder(); | 368 void DeleteDecoder(); |
| 377 | 369 |
| 378 // Compute & return the first encoded bytes (including a start frame) to send | 370 // Compute & return the first encoded bytes (including a start frame) to send |
| 379 // to the decoder, starting at |start_pos| and returning one fragment. Skips | 371 // to the decoder, starting at |start_pos| and returning one fragment. Skips |
| 380 // to the first decodable position. | 372 // to the first decodable position. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 393 size_t window_id_; | 385 size_t window_id_; |
| 394 RenderingHelper* rendering_helper_; | 386 RenderingHelper* rendering_helper_; |
| 395 gfx::Size frame_size_; | 387 gfx::Size frame_size_; |
| 396 std::string encoded_data_; | 388 std::string encoded_data_; |
| 397 const int num_in_flight_decodes_; | 389 const int num_in_flight_decodes_; |
| 398 int outstanding_decodes_; | 390 int outstanding_decodes_; |
| 399 size_t encoded_data_next_pos_to_decode_; | 391 size_t encoded_data_next_pos_to_decode_; |
| 400 int next_bitstream_buffer_id_; | 392 int next_bitstream_buffer_id_; |
| 401 ClientStateNotification<ClientState>* note_; | 393 ClientStateNotification<ClientState>* note_; |
| 402 scoped_ptr<VideoDecodeAccelerator> decoder_; | 394 scoped_ptr<VideoDecodeAccelerator> decoder_; |
| 403 scoped_ptr<base::WeakPtrFactory<VideoDecodeAccelerator> > | 395 base::WeakPtr<VideoDecodeAccelerator> weak_vda_; |
| 404 weak_decoder_factory_; | 396 scoped_ptr<base::WeakPtrFactory<VideoDecodeAccelerator>> |
| 397 weak_vda_ptr_factory_; |
| 398 scoped_ptr<GpuVideoDecodeAcceleratorFactoryImpl> vda_factory_; |
| 405 int remaining_play_throughs_; | 399 int remaining_play_throughs_; |
| 406 int reset_after_frame_num_; | 400 int reset_after_frame_num_; |
| 407 int delete_decoder_state_; | 401 int delete_decoder_state_; |
| 408 ClientState state_; | 402 ClientState state_; |
| 409 int num_skipped_fragments_; | 403 int num_skipped_fragments_; |
| 410 int num_queued_fragments_; | 404 int num_queued_fragments_; |
| 411 int num_decoded_frames_; | 405 int num_decoded_frames_; |
| 412 int num_done_bitstream_buffers_; | 406 int num_done_bitstream_buffers_; |
| 413 base::TimeTicks initialize_done_ticks_; | 407 base::TimeTicks initialize_done_ticks_; |
| 414 media::VideoCodecProfile profile_; | 408 media::VideoCodecProfile profile_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 432 // textures. | 426 // textures. |
| 433 TextureRefMap active_textures_; | 427 TextureRefMap active_textures_; |
| 434 | 428 |
| 435 // A map of the textures that are still pending in the renderer. | 429 // A map of the textures that are still pending in the renderer. |
| 436 // We check this to ensure all frames are rendered before entering the | 430 // We check this to ensure all frames are rendered before entering the |
| 437 // CS_RESET_State. | 431 // CS_RESET_State. |
| 438 TextureRefMap pending_textures_; | 432 TextureRefMap pending_textures_; |
| 439 | 433 |
| 440 int32_t next_picture_buffer_id_; | 434 int32_t next_picture_buffer_id_; |
| 441 | 435 |
| 436 base::WeakPtr<GLRenderingVDAClient> weak_this_; |
| 437 base::WeakPtrFactory<GLRenderingVDAClient> weak_this_factory_; |
| 438 |
| 442 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); | 439 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); |
| 443 }; | 440 }; |
| 444 | 441 |
| 442 static bool DoNothingReturnTrue() { |
| 443 return true; |
| 444 } |
| 445 |
| 446 static bool DummyBindImage(uint32_t client_texture_id, |
| 447 uint32_t texture_target, |
| 448 const scoped_refptr<gl::GLImage>& image) { |
| 449 return true; |
| 450 } |
| 451 |
| 445 GLRenderingVDAClient::GLRenderingVDAClient( | 452 GLRenderingVDAClient::GLRenderingVDAClient( |
| 446 size_t window_id, | 453 size_t window_id, |
| 447 RenderingHelper* rendering_helper, | 454 RenderingHelper* rendering_helper, |
| 448 ClientStateNotification<ClientState>* note, | 455 ClientStateNotification<ClientState>* note, |
| 449 const std::string& encoded_data, | 456 const std::string& encoded_data, |
| 450 int num_in_flight_decodes, | 457 int num_in_flight_decodes, |
| 451 int num_play_throughs, | 458 int num_play_throughs, |
| 452 int reset_after_frame_num, | 459 int reset_after_frame_num, |
| 453 int delete_decoder_state, | 460 int delete_decoder_state, |
| 454 int frame_width, | 461 int frame_width, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 475 num_skipped_fragments_(0), | 482 num_skipped_fragments_(0), |
| 476 num_queued_fragments_(0), | 483 num_queued_fragments_(0), |
| 477 num_decoded_frames_(0), | 484 num_decoded_frames_(0), |
| 478 num_done_bitstream_buffers_(0), | 485 num_done_bitstream_buffers_(0), |
| 479 fake_decoder_(fake_decoder), | 486 fake_decoder_(fake_decoder), |
| 480 texture_target_(0), | 487 texture_target_(0), |
| 481 suppress_rendering_(suppress_rendering), | 488 suppress_rendering_(suppress_rendering), |
| 482 delay_reuse_after_frame_num_(delay_reuse_after_frame_num), | 489 delay_reuse_after_frame_num_(delay_reuse_after_frame_num), |
| 483 decode_calls_per_second_(decode_calls_per_second), | 490 decode_calls_per_second_(decode_calls_per_second), |
| 484 render_as_thumbnails_(render_as_thumbnails), | 491 render_as_thumbnails_(render_as_thumbnails), |
| 485 next_picture_buffer_id_(1) { | 492 next_picture_buffer_id_(1), |
| 493 weak_this_factory_(this) { |
| 486 LOG_ASSERT(num_in_flight_decodes > 0); | 494 LOG_ASSERT(num_in_flight_decodes > 0); |
| 487 LOG_ASSERT(num_play_throughs > 0); | 495 LOG_ASSERT(num_play_throughs > 0); |
| 488 // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0. | 496 // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0. |
| 489 if (decode_calls_per_second_ > 0) | 497 if (decode_calls_per_second_ > 0) |
| 490 LOG_ASSERT(1 == num_in_flight_decodes_); | 498 LOG_ASSERT(1 == num_in_flight_decodes_); |
| 491 | 499 |
| 492 // Default to H264 baseline if no profile provided. | 500 // Default to H264 baseline if no profile provided. |
| 493 profile_ = (profile != media::VIDEO_CODEC_PROFILE_UNKNOWN | 501 profile_ = (profile != media::VIDEO_CODEC_PROFILE_UNKNOWN |
| 494 ? profile | 502 ? profile |
| 495 : media::H264PROFILE_BASELINE); | 503 : media::H264PROFILE_BASELINE); |
| 504 |
| 505 weak_this_ = weak_this_factory_.GetWeakPtr(); |
| 496 } | 506 } |
| 497 | 507 |
| 498 GLRenderingVDAClient::~GLRenderingVDAClient() { | 508 GLRenderingVDAClient::~GLRenderingVDAClient() { |
| 499 DeleteDecoder(); // Clean up in case of expected error. | 509 DeleteDecoder(); // Clean up in case of expected error. |
| 500 LOG_ASSERT(decoder_deleted()); | 510 LOG_ASSERT(decoder_deleted()); |
| 501 SetState(CS_DESTROYED); | 511 SetState(CS_DESTROYED); |
| 502 } | 512 } |
| 503 | 513 |
| 504 static bool DoNothingReturnTrue() { return true; } | |
| 505 | |
| 506 scoped_ptr<media::VideoDecodeAccelerator> | |
| 507 GLRenderingVDAClient::CreateFakeVDA() { | |
| 508 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 509 if (fake_decoder_) { | |
| 510 decoder.reset(new FakeVideoDecodeAccelerator( | |
| 511 static_cast<gfx::GLContext*> (rendering_helper_->GetGLContextHandle()), | |
| 512 frame_size_, | |
| 513 base::Bind(&DoNothingReturnTrue))); | |
| 514 } | |
| 515 return decoder; | |
| 516 } | |
| 517 | |
| 518 scoped_ptr<media::VideoDecodeAccelerator> | |
| 519 GLRenderingVDAClient::CreateDXVAVDA() { | |
| 520 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 521 #if defined(OS_WIN) | |
| 522 if (base::win::GetVersion() >= base::win::VERSION_WIN7) { | |
| 523 const bool enable_accelerated_vpx_decode = false; | |
| 524 decoder.reset(new DXVAVideoDecodeAccelerator( | |
| 525 base::Bind(&DoNothingReturnTrue), | |
| 526 rendering_helper_->GetGLContext().get(), | |
| 527 enable_accelerated_vpx_decode)); | |
| 528 } | |
| 529 #endif | |
| 530 return decoder; | |
| 531 } | |
| 532 | |
| 533 scoped_ptr<media::VideoDecodeAccelerator> | |
| 534 GLRenderingVDAClient::CreateV4L2VDA() { | |
| 535 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 536 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
| 537 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | |
| 538 if (device.get()) { | |
| 539 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr(); | |
| 540 decoder.reset(new V4L2VideoDecodeAccelerator( | |
| 541 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | |
| 542 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | |
| 543 weak_client, base::Bind(&DoNothingReturnTrue), device, | |
| 544 base::ThreadTaskRunnerHandle::Get())); | |
| 545 } | |
| 546 #endif | |
| 547 return decoder; | |
| 548 } | |
| 549 | |
| 550 scoped_ptr<media::VideoDecodeAccelerator> | |
| 551 GLRenderingVDAClient::CreateV4L2SliceVDA() { | |
| 552 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 553 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
| 554 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | |
| 555 if (device.get()) { | |
| 556 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr(); | |
| 557 decoder.reset(new V4L2SliceVideoDecodeAccelerator( | |
| 558 device, static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | |
| 559 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | |
| 560 weak_client, base::Bind(&DoNothingReturnTrue), | |
| 561 base::ThreadTaskRunnerHandle::Get())); | |
| 562 } | |
| 563 #endif | |
| 564 return decoder; | |
| 565 } | |
| 566 | |
| 567 scoped_ptr<media::VideoDecodeAccelerator> | |
| 568 GLRenderingVDAClient::CreateVaapiVDA() { | |
| 569 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 570 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | |
| 571 decoder.reset(new VaapiVideoDecodeAccelerator( | |
| 572 base::Bind(&DoNothingReturnTrue), | |
| 573 base::Bind(&GLRenderingVDAClient::BindImage, base::Unretained(this)))); | |
| 574 #endif | |
| 575 return decoder; | |
| 576 } | |
| 577 | |
| 578 void GLRenderingVDAClient::BindImage(uint32_t client_texture_id, | |
| 579 uint32_t texture_target, | |
| 580 scoped_refptr<gl::GLImage> image) {} | |
| 581 | |
| 582 void GLRenderingVDAClient::CreateAndStartDecoder() { | 514 void GLRenderingVDAClient::CreateAndStartDecoder() { |
| 583 LOG_ASSERT(decoder_deleted()); | 515 LOG_ASSERT(decoder_deleted()); |
| 584 LOG_ASSERT(!decoder_.get()); | 516 LOG_ASSERT(!decoder_.get()); |
| 585 | 517 |
| 586 VideoDecodeAccelerator::Client* client = this; | 518 if (fake_decoder_) { |
| 519 decoder_.reset(new FakeVideoDecodeAccelerator( |
| 520 frame_size_, base::Bind(&DoNothingReturnTrue))); |
| 521 LOG_ASSERT(decoder_->Initialize(profile_, this)); |
| 522 } else { |
| 523 if (!vda_factory_) { |
| 524 vda_factory_ = GpuVideoDecodeAcceleratorFactoryImpl::Create( |
| 525 base::Bind(&RenderingHelper::GetGLContext, |
| 526 base::Unretained(rendering_helper_)), |
| 527 base::Bind(&DoNothingReturnTrue), base::Bind(&DummyBindImage)); |
| 528 LOG_ASSERT(vda_factory_); |
| 529 } |
| 587 | 530 |
| 588 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { | 531 VideoDecodeAccelerator::Config config(profile_); |
| 589 CreateFakeVDA(), | 532 gpu::GpuPreferences gpu_preferences; |
| 590 CreateDXVAVDA(), | 533 decoder_ = vda_factory_->CreateVDA(this, config, gpu_preferences); |
| 591 CreateV4L2VDA(), | 534 } |
| 592 CreateV4L2SliceVDA(), | |
| 593 CreateVaapiVDA(), | |
| 594 }; | |
| 595 | 535 |
| 596 for (size_t i = 0; i < arraysize(decoders); ++i) { | 536 LOG_ASSERT(decoder_) << "Failed creating a VDA"; |
| 597 if (!decoders[i]) | 537 |
| 598 continue; | 538 decoder_->TryToSetupDecodeOnSeparateThread( |
| 599 decoder_ = std::move(decoders[i]); | 539 weak_this_, base::ThreadTaskRunnerHandle::Get()); |
| 600 weak_decoder_factory_.reset( | 540 |
| 601 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); | 541 SetState(CS_DECODER_SET); |
| 602 if (decoder_->Initialize(profile_, client)) { | 542 FinishInitialization(); |
| 603 SetState(CS_DECODER_SET); | |
| 604 FinishInitialization(); | |
| 605 return; | |
| 606 } | |
| 607 } | |
| 608 // Decoders are all initialize failed. | |
| 609 LOG(ERROR) << "VideoDecodeAccelerator::Initialize() failed"; | |
| 610 LOG_ASSERT(false); | |
| 611 } | 543 } |
| 612 | 544 |
| 613 void GLRenderingVDAClient::ProvidePictureBuffers( | 545 void GLRenderingVDAClient::ProvidePictureBuffers( |
| 614 uint32_t requested_num_of_buffers, | 546 uint32_t requested_num_of_buffers, |
| 615 const gfx::Size& dimensions, | 547 const gfx::Size& dimensions, |
| 616 uint32_t texture_target) { | 548 uint32_t texture_target) { |
| 617 if (decoder_deleted()) | 549 if (decoder_deleted()) |
| 618 return; | 550 return; |
| 619 std::vector<media::PictureBuffer> buffers; | 551 std::vector<media::PictureBuffer> buffers; |
| 620 | 552 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 LOG_ASSERT(1U == pending_textures_.erase(picture_buffer_id)); | 636 LOG_ASSERT(1U == pending_textures_.erase(picture_buffer_id)); |
| 705 | 637 |
| 706 if (pending_textures_.empty() && state_ == CS_RESETTING) { | 638 if (pending_textures_.empty() && state_ == CS_RESETTING) { |
| 707 SetState(CS_RESET); | 639 SetState(CS_RESET); |
| 708 DeleteDecoder(); | 640 DeleteDecoder(); |
| 709 return; | 641 return; |
| 710 } | 642 } |
| 711 | 643 |
| 712 if (num_decoded_frames_ > delay_reuse_after_frame_num_) { | 644 if (num_decoded_frames_ > delay_reuse_after_frame_num_) { |
| 713 base::MessageLoop::current()->PostDelayedTask( | 645 base::MessageLoop::current()->PostDelayedTask( |
| 714 FROM_HERE, | 646 FROM_HERE, base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, |
| 715 base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, | 647 weak_vda_, picture_buffer_id), |
| 716 weak_decoder_factory_->GetWeakPtr(), | |
| 717 picture_buffer_id), | |
| 718 kReuseDelay); | 648 kReuseDelay); |
| 719 } else { | 649 } else { |
| 720 decoder_->ReusePictureBuffer(picture_buffer_id); | 650 decoder_->ReusePictureBuffer(picture_buffer_id); |
| 721 } | 651 } |
| 722 } | 652 } |
| 723 | 653 |
| 724 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( | 654 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( |
| 725 int32_t bitstream_buffer_id) { | 655 int32_t bitstream_buffer_id) { |
| 726 // TODO(fischman): this test currently relies on this notification to make | 656 // TODO(fischman): this test currently relies on this notification to make |
| 727 // forward progress during a Reset(). But the VDA::Reset() API doesn't | 657 // 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... |
| 829 } | 759 } |
| 830 | 760 |
| 831 for (int i = 0; i < num_in_flight_decodes_; ++i) | 761 for (int i = 0; i < num_in_flight_decodes_; ++i) |
| 832 DecodeNextFragment(); | 762 DecodeNextFragment(); |
| 833 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); | 763 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); |
| 834 } | 764 } |
| 835 | 765 |
| 836 void GLRenderingVDAClient::DeleteDecoder() { | 766 void GLRenderingVDAClient::DeleteDecoder() { |
| 837 if (decoder_deleted()) | 767 if (decoder_deleted()) |
| 838 return; | 768 return; |
| 839 weak_decoder_factory_.reset(); | 769 weak_vda_ptr_factory_.reset(); |
| 840 decoder_.reset(); | 770 decoder_.reset(); |
| 841 STLClearObject(&encoded_data_); | 771 STLClearObject(&encoded_data_); |
| 842 active_textures_.clear(); | 772 active_textures_.clear(); |
| 843 | 773 |
| 844 // Cascade through the rest of the states to simplify test code below. | 774 // Cascade through the rest of the states to simplify test code below. |
| 845 for (int i = state_ + 1; i < CS_MAX; ++i) | 775 for (int i = state_ + 1; i < CS_MAX; ++i) |
| 846 SetState(static_cast<ClientState>(i)); | 776 SetState(static_cast<ClientState>(i)); |
| 847 } | 777 } |
| 848 | 778 |
| 849 std::string GLRenderingVDAClient::GetBytesForFirstFragment( | 779 std::string GLRenderingVDAClient::GetBytesForFirstFragment( |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 content::VaapiWrapper::PreSandboxInitialization(); | 1574 content::VaapiWrapper::PreSandboxInitialization(); |
| 1645 #endif | 1575 #endif |
| 1646 | 1576 |
| 1647 content::g_env = | 1577 content::g_env = |
| 1648 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( | 1578 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( |
| 1649 testing::AddGlobalTestEnvironment( | 1579 testing::AddGlobalTestEnvironment( |
| 1650 new content::VideoDecodeAcceleratorTestEnvironment())); | 1580 new content::VideoDecodeAcceleratorTestEnvironment())); |
| 1651 | 1581 |
| 1652 return RUN_ALL_TESTS(); | 1582 return RUN_ALL_TESTS(); |
| 1653 } | 1583 } |
| OLD | NEW |