OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/gpu/vt_video_decode_accelerator_mac.h" | 5 #include "media/gpu/vt_video_decode_accelerator_mac.h" |
6 | 6 |
7 #include <CoreVideo/CoreVideo.h> | 7 #include <CoreVideo/CoreVideo.h> |
8 #include <OpenGL/CGLIOSurface.h> | 8 #include <OpenGL/CGLIOSurface.h> |
9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 task_queue_.push(task); | 808 task_queue_.push(task); |
809 ProcessWorkQueues(); | 809 ProcessWorkQueues(); |
810 } | 810 } |
811 | 811 |
812 void VTVideoDecodeAccelerator::FlushTask(TaskType type) { | 812 void VTVideoDecodeAccelerator::FlushTask(TaskType type) { |
813 DVLOG(3) << __func__; | 813 DVLOG(3) << __func__; |
814 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); | 814 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
815 | 815 |
816 FinishDelayedFrames(); | 816 FinishDelayedFrames(); |
817 | 817 |
818 // Always queue a task, even if FinishDelayedFrames() fails, so that | 818 if (type == TASK_DESTROY && session_) { |
819 // destruction always completes. | 819 // Destroy the decoding session before returning from the decoder thread. |
| 820 VTDecompressionSessionInvalidate(session_); |
| 821 session_.reset(); |
| 822 } |
| 823 |
| 824 // Queue a task even if flushing fails, so that destruction always completes. |
820 gpu_task_runner_->PostTask( | 825 gpu_task_runner_->PostTask( |
821 FROM_HERE, | 826 FROM_HERE, |
822 base::Bind(&VTVideoDecodeAccelerator::FlushDone, weak_this_, type)); | 827 base::Bind(&VTVideoDecodeAccelerator::FlushDone, weak_this_, type)); |
823 } | 828 } |
824 | 829 |
825 void VTVideoDecodeAccelerator::FlushDone(TaskType type) { | 830 void VTVideoDecodeAccelerator::FlushDone(TaskType type) { |
826 DVLOG(3) << __func__; | 831 DVLOG(3) << __func__; |
827 DCHECK(gpu_task_runner_->BelongsToCurrentThread()); | 832 DCHECK(gpu_task_runner_->BelongsToCurrentThread()); |
828 task_queue_.push(Task(type)); | 833 task_queue_.push(Task(type)); |
829 ProcessWorkQueues(); | 834 ProcessWorkQueues(); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 SupportedProfile profile; | 1179 SupportedProfile profile; |
1175 profile.profile = supported_profile; | 1180 profile.profile = supported_profile; |
1176 profile.min_resolution.SetSize(16, 16); | 1181 profile.min_resolution.SetSize(16, 16); |
1177 profile.max_resolution.SetSize(4096, 2160); | 1182 profile.max_resolution.SetSize(4096, 2160); |
1178 profiles.push_back(profile); | 1183 profiles.push_back(profile); |
1179 } | 1184 } |
1180 return profiles; | 1185 return profiles; |
1181 } | 1186 } |
1182 | 1187 |
1183 } // namespace media | 1188 } // namespace media |
OLD | NEW |