| 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" |
| 52 #include "content/public/common/content_switches.h" | 53 #include "content/public/common/content_switches.h" |
| 54 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 53 #include "media/filters/h264_parser.h" | 55 #include "media/filters/h264_parser.h" |
| 54 #include "testing/gtest/include/gtest/gtest.h" | 56 #include "testing/gtest/include/gtest/gtest.h" |
| 55 #include "ui/gfx/codec/png_codec.h" | 57 #include "ui/gfx/codec/png_codec.h" |
| 56 #include "ui/gl/gl_image.h" | 58 #include "ui/gl/gl_image.h" |
| 57 | 59 |
| 58 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 59 #include "base/win/windows_version.h" | 61 #include "base/win/windows_version.h" |
| 60 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" | 62 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" |
| 61 #elif defined(OS_CHROMEOS) | 63 #elif defined(OS_CHROMEOS) |
| 62 #if defined(USE_V4L2_CODEC) | 64 #if defined(USE_V4L2_CODEC) |
| (...skipping 289 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 | |
| 372 void SetState(ClientState new_state); | 364 void SetState(ClientState new_state); |
| 373 void FinishInitialization(); | 365 void FinishInitialization(); |
| 374 void ReturnPicture(int32_t picture_buffer_id); | 366 void ReturnPicture(int32_t picture_buffer_id); |
| 375 | 367 |
| 376 // Delete the associated decoder helper. | 368 // Delete the associated decoder helper. |
| 377 void DeleteDecoder(); | 369 void DeleteDecoder(); |
| 378 | 370 |
| 379 // 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 |
| 380 // 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 |
| 381 // to the first decodable position. | 373 // to the first decodable position. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 394 size_t window_id_; | 386 size_t window_id_; |
| 395 RenderingHelper* rendering_helper_; | 387 RenderingHelper* rendering_helper_; |
| 396 gfx::Size frame_size_; | 388 gfx::Size frame_size_; |
| 397 std::string encoded_data_; | 389 std::string encoded_data_; |
| 398 const int num_in_flight_decodes_; | 390 const int num_in_flight_decodes_; |
| 399 int outstanding_decodes_; | 391 int outstanding_decodes_; |
| 400 size_t encoded_data_next_pos_to_decode_; | 392 size_t encoded_data_next_pos_to_decode_; |
| 401 int next_bitstream_buffer_id_; | 393 int next_bitstream_buffer_id_; |
| 402 ClientStateNotification<ClientState>* note_; | 394 ClientStateNotification<ClientState>* note_; |
| 403 scoped_ptr<VideoDecodeAccelerator> decoder_; | 395 scoped_ptr<VideoDecodeAccelerator> decoder_; |
| 404 scoped_ptr<base::WeakPtrFactory<VideoDecodeAccelerator> > | 396 base::WeakPtr<VideoDecodeAccelerator> weak_vda_; |
| 405 weak_decoder_factory_; | 397 scoped_ptr<base::WeakPtrFactory<VideoDecodeAccelerator>> |
| 398 weak_vda_ptr_factory_; |
| 399 scoped_ptr<GpuVideoDecodeAcceleratorFactory> vda_factory_; |
| 406 int remaining_play_throughs_; | 400 int remaining_play_throughs_; |
| 407 int reset_after_frame_num_; | 401 int reset_after_frame_num_; |
| 408 int delete_decoder_state_; | 402 int delete_decoder_state_; |
| 409 ClientState state_; | 403 ClientState state_; |
| 410 int num_skipped_fragments_; | 404 int num_skipped_fragments_; |
| 411 int num_queued_fragments_; | 405 int num_queued_fragments_; |
| 412 int num_decoded_frames_; | 406 int num_decoded_frames_; |
| 413 int num_done_bitstream_buffers_; | 407 int num_done_bitstream_buffers_; |
| 414 base::TimeTicks initialize_done_ticks_; | 408 base::TimeTicks initialize_done_ticks_; |
| 415 media::VideoCodecProfile profile_; | 409 media::VideoCodecProfile profile_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 433 // textures. | 427 // textures. |
| 434 TextureRefMap active_textures_; | 428 TextureRefMap active_textures_; |
| 435 | 429 |
| 436 // 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. |
| 437 // 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 |
| 438 // CS_RESET_State. | 432 // CS_RESET_State. |
| 439 TextureRefMap pending_textures_; | 433 TextureRefMap pending_textures_; |
| 440 | 434 |
| 441 int32_t next_picture_buffer_id_; | 435 int32_t next_picture_buffer_id_; |
| 442 | 436 |
| 437 base::WeakPtr<GLRenderingVDAClient> weak_this_; |
| 438 base::WeakPtrFactory<GLRenderingVDAClient> weak_this_factory_; |
| 439 |
| 443 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); | 440 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); |
| 444 }; | 441 }; |
| 445 | 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 return true; |
| 451 } |
| 452 |
| 446 GLRenderingVDAClient::GLRenderingVDAClient( | 453 GLRenderingVDAClient::GLRenderingVDAClient( |
| 447 size_t window_id, | 454 size_t window_id, |
| 448 RenderingHelper* rendering_helper, | 455 RenderingHelper* rendering_helper, |
| 449 ClientStateNotification<ClientState>* note, | 456 ClientStateNotification<ClientState>* note, |
| 450 const std::string& encoded_data, | 457 const std::string& encoded_data, |
| 451 int num_in_flight_decodes, | 458 int num_in_flight_decodes, |
| 452 int num_play_throughs, | 459 int num_play_throughs, |
| 453 int reset_after_frame_num, | 460 int reset_after_frame_num, |
| 454 int delete_decoder_state, | 461 int delete_decoder_state, |
| 455 int frame_width, | 462 int frame_width, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 476 num_skipped_fragments_(0), | 483 num_skipped_fragments_(0), |
| 477 num_queued_fragments_(0), | 484 num_queued_fragments_(0), |
| 478 num_decoded_frames_(0), | 485 num_decoded_frames_(0), |
| 479 num_done_bitstream_buffers_(0), | 486 num_done_bitstream_buffers_(0), |
| 480 fake_decoder_(fake_decoder), | 487 fake_decoder_(fake_decoder), |
| 481 texture_target_(0), | 488 texture_target_(0), |
| 482 suppress_rendering_(suppress_rendering), | 489 suppress_rendering_(suppress_rendering), |
| 483 delay_reuse_after_frame_num_(delay_reuse_after_frame_num), | 490 delay_reuse_after_frame_num_(delay_reuse_after_frame_num), |
| 484 decode_calls_per_second_(decode_calls_per_second), | 491 decode_calls_per_second_(decode_calls_per_second), |
| 485 render_as_thumbnails_(render_as_thumbnails), | 492 render_as_thumbnails_(render_as_thumbnails), |
| 486 next_picture_buffer_id_(1) { | 493 next_picture_buffer_id_(1), |
| 494 weak_this_factory_(this) { |
| 487 LOG_ASSERT(num_in_flight_decodes > 0); | 495 LOG_ASSERT(num_in_flight_decodes > 0); |
| 488 LOG_ASSERT(num_play_throughs > 0); | 496 LOG_ASSERT(num_play_throughs > 0); |
| 489 // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0. | 497 // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0. |
| 490 if (decode_calls_per_second_ > 0) | 498 if (decode_calls_per_second_ > 0) |
| 491 LOG_ASSERT(1 == num_in_flight_decodes_); | 499 LOG_ASSERT(1 == num_in_flight_decodes_); |
| 492 | 500 |
| 493 // Default to H264 baseline if no profile provided. | 501 // Default to H264 baseline if no profile provided. |
| 494 profile_ = (profile != media::VIDEO_CODEC_PROFILE_UNKNOWN | 502 profile_ = (profile != media::VIDEO_CODEC_PROFILE_UNKNOWN |
| 495 ? profile | 503 ? profile |
| 496 : media::H264PROFILE_BASELINE); | 504 : media::H264PROFILE_BASELINE); |
| 505 |
| 506 weak_this_ = weak_this_factory_.GetWeakPtr(); |
| 497 } | 507 } |
| 498 | 508 |
| 499 GLRenderingVDAClient::~GLRenderingVDAClient() { | 509 GLRenderingVDAClient::~GLRenderingVDAClient() { |
| 500 DeleteDecoder(); // Clean up in case of expected error. | 510 DeleteDecoder(); // Clean up in case of expected error. |
| 501 LOG_ASSERT(decoder_deleted()); | 511 LOG_ASSERT(decoder_deleted()); |
| 502 SetState(CS_DESTROYED); | 512 SetState(CS_DESTROYED); |
| 503 } | 513 } |
| 504 | 514 |
| 505 static bool DoNothingReturnTrue() { return true; } | |
| 506 | |
| 507 scoped_ptr<media::VideoDecodeAccelerator> | |
| 508 GLRenderingVDAClient::CreateFakeVDA() { | |
| 509 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 510 if (fake_decoder_) { | |
| 511 decoder.reset(new FakeVideoDecodeAccelerator( | |
| 512 static_cast<gfx::GLContext*> (rendering_helper_->GetGLContextHandle()), | |
| 513 frame_size_, | |
| 514 base::Bind(&DoNothingReturnTrue))); | |
| 515 } | |
| 516 return decoder; | |
| 517 } | |
| 518 | |
| 519 scoped_ptr<media::VideoDecodeAccelerator> | |
| 520 GLRenderingVDAClient::CreateDXVAVDA() { | |
| 521 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 522 #if defined(OS_WIN) | |
| 523 if (base::win::GetVersion() >= base::win::VERSION_WIN7) { | |
| 524 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 525 const bool enable_accelerated_vpx_decode = | |
| 526 cmd_line->HasSwitch(switches::kEnableAcceleratedVpxDecode); | |
| 527 decoder.reset(new DXVAVideoDecodeAccelerator( | |
| 528 base::Bind(&DoNothingReturnTrue), | |
| 529 rendering_helper_->GetGLContext().get(), | |
| 530 enable_accelerated_vpx_decode)); | |
| 531 } | |
| 532 #endif | |
| 533 return decoder; | |
| 534 } | |
| 535 | |
| 536 scoped_ptr<media::VideoDecodeAccelerator> | |
| 537 GLRenderingVDAClient::CreateV4L2VDA() { | |
| 538 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 539 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
| 540 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | |
| 541 if (device.get()) { | |
| 542 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr(); | |
| 543 decoder.reset(new V4L2VideoDecodeAccelerator( | |
| 544 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | |
| 545 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | |
| 546 weak_client, base::Bind(&DoNothingReturnTrue), device, | |
| 547 base::ThreadTaskRunnerHandle::Get())); | |
| 548 } | |
| 549 #endif | |
| 550 return decoder; | |
| 551 } | |
| 552 | |
| 553 scoped_ptr<media::VideoDecodeAccelerator> | |
| 554 GLRenderingVDAClient::CreateV4L2SliceVDA() { | |
| 555 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 556 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
| 557 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | |
| 558 if (device.get()) { | |
| 559 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr(); | |
| 560 decoder.reset(new V4L2SliceVideoDecodeAccelerator( | |
| 561 device, static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | |
| 562 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | |
| 563 weak_client, base::Bind(&DoNothingReturnTrue), | |
| 564 base::ThreadTaskRunnerHandle::Get())); | |
| 565 } | |
| 566 #endif | |
| 567 return decoder; | |
| 568 } | |
| 569 | |
| 570 scoped_ptr<media::VideoDecodeAccelerator> | |
| 571 GLRenderingVDAClient::CreateVaapiVDA() { | |
| 572 scoped_ptr<media::VideoDecodeAccelerator> decoder; | |
| 573 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | |
| 574 decoder.reset(new VaapiVideoDecodeAccelerator( | |
| 575 base::Bind(&DoNothingReturnTrue), | |
| 576 base::Bind(&GLRenderingVDAClient::BindImage, base::Unretained(this)))); | |
| 577 #endif | |
| 578 return decoder; | |
| 579 } | |
| 580 | |
| 581 void GLRenderingVDAClient::BindImage(uint32_t client_texture_id, | |
| 582 uint32_t texture_target, | |
| 583 scoped_refptr<gl::GLImage> image) {} | |
| 584 | |
| 585 void GLRenderingVDAClient::CreateAndStartDecoder() { | 515 void GLRenderingVDAClient::CreateAndStartDecoder() { |
| 586 LOG_ASSERT(decoder_deleted()); | 516 LOG_ASSERT(decoder_deleted()); |
| 587 LOG_ASSERT(!decoder_.get()); | 517 LOG_ASSERT(!decoder_.get()); |
| 588 | 518 |
| 589 VideoDecodeAccelerator::Client* client = this; | 519 if (fake_decoder_) { |
| 520 decoder_.reset(new FakeVideoDecodeAccelerator( |
| 521 frame_size_, base::Bind(&DoNothingReturnTrue))); |
| 522 LOG_ASSERT(decoder_->Initialize(profile_, this)); |
| 523 } else { |
| 524 if (!vda_factory_) { |
| 525 vda_factory_ = GpuVideoDecodeAcceleratorFactoryImpl::Create( |
| 526 base::Bind(&RenderingHelper::GetGLContext, |
| 527 base::Unretained(rendering_helper_)), |
| 528 base::Bind(&DoNothingReturnTrue), base::Bind(&DummyBindImage)); |
| 529 LOG_ASSERT(vda_factory_); |
| 530 } |
| 590 | 531 |
| 591 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { | 532 VideoDecodeAccelerator::Config config(profile_); |
| 592 CreateFakeVDA(), | 533 gpu::GpuPreferences gpu_preferences; |
| 593 CreateDXVAVDA(), | 534 #if defined(OS_WIN) |
| 594 CreateV4L2VDA(), | 535 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 595 CreateV4L2SliceVDA(), | 536 gpu_preferences.enable_accelerated_vpx_decode = |
| 596 CreateVaapiVDA(), | 537 cmd_line->HasSwitch(switches::kEnableAcceleratedVpxDecode); |
| 597 }; | 538 #endif |
| 539 decoder_ = vda_factory_->CreateVDA(this, config, gpu_preferences); |
| 540 } |
| 598 | 541 |
| 599 for (size_t i = 0; i < arraysize(decoders); ++i) { | 542 LOG_ASSERT(decoder_) << "Failed creating a VDA"; |
| 600 if (!decoders[i]) | 543 |
| 601 continue; | 544 decoder_->TryToSetupDecodeOnSeparateThread( |
| 602 decoder_ = std::move(decoders[i]); | 545 weak_this_, base::ThreadTaskRunnerHandle::Get()); |
| 603 weak_decoder_factory_.reset( | 546 |
| 604 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); | 547 SetState(CS_DECODER_SET); |
| 605 if (decoder_->Initialize(profile_, client)) { | 548 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 } | 549 } |
| 615 | 550 |
| 616 void GLRenderingVDAClient::ProvidePictureBuffers( | 551 void GLRenderingVDAClient::ProvidePictureBuffers( |
| 617 uint32_t requested_num_of_buffers, | 552 uint32_t requested_num_of_buffers, |
| 618 const gfx::Size& dimensions, | 553 const gfx::Size& dimensions, |
| 619 uint32_t texture_target) { | 554 uint32_t texture_target) { |
| 620 if (decoder_deleted()) | 555 if (decoder_deleted()) |
| 621 return; | 556 return; |
| 622 std::vector<media::PictureBuffer> buffers; | 557 std::vector<media::PictureBuffer> buffers; |
| 623 | 558 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 LOG_ASSERT(1U == pending_textures_.erase(picture_buffer_id)); | 642 LOG_ASSERT(1U == pending_textures_.erase(picture_buffer_id)); |
| 708 | 643 |
| 709 if (pending_textures_.empty() && state_ == CS_RESETTING) { | 644 if (pending_textures_.empty() && state_ == CS_RESETTING) { |
| 710 SetState(CS_RESET); | 645 SetState(CS_RESET); |
| 711 DeleteDecoder(); | 646 DeleteDecoder(); |
| 712 return; | 647 return; |
| 713 } | 648 } |
| 714 | 649 |
| 715 if (num_decoded_frames_ > delay_reuse_after_frame_num_) { | 650 if (num_decoded_frames_ > delay_reuse_after_frame_num_) { |
| 716 base::MessageLoop::current()->PostDelayedTask( | 651 base::MessageLoop::current()->PostDelayedTask( |
| 717 FROM_HERE, | 652 FROM_HERE, base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, |
| 718 base::Bind(&VideoDecodeAccelerator::ReusePictureBuffer, | 653 weak_vda_, picture_buffer_id), |
| 719 weak_decoder_factory_->GetWeakPtr(), | |
| 720 picture_buffer_id), | |
| 721 kReuseDelay); | 654 kReuseDelay); |
| 722 } else { | 655 } else { |
| 723 decoder_->ReusePictureBuffer(picture_buffer_id); | 656 decoder_->ReusePictureBuffer(picture_buffer_id); |
| 724 } | 657 } |
| 725 } | 658 } |
| 726 | 659 |
| 727 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( | 660 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( |
| 728 int32_t bitstream_buffer_id) { | 661 int32_t bitstream_buffer_id) { |
| 729 // TODO(fischman): this test currently relies on this notification to make | 662 // TODO(fischman): this test currently relies on this notification to make |
| 730 // forward progress during a Reset(). But the VDA::Reset() API doesn't | 663 // 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... |
| 832 } | 765 } |
| 833 | 766 |
| 834 for (int i = 0; i < num_in_flight_decodes_; ++i) | 767 for (int i = 0; i < num_in_flight_decodes_; ++i) |
| 835 DecodeNextFragment(); | 768 DecodeNextFragment(); |
| 836 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); | 769 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); |
| 837 } | 770 } |
| 838 | 771 |
| 839 void GLRenderingVDAClient::DeleteDecoder() { | 772 void GLRenderingVDAClient::DeleteDecoder() { |
| 840 if (decoder_deleted()) | 773 if (decoder_deleted()) |
| 841 return; | 774 return; |
| 842 weak_decoder_factory_.reset(); | 775 weak_vda_ptr_factory_.reset(); |
| 843 decoder_.reset(); | 776 decoder_.reset(); |
| 844 STLClearObject(&encoded_data_); | 777 STLClearObject(&encoded_data_); |
| 845 active_textures_.clear(); | 778 active_textures_.clear(); |
| 846 | 779 |
| 847 // Cascade through the rest of the states to simplify test code below. | 780 // Cascade through the rest of the states to simplify test code below. |
| 848 for (int i = state_ + 1; i < CS_MAX; ++i) | 781 for (int i = state_ + 1; i < CS_MAX; ++i) |
| 849 SetState(static_cast<ClientState>(i)); | 782 SetState(static_cast<ClientState>(i)); |
| 850 } | 783 } |
| 851 | 784 |
| 852 std::string GLRenderingVDAClient::GetBytesForFirstFragment( | 785 std::string GLRenderingVDAClient::GetBytesForFirstFragment( |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 content::VaapiWrapper::PreSandboxInitialization(); | 1580 content::VaapiWrapper::PreSandboxInitialization(); |
| 1648 #endif | 1581 #endif |
| 1649 | 1582 |
| 1650 content::g_env = | 1583 content::g_env = |
| 1651 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( | 1584 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( |
| 1652 testing::AddGlobalTestEnvironment( | 1585 testing::AddGlobalTestEnvironment( |
| 1653 new content::VideoDecodeAcceleratorTestEnvironment())); | 1586 new content::VideoDecodeAcceleratorTestEnvironment())); |
| 1654 | 1587 |
| 1655 return RUN_ALL_TESTS(); | 1588 return RUN_ALL_TESTS(); |
| 1656 } | 1589 } |
| OLD | NEW |