Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Unified Diff: content/common/gpu/media/android_video_decode_accelerator.h

Issue 1920093003: media: Handle output SurfaceView destruction in AVDA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@svteardown
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/android_video_decode_accelerator.h
diff --git a/content/common/gpu/media/android_video_decode_accelerator.h b/content/common/gpu/media/android_video_decode_accelerator.h
index dec3efcbe72adf12ce8003c884fb6aaf9e42a90d..c8cc04ded950ce104444c915496233d19a70c917 100644
--- a/content/common/gpu/media/android_video_decode_accelerator.h
+++ b/content/common/gpu/media/android_video_decode_accelerator.h
@@ -19,6 +19,7 @@
#include "base/timer/timer.h"
#include "content/common/content_export.h"
#include "content/common/gpu/media/avda_state_provider.h"
+#include "content/common/gpu/media/avda_surface_tracker.h"
#include "content/common/gpu/media/gpu_video_decode_accelerator_helpers.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/gpu_preferences.h"
@@ -164,6 +165,9 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator
WAITING_FOR_CODEC,
// Set when we have a codec, but it doesn't yet have a key.
WAITING_FOR_KEY,
+ // The output surface was destroyed. We must not configure a new MediaCodec
+ // with the destroyed surface.
+ SURFACE_DESTROYED,
};
enum DrainType {
@@ -318,6 +322,11 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator
// can be a null callback.
void ResetCodecState(const base::Closure& done_cb);
+ // Registered to be called when surfaces are being destroyed. If |surface_id|
+ // is our surface, we should release the MediaCodec before returning from
+ // this.
+ void OnDestroyingSurface(int surface_id);
+
// Return true if and only if we should use deferred rendering.
static bool UseDeferredRenderingStrategy(
const gpu::GpuPreferences& gpu_preferences);
@@ -416,6 +425,10 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator
// called NotifyInitializationComplete.
bool deferred_initialization_pending_;
+ int surface_id_;
+
+ OnDestroyingSurfaceCallback on_destroying_surface_cb_;
+
// WeakPtrFactory for posting tasks back to |this|.
base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_;

Powered by Google App Engine
This is Rietveld 408576698