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 fd99ebc0ff8a7ca2e74a4bd047c212cbbece37d8..4c4c5e82bb73049f8d043f8b70d23660702ab4df 100644 |
--- a/media/gpu/android_video_decode_accelerator.h |
+++ b/media/gpu/android_video_decode_accelerator.h |
@@ -371,6 +371,10 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator |
// have safer versions elsewhere. |
bool IsMediaCodecSoftwareDecodingForbidden() const; |
+ // Closes idle MediaCodec instances if no Decode() call is received within a |
+ // few seconds. |
+ void CloseIdleCodec(); |
+ |
// Used to DCHECK that we are called on the correct thread. |
base::ThreadChecker thread_checker_; |
@@ -484,6 +488,11 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator |
OnDestroyingSurfaceCallback on_destroying_surface_cb_; |
+ // Timer used to destroy the MediaCodec if no Decode() call is received after |
+ // some period of idle activity. This prevents older devices from falling over |
+ // when too many MediaCodec instances are outstanding. |
+ base::OneShotTimer no_decode_timeout_; |
+ |
// WeakPtrFactory for posting tasks back to |this|. |
base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |