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 e9a6ae30181bd19ce66ea44bf14655d079a4a587..658c2304aa4b95d4c143bf13e9fcaf194035dfc3 100644 |
--- a/media/gpu/android_video_decode_accelerator.h |
+++ b/media/gpu/android_video_decode_accelerator.h |
@@ -326,6 +326,12 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator |
// start the timer. Calling it with false may stop the timer. |
void ManageTimer(bool did_work); |
+ // Safely clear |media_codec_|. Do this instead of calling reset() / assign. |
+ // Otherwise, the destructor can hang if mediaserver is in a bad state. This |
+ // will release immediately if safe, else post to a separate thread. Either |
+ // way, |media_codec_| will be null upon return. |
+ void ReleaseMediaCodec(); |
+ |
// Start the MediaCodec drain process by adding end_of_stream() buffer to the |
// encoded buffers queue. When we receive EOS from the output buffer the drain |
// process completes and we perform the action depending on the |drain_type|. |