| 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 <algorithm> | 5 #include <algorithm> |
| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 if (lhs->pic_order_cnt != rhs->pic_order_cnt) | 281 if (lhs->pic_order_cnt != rhs->pic_order_cnt) |
| 282 return lhs->pic_order_cnt > rhs->pic_order_cnt; | 282 return lhs->pic_order_cnt > rhs->pic_order_cnt; |
| 283 // If |pic_order_cnt| is the same, fall back on using the bitstream order. | 283 // If |pic_order_cnt| is the same, fall back on using the bitstream order. |
| 284 // TODO(sandersd): Assign a sequence number in Decode() and use that instead. | 284 // TODO(sandersd): Assign a sequence number in Decode() and use that instead. |
| 285 // TODO(sandersd): Using the sequence number, ensure that frames older than | 285 // TODO(sandersd): Using the sequence number, ensure that frames older than |
| 286 // |kMaxReorderQueueSize| are ordered first, regardless of |pic_order_cnt|. | 286 // |kMaxReorderQueueSize| are ordered first, regardless of |pic_order_cnt|. |
| 287 return lhs->bitstream_id > rhs->bitstream_id; | 287 return lhs->bitstream_id > rhs->bitstream_id; |
| 288 } | 288 } |
| 289 | 289 |
| 290 VTVideoDecodeAccelerator::VTVideoDecodeAccelerator( | 290 VTVideoDecodeAccelerator::VTVideoDecodeAccelerator( |
| 291 const base::Callback<bool(void)>& make_context_current, | 291 const MakeContextCurrentCallback& make_context_current, |
| 292 const base::Callback<void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)>& | 292 const BindImageCallback& bind_image) |
| 293 bind_image) | |
| 294 : make_context_current_(make_context_current), | 293 : make_context_current_(make_context_current), |
| 295 bind_image_(bind_image), | 294 bind_image_(bind_image), |
| 296 client_(nullptr), | 295 client_(nullptr), |
| 297 state_(STATE_DECODING), | 296 state_(STATE_DECODING), |
| 298 format_(nullptr), | 297 format_(nullptr), |
| 299 session_(nullptr), | 298 session_(nullptr), |
| 300 last_sps_id_(-1), | 299 last_sps_id_(-1), |
| 301 last_pps_id_(-1), | 300 last_pps_id_(-1), |
| 302 config_changed_(false), | 301 config_changed_(false), |
| 303 missing_idr_logged_(false), | 302 missing_idr_logged_(false), |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 bool bind_result = gl_image->BindTexImage(GL_TEXTURE_RECTANGLE_ARB); | 1052 bool bind_result = gl_image->BindTexImage(GL_TEXTURE_RECTANGLE_ARB); |
| 1054 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGLCoreProfile) | 1053 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGLCoreProfile) |
| 1055 glDisable(GL_TEXTURE_RECTANGLE_ARB); | 1054 glDisable(GL_TEXTURE_RECTANGLE_ARB); |
| 1056 if (!bind_result) { | 1055 if (!bind_result) { |
| 1057 NOTIFY_STATUS("Failed BindTexImage on GLImageIOSurface", PLATFORM_FAILURE, | 1056 NOTIFY_STATUS("Failed BindTexImage on GLImageIOSurface", PLATFORM_FAILURE, |
| 1058 SFT_PLATFORM_ERROR); | 1057 SFT_PLATFORM_ERROR); |
| 1059 return false; | 1058 return false; |
| 1060 } | 1059 } |
| 1061 | 1060 |
| 1062 bind_image_.Run(picture_info->client_texture_id, GL_TEXTURE_RECTANGLE_ARB, | 1061 bind_image_.Run(picture_info->client_texture_id, GL_TEXTURE_RECTANGLE_ARB, |
| 1063 gl_image); | 1062 gl_image, true); |
| 1064 | 1063 |
| 1065 // Assign the new image(s) to the the picture info. | 1064 // Assign the new image(s) to the the picture info. |
| 1066 picture_info->gl_image = gl_image; | 1065 picture_info->gl_image = gl_image; |
| 1067 picture_info->cv_image = frame.image; | 1066 picture_info->cv_image = frame.image; |
| 1068 available_picture_ids_.pop_back(); | 1067 available_picture_ids_.pop_back(); |
| 1069 | 1068 |
| 1070 // TODO(sandersd): Currently, the size got from | 1069 // TODO(sandersd): Currently, the size got from |
| 1071 // CMVideoFormatDescriptionGetDimensions is visible size. We pass it to | 1070 // CMVideoFormatDescriptionGetDimensions is visible size. We pass it to |
| 1072 // GpuVideoDecoder so that GpuVideoDecoder can use correct visible size in | 1071 // GpuVideoDecoder so that GpuVideoDecoder can use correct visible size in |
| 1073 // resolution changed. We should find the correct API to get the real | 1072 // resolution changed. We should find the correct API to get the real |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 SupportedProfile profile; | 1148 SupportedProfile profile; |
| 1150 profile.profile = supported_profile; | 1149 profile.profile = supported_profile; |
| 1151 profile.min_resolution.SetSize(16, 16); | 1150 profile.min_resolution.SetSize(16, 16); |
| 1152 profile.max_resolution.SetSize(4096, 2160); | 1151 profile.max_resolution.SetSize(4096, 2160); |
| 1153 profiles.push_back(profile); | 1152 profiles.push_back(profile); |
| 1154 } | 1153 } |
| 1155 return profiles; | 1154 return profiles; |
| 1156 } | 1155 } |
| 1157 | 1156 |
| 1158 } // namespace content | 1157 } // namespace content |
| OLD | NEW |