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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 VTVideoDecodeAccelerator::Frame::Frame(int32_t bitstream_id) | 276 VTVideoDecodeAccelerator::Frame::Frame(int32_t bitstream_id) |
277 : bitstream_id(bitstream_id) {} | 277 : bitstream_id(bitstream_id) {} |
278 | 278 |
279 VTVideoDecodeAccelerator::Frame::~Frame() {} | 279 VTVideoDecodeAccelerator::Frame::~Frame() {} |
280 | 280 |
281 VTVideoDecodeAccelerator::PictureInfo::PictureInfo(uint32_t client_texture_id, | 281 VTVideoDecodeAccelerator::PictureInfo::PictureInfo(uint32_t client_texture_id, |
282 uint32_t service_texture_id) | 282 uint32_t service_texture_id) |
283 : client_texture_id(client_texture_id), | 283 : client_texture_id(client_texture_id), |
284 service_texture_id(service_texture_id) {} | 284 service_texture_id(service_texture_id) {} |
285 | 285 |
286 VTVideoDecodeAccelerator::PictureInfo::~PictureInfo() { | 286 VTVideoDecodeAccelerator::PictureInfo::~PictureInfo() {} |
287 if (gl_image) | |
288 gl_image->Destroy(false); | |
289 } | |
290 | 287 |
291 bool VTVideoDecodeAccelerator::FrameOrder::operator()( | 288 bool VTVideoDecodeAccelerator::FrameOrder::operator()( |
292 const linked_ptr<Frame>& lhs, | 289 const linked_ptr<Frame>& lhs, |
293 const linked_ptr<Frame>& rhs) const { | 290 const linked_ptr<Frame>& rhs) const { |
294 // TODO(sandersd): When it is provided, use the bitstream timestamp. | 291 // TODO(sandersd): When it is provided, use the bitstream timestamp. |
295 if (lhs->pic_order_cnt != rhs->pic_order_cnt) | 292 if (lhs->pic_order_cnt != rhs->pic_order_cnt) |
296 return lhs->pic_order_cnt > rhs->pic_order_cnt; | 293 return lhs->pic_order_cnt > rhs->pic_order_cnt; |
297 | 294 |
298 // If |pic_order_cnt| is the same, fall back on using the bitstream order. | 295 // If |pic_order_cnt| is the same, fall back on using the bitstream order. |
299 return lhs->bitstream_id > rhs->bitstream_id; | 296 return lhs->bitstream_id > rhs->bitstream_id; |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 } | 896 } |
900 | 897 |
901 void VTVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_id) { | 898 void VTVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_id) { |
902 DVLOG(2) << __func__ << "(" << picture_id << ")"; | 899 DVLOG(2) << __func__ << "(" << picture_id << ")"; |
903 DCHECK(gpu_task_runner_->BelongsToCurrentThread()); | 900 DCHECK(gpu_task_runner_->BelongsToCurrentThread()); |
904 | 901 |
905 auto it = picture_info_map_.find(picture_id); | 902 auto it = picture_info_map_.find(picture_id); |
906 if (it != picture_info_map_.end()) { | 903 if (it != picture_info_map_.end()) { |
907 PictureInfo* picture_info = it->second.get(); | 904 PictureInfo* picture_info = it->second.get(); |
908 picture_info->cv_image.reset(); | 905 picture_info->cv_image.reset(); |
909 picture_info->gl_image->Destroy(false); | |
910 picture_info->gl_image = nullptr; | 906 picture_info->gl_image = nullptr; |
911 } | 907 } |
912 | 908 |
913 // It's possible there was a ReusePictureBuffer() request in flight when we | 909 // It's possible there was a ReusePictureBuffer() request in flight when we |
914 // called DismissPictureBuffer(), in which case we won't find it. In that case | 910 // called DismissPictureBuffer(), in which case we won't find it. In that case |
915 // we should just drop the ReusePictureBuffer() request. | 911 // we should just drop the ReusePictureBuffer() request. |
916 if (assigned_picture_ids_.count(picture_id)) { | 912 if (assigned_picture_ids_.count(picture_id)) { |
917 available_picture_ids_.push_back(picture_id); | 913 available_picture_ids_.push_back(picture_id); |
918 ProcessWorkQueues(); | 914 ProcessWorkQueues(); |
919 } | 915 } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 SupportedProfile profile; | 1192 SupportedProfile profile; |
1197 profile.profile = supported_profile; | 1193 profile.profile = supported_profile; |
1198 profile.min_resolution.SetSize(16, 16); | 1194 profile.min_resolution.SetSize(16, 16); |
1199 profile.max_resolution.SetSize(4096, 2160); | 1195 profile.max_resolution.SetSize(4096, 2160); |
1200 profiles.push_back(profile); | 1196 profiles.push_back(profile); |
1201 } | 1197 } |
1202 return profiles; | 1198 return profiles; |
1203 } | 1199 } |
1204 | 1200 |
1205 } // namespace media | 1201 } // namespace media |
OLD | NEW |