| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "media/gpu/android_video_decode_accelerator.h" | 5 #include "media/gpu/android_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 vda_.reset(avda); | 330 vda_.reset(avda); |
| 331 | 331 |
| 332 bool result = vda_->Initialize(config_, &client_); | 332 bool result = vda_->Initialize(config_, &client_); |
| 333 base::RunLoop().RunUntilIdle(); | 333 base::RunLoop().RunUntilIdle(); |
| 334 return result; | 334 return result; |
| 335 } | 335 } |
| 336 | 336 |
| 337 // Initialize |vda_|, providing a new surface for it. You may get the surface | 337 // Initialize |vda_|, providing a new surface for it. You may get the surface |
| 338 // by asking |codec_allocator_|. | 338 // by asking |codec_allocator_|. |
| 339 void InitializeAVDAWithOverlay() { | 339 void InitializeAVDAWithOverlay() { |
| 340 config_.surface_id = 123; | 340 config_.overlay_info.surface_id = 123; |
| 341 ASSERT_TRUE(InitializeAVDA()); | 341 ASSERT_TRUE(InitializeAVDA()); |
| 342 base::RunLoop().RunUntilIdle(); | 342 base::RunLoop().RunUntilIdle(); |
| 343 ASSERT_TRUE(chooser_->factory_); | 343 ASSERT_TRUE(chooser_->factory_); |
| 344 | 344 |
| 345 // Have the factory provide an overlay, and verify that codec creation is | 345 // Have the factory provide an overlay, and verify that codec creation is |
| 346 // provided with that overlay. | 346 // provided with that overlay. |
| 347 std::unique_ptr<MockAndroidOverlay> overlay = | 347 std::unique_ptr<MockAndroidOverlay> overlay = |
| 348 base::MakeUnique<MockAndroidOverlay>(); | 348 base::MakeUnique<MockAndroidOverlay>(); |
| 349 overlay_callbacks_ = overlay->GetCallbacks(); | 349 overlay_callbacks_ = overlay->GetCallbacks(); |
| 350 | 350 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 LowEndDevicesSucceedInitWithoutASurface) { | 480 LowEndDevicesSucceedInitWithoutASurface) { |
| 481 // If AVDA decides that we should defer surface creation, then it should | 481 // If AVDA decides that we should defer surface creation, then it should |
| 482 // signal success before we provide a surface. It should still ask for a | 482 // signal success before we provide a surface. It should still ask for a |
| 483 // surface, though. | 483 // surface, though. |
| 484 SKIP_IF_MEDIACODEC_IS_NOT_AVAILABLE(); | 484 SKIP_IF_MEDIACODEC_IS_NOT_AVAILABLE(); |
| 485 | 485 |
| 486 // It would be nicer if we didn't just force this on, since we might do so | 486 // It would be nicer if we didn't just force this on, since we might do so |
| 487 // in a state that AVDA isn't supposed to handle (e.g., if we give it a | 487 // in a state that AVDA isn't supposed to handle (e.g., if we give it a |
| 488 // surface, then it would never decide to defer surface creation). | 488 // surface, then it would never decide to defer surface creation). |
| 489 platform_config_.force_deferred_surface_creation = true; | 489 platform_config_.force_deferred_surface_creation = true; |
| 490 config_.surface_id = SurfaceManager::kNoSurfaceID; | 490 config_.overlay_info.surface_id = SurfaceManager::kNoSurfaceID; |
| 491 | 491 |
| 492 EXPECT_CALL(*chooser_, MockInitialize()).Times(0); | 492 EXPECT_CALL(*chooser_, MockInitialize()).Times(0); |
| 493 EXPECT_CALL(client_, NotifyInitializationComplete(true)); | 493 EXPECT_CALL(client_, NotifyInitializationComplete(true)); |
| 494 | 494 |
| 495 InitializeAVDA(); | 495 InitializeAVDA(); |
| 496 } | 496 } |
| 497 | 497 |
| 498 TEST_F(AndroidVideoDecodeAcceleratorTest, | 498 TEST_F(AndroidVideoDecodeAcceleratorTest, |
| 499 AsyncInitWithSurfaceTextureAndDelete) { | 499 AsyncInitWithSurfaceTextureAndDelete) { |
| 500 // When configuring with a SurfaceTexture and deferred init, we should be | 500 // When configuring with a SurfaceTexture and deferred init, we should be |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 | 685 |
| 686 InitializeAVDAWithSurfaceTexture(); | 686 InitializeAVDAWithSurfaceTexture(); |
| 687 | 687 |
| 688 // This should do nothing. | 688 // This should do nothing. |
| 689 EXPECT_CALL(*codec_allocator_.most_recent_codec(), SetSurface(_)).Times(0); | 689 EXPECT_CALL(*codec_allocator_.most_recent_codec(), SetSurface(_)).Times(0); |
| 690 chooser_->ProvideSurfaceTexture(); | 690 chooser_->ProvideSurfaceTexture(); |
| 691 | 691 |
| 692 base::RunLoop().RunUntilIdle(); | 692 base::RunLoop().RunUntilIdle(); |
| 693 } | 693 } |
| 694 | 694 |
| 695 TEST_F(AndroidVideoDecodeAcceleratorTest, |
| 696 OverlayInfoWithoutFactoryInfoDoesntChangeTheSurface) { |
| 697 // Send OverlayInfo without surface id / routing token, and verify that AVDA |
| 698 // doesn't try to change the factory. |
| 699 InitializeAVDAWithOverlay(); |
| 700 |
| 701 EXPECT_CALL(*chooser_, MockReplaceOverlayFactory()).Times(0); |
| 702 avda()->SetOverlayInfo(OverlayInfo()); |
| 703 } |
| 704 |
| 695 } // namespace media | 705 } // namespace media |
| OLD | NEW |