| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // Notify |surface_chooser_| that we've started. This guarantees that we'll | 420 // Notify |surface_chooser_| that we've started. This guarantees that we'll |
| 421 // get a callback. It might not be a synchronous callback, but we're not in | 421 // get a callback. It might not be a synchronous callback, but we're not in |
| 422 // the synchronous case. It will be soon, though. For pre-M, we rely on the | 422 // the synchronous case. It will be soon, though. For pre-M, we rely on the |
| 423 // fact that |surface_chooser_| won't tell us to use a SurfaceTexture while | 423 // fact that |surface_chooser_| won't tell us to use a SurfaceTexture while |
| 424 // waiting for an overlay to become ready, for example. | 424 // waiting for an overlay to become ready, for example. |
| 425 surface_chooser_->Initialize( | 425 surface_chooser_->Initialize( |
| 426 base::Bind(&AndroidVideoDecodeAccelerator::OnSurfaceTransition, | 426 base::Bind(&AndroidVideoDecodeAccelerator::OnSurfaceTransition, |
| 427 weak_this_factory_.GetWeakPtr()), | 427 weak_this_factory_.GetWeakPtr()), |
| 428 base::Bind(&AndroidVideoDecodeAccelerator::OnSurfaceTransition, | 428 base::Bind(&AndroidVideoDecodeAccelerator::OnSurfaceTransition, |
| 429 weak_this_factory_.GetWeakPtr(), nullptr), | 429 weak_this_factory_.GetWeakPtr(), nullptr), |
| 430 base::Bind(&AndroidVideoDecodeAccelerator::OnStopUsingOverlayImmediately, | |
| 431 weak_this_factory_.GetWeakPtr()), | |
| 432 std::move(factory)); | 430 std::move(factory)); |
| 433 } | 431 } |
| 434 | 432 |
| 435 void AndroidVideoDecodeAccelerator::OnSurfaceTransition( | 433 void AndroidVideoDecodeAccelerator::OnSurfaceTransition( |
| 436 std::unique_ptr<AndroidOverlay> overlay) { | 434 std::unique_ptr<AndroidOverlay> overlay) { |
| 435 if (overlay) { |
| 436 overlay->AddSurfaceDestroyedCallback(base::Bind( |
| 437 &AndroidVideoDecodeAccelerator::OnStopUsingOverlayImmediately, |
| 438 weak_this_factory_.GetWeakPtr())); |
| 439 } |
| 440 |
| 437 // If we're waiting for a surface (e.g., during startup), then proceed | 441 // If we're waiting for a surface (e.g., during startup), then proceed |
| 438 // immediately. Otherwise, wait for Dequeue to handle it. This can probably | 442 // immediately. Otherwise, wait for Dequeue to handle it. This can probably |
| 439 // be merged with UpdateSurface. | 443 // be merged with UpdateSurface. |
| 440 if (state_ == BEFORE_OVERLAY_INIT) { | 444 if (state_ == BEFORE_OVERLAY_INIT) { |
| 441 DCHECK(!incoming_overlay_); | 445 DCHECK(!incoming_overlay_); |
| 442 incoming_bundle_ = new AVDASurfaceBundle(std::move(overlay)); | 446 incoming_bundle_ = new AVDASurfaceBundle(std::move(overlay)); |
| 443 InitializePictureBufferManager(); | 447 InitializePictureBufferManager(); |
| 444 return; | 448 return; |
| 445 } | 449 } |
| 446 | 450 |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 codec_allocator_->ReleaseMediaCodec(std::move(media_codec_), | 1684 codec_allocator_->ReleaseMediaCodec(std::move(media_codec_), |
| 1681 codec_config_->surface_bundle); | 1685 codec_config_->surface_bundle); |
| 1682 } | 1686 } |
| 1683 | 1687 |
| 1684 void AndroidVideoDecodeAccelerator::ReleaseCodecAndBundle() { | 1688 void AndroidVideoDecodeAccelerator::ReleaseCodecAndBundle() { |
| 1685 ReleaseCodec(); | 1689 ReleaseCodec(); |
| 1686 codec_config_->surface_bundle = nullptr; | 1690 codec_config_->surface_bundle = nullptr; |
| 1687 } | 1691 } |
| 1688 | 1692 |
| 1689 } // namespace media | 1693 } // namespace media |
| OLD | NEW |