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

Unified Diff: media/gpu/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: Dale's comments and disable VP8 on platforms where we do surface teardown Created 4 years, 7 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: media/gpu/android_video_decode_accelerator.h
diff --git a/media/gpu/android_video_decode_accelerator.h b/media/gpu/android_video_decode_accelerator.h
index 5d94987ba30ea82b4b3b4f974c80ee0a38559ac4..16cf8875a952fd09152e79a94fe288bb92921564 100644
--- a/media/gpu/android_video_decode_accelerator.h
+++ b/media/gpu/android_video_decode_accelerator.h
@@ -23,6 +23,7 @@
#include "media/base/android/sdk_media_codec_bridge.h"
#include "media/base/media_keys.h"
#include "media/gpu/avda_state_provider.h"
+#include "media/gpu/avda_surface_tracker.h"
#include "media/gpu/gpu_video_decode_accelerator_helpers.h"
#include "media/gpu/media_gpu_export.h"
#include "media/video/video_decode_accelerator.h"
@@ -164,6 +165,9 @@ class MEDIA_GPU_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 MEDIA_GPU_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 MEDIA_GPU_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_;
« no previous file with comments | « no previous file | media/gpu/android_video_decode_accelerator.cc » ('j') | media/gpu/android_video_decode_accelerator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698