| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 Pictures::iterator it = pictures_.find(picture_buffer_id); | 285 Pictures::iterator it = pictures_.find(picture_buffer_id); |
| 286 if (it == pictures_.end()) { | 286 if (it == pictures_.end()) { |
| 287 LOG(ERROR) << "Picture id " << picture_buffer_id << " does not exist"; | 287 LOG(ERROR) << "Picture id " << picture_buffer_id << " does not exist"; |
| 288 return NULL; | 288 return NULL; |
| 289 } | 289 } |
| 290 | 290 |
| 291 return it->second.get(); | 291 return it->second.get(); |
| 292 } | 292 } |
| 293 | 293 |
| 294 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( | 294 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( |
| 295 const base::Callback<bool(void)>& make_context_current, | 295 const MakeContextCurrentCallback& make_context_current, |
| 296 const base::Callback<void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)>& | 296 const BindImageCallback& bind_image) |
| 297 bind_image) | |
| 298 : make_context_current_(make_context_current), | 297 : make_context_current_(make_context_current), |
| 299 state_(kUninitialized), | 298 state_(kUninitialized), |
| 300 input_ready_(&lock_), | 299 input_ready_(&lock_), |
| 301 surfaces_available_(&lock_), | 300 surfaces_available_(&lock_), |
| 302 message_loop_(base::MessageLoop::current()), | 301 message_loop_(base::MessageLoop::current()), |
| 303 decoder_thread_("VaapiDecoderThread"), | 302 decoder_thread_("VaapiDecoderThread"), |
| 304 num_frames_at_client_(0), | 303 num_frames_at_client_(0), |
| 305 num_stream_bufs_at_decoder_(0), | 304 num_stream_bufs_at_decoder_(0), |
| 306 finish_flush_pending_(false), | 305 finish_flush_pending_(false), |
| 307 awaiting_va_surfaces_recycle_(false), | 306 awaiting_va_surfaces_recycle_(false), |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 << " VASurfaceID: " << va_surface_ids[i]; | 742 << " VASurfaceID: " << va_surface_ids[i]; |
| 744 | 743 |
| 745 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( | 744 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( |
| 746 vaapi_wrapper_, make_context_current_, buffers[i].id(), | 745 vaapi_wrapper_, make_context_current_, buffers[i].id(), |
| 747 buffers[i].texture_ids()[0], requested_pic_size_)); | 746 buffers[i].texture_ids()[0], requested_pic_size_)); |
| 748 | 747 |
| 749 scoped_refptr<gl::GLImage> image = picture->GetImageToBind(); | 748 scoped_refptr<gl::GLImage> image = picture->GetImageToBind(); |
| 750 if (image) { | 749 if (image) { |
| 751 DCHECK_LE(1u, buffers[i].internal_texture_ids().size()); | 750 DCHECK_LE(1u, buffers[i].internal_texture_ids().size()); |
| 752 bind_image_.Run(buffers[i].internal_texture_ids()[0], | 751 bind_image_.Run(buffers[i].internal_texture_ids()[0], |
| 753 VaapiPicture::GetGLTextureTarget(), image); | 752 VaapiPicture::GetGLTextureTarget(), image, true); |
| 754 } | 753 } |
| 755 | 754 |
| 756 RETURN_AND_NOTIFY_ON_FAILURE( | 755 RETURN_AND_NOTIFY_ON_FAILURE( |
| 757 picture.get(), "Failed assigning picture buffer to a texture.", | 756 picture.get(), "Failed assigning picture buffer to a texture.", |
| 758 PLATFORM_FAILURE, ); | 757 PLATFORM_FAILURE, ); |
| 759 | 758 |
| 760 bool inserted = | 759 bool inserted = |
| 761 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; | 760 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; |
| 762 DCHECK(inserted); | 761 DCHECK(inserted); |
| 763 | 762 |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 return vaapi_pic->dec_surface(); | 1746 return vaapi_pic->dec_surface(); |
| 1748 } | 1747 } |
| 1749 | 1748 |
| 1750 // static | 1749 // static |
| 1751 media::VideoDecodeAccelerator::SupportedProfiles | 1750 media::VideoDecodeAccelerator::SupportedProfiles |
| 1752 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1751 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1753 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1752 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1754 } | 1753 } |
| 1755 | 1754 |
| 1756 } // namespace content | 1755 } // namespace content |
| OLD | NEW |