Index: media/gpu/vt_video_decode_accelerator_mac.cc |
diff --git a/media/gpu/vt_video_decode_accelerator_mac.cc b/media/gpu/vt_video_decode_accelerator_mac.cc |
index e179548de9bcfbc483f1f696cd9b3e02a5b99bef..f79b2da9118d6d4bce9ff7e891ee36e11c402c2a 100644 |
--- a/media/gpu/vt_video_decode_accelerator_mac.cc |
+++ b/media/gpu/vt_video_decode_accelerator_mac.cc |
@@ -815,8 +815,13 @@ void VTVideoDecodeAccelerator::FlushTask(TaskType type) { |
FinishDelayedFrames(); |
- // Always queue a task, even if FinishDelayedFrames() fails, so that |
- // destruction always completes. |
+ if (type == TASK_DESTROY && session_) { |
+ // Destroy the decoding session before returning from the decoder thread. |
+ VTDecompressionSessionInvalidate(session_); |
+ session_.reset(); |
+ } |
+ |
+ // Queue a task even if flushing fails, so that destruction always completes. |
gpu_task_runner_->PostTask( |
FROM_HERE, |
base::Bind(&VTVideoDecodeAccelerator::FlushDone, weak_this_, type)); |