summaryrefslogtreecommitdiff
path: root/chromium/media/gpu/android_video_decode_accelerator.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/media/gpu/android_video_decode_accelerator.h')
-rw-r--r--chromium/media/gpu/android_video_decode_accelerator.h46
1 files changed, 33 insertions, 13 deletions
diff --git a/chromium/media/gpu/android_video_decode_accelerator.h b/chromium/media/gpu/android_video_decode_accelerator.h
index 95962377d62..507dccc867f 100644
--- a/chromium/media/gpu/android_video_decode_accelerator.h
+++ b/chromium/media/gpu/android_video_decode_accelerator.h
@@ -76,8 +76,6 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
void NotifyError(Error error) override;
// AVDACodecAllocatorClient implementation:
- void OnSurfaceAvailable(bool success) override;
- void OnSurfaceDestroyed() override;
void OnCodecConfigured(
std::unique_ptr<MediaCodecBridge> media_codec) override;
@@ -112,12 +110,23 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
// Entry point for configuring / reconfiguring a codec with a new surface.
// Start surface creation by trying to allocate the surface id. Will either
// InitializePictureBufferManager if the surface is available immediately, or
- // will wait for OnSurfaceAvailable to do it. This will transition |state_|
+ // will wait for OnOverlayReady to do it. This will transition |state_|
// to WAITING_FOR_SURFACE or WAITING_FOR_CODEC, as needed (or NO_ERROR if it
// gets the surface and the codec without waiting).
+ // Note that this requires that you create a new |incoming_bundle_| with the
+ // appropriate surface id.
void StartSurfaceCreation();
- // Initialize of the picture buffer manager to use the current surface, once
+ // Called by AndroidOverlay when a surface becomes available.
+ void OnOverlayReady(AndroidOverlay* overlay);
+
+ // Called by AndroidOverlay when the overlay will not call OnOverlayReady.
+ void OnOverlayFailed(AndroidOverlay* overlay);
+
+ // Called by AndroidOverlay when a surface is lost.
+ void OnSurfaceDestroyed(AndroidOverlay* overlay);
+
+ // Initializes the picture buffer manager to use the current surface, once
// it is available. This is not normally called directly, but rather via
// StartSurfaceCreation. If we have a media codec already, then this will
// attempt to setSurface the new surface. Otherwise, it will start codec
@@ -125,6 +134,9 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
// ready even if this succeeds, but async config will be started. If
// setSurface fails, this will not replace the codec. On failure, this will
// transition |state_| to ERROR.
+ // Note that this assumes that there is an |incoming_bundle_| that we'll use.
+ // On success, we'll replace the bundle in |codec_config_|. On failure, we'll
+ // delete the incoming bundle.
void InitializePictureBufferManager();
// A part of destruction process that is sometimes postponed after the drain.
@@ -143,11 +155,6 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
// concern with modifying |codec_config_| after this returns.
void ConfigureMediaCodecSynchronously();
- // Instantiate a media codec using |codec_config|.
- // This may be called on any thread.
- static std::unique_ptr<MediaCodecBridge> ConfigureMediaCodecOnAnyThread(
- scoped_refptr<CodecConfig> codec_config);
-
// Sends the decoded frame specified by |codec_buffer_index| to the client.
void SendDecodedFrameToClient(int32_t codec_buffer_index,
int32_t bitstream_id);
@@ -240,6 +247,16 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
// |picture_buffer_manager_|.
void ReleaseCodec();
+ // Returns the surface ID from the incoming bundle, if we have one, or
+ // the current surface bundle if not. The reasoning is that, if we have an
+ // incoming bundle, then the current (outgoing) one has already been returned
+ // to the codec allocator via DeallocateSurface. The only place this happens
+ // is UpdateSurface, which handles it specially.
+ int surface_id() const {
+ return incoming_bundle_ ? incoming_bundle_->surface_id
+ : codec_config_->surface_bundle->surface_id;
+ }
+
// Used to DCHECK that we are called on the correct thread.
base::ThreadChecker thread_checker_;
@@ -353,13 +370,16 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
// pictures have been rendered in DequeueOutput().
base::Optional<int32_t> pending_surface_id_;
- // The task type used for the last codec release. For posting SurfaceTexture
- // release to the same thread.
- TaskType last_release_task_type_;
-
// Copy of the VDA::Config we were given.
Config config_;
+ // SurfaceBundle that we're going to use for StartSurfaceCreation. This is
+ // separate than the bundle in |codec_config_|, since we can start surface
+ // creation while another codec is using the old surface. For example, if
+ // we're going to SetSurface, then the current codec will depend on the
+ // current bundle until then.
+ scoped_refptr<AVDASurfaceBundle> incoming_bundle_;
+
// WeakPtrFactory for posting tasks back to |this|.
base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_;