| 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 MakeContextCurrentCallback& make_context_current, | 295 const base::Callback<bool(void)>& make_context_current, |
| 296 const BindImageCallback& bind_image) | 296 const base::Callback<void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)>& |
| 297 bind_image) |
| 297 : make_context_current_(make_context_current), | 298 : make_context_current_(make_context_current), |
| 298 state_(kUninitialized), | 299 state_(kUninitialized), |
| 299 input_ready_(&lock_), | 300 input_ready_(&lock_), |
| 300 surfaces_available_(&lock_), | 301 surfaces_available_(&lock_), |
| 301 message_loop_(base::MessageLoop::current()), | 302 message_loop_(base::MessageLoop::current()), |
| 302 decoder_thread_("VaapiDecoderThread"), | 303 decoder_thread_("VaapiDecoderThread"), |
| 303 num_frames_at_client_(0), | 304 num_frames_at_client_(0), |
| 304 num_stream_bufs_at_decoder_(0), | 305 num_stream_bufs_at_decoder_(0), |
| 305 finish_flush_pending_(false), | 306 finish_flush_pending_(false), |
| 306 awaiting_va_surfaces_recycle_(false), | 307 awaiting_va_surfaces_recycle_(false), |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 << " to texture id: " << buffers[i].texture_id() | 741 << " to texture id: " << buffers[i].texture_id() |
| 741 << " VASurfaceID: " << va_surface_ids[i]; | 742 << " VASurfaceID: " << va_surface_ids[i]; |
| 742 | 743 |
| 743 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( | 744 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( |
| 744 vaapi_wrapper_, make_context_current_, buffers[i].id(), | 745 vaapi_wrapper_, make_context_current_, buffers[i].id(), |
| 745 buffers[i].texture_id(), requested_pic_size_)); | 746 buffers[i].texture_id(), requested_pic_size_)); |
| 746 | 747 |
| 747 scoped_refptr<gl::GLImage> image = picture->GetImageToBind(); | 748 scoped_refptr<gl::GLImage> image = picture->GetImageToBind(); |
| 748 if (image) { | 749 if (image) { |
| 749 bind_image_.Run(buffers[i].internal_texture_id(), | 750 bind_image_.Run(buffers[i].internal_texture_id(), |
| 750 VaapiPicture::GetGLTextureTarget(), image, true); | 751 VaapiPicture::GetGLTextureTarget(), image); |
| 751 } | 752 } |
| 752 | 753 |
| 753 RETURN_AND_NOTIFY_ON_FAILURE( | 754 RETURN_AND_NOTIFY_ON_FAILURE( |
| 754 picture.get(), "Failed assigning picture buffer to a texture.", | 755 picture.get(), "Failed assigning picture buffer to a texture.", |
| 755 PLATFORM_FAILURE, ); | 756 PLATFORM_FAILURE, ); |
| 756 | 757 |
| 757 bool inserted = | 758 bool inserted = |
| 758 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; | 759 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; |
| 759 DCHECK(inserted); | 760 DCHECK(inserted); |
| 760 | 761 |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 return vaapi_pic->dec_surface(); | 1745 return vaapi_pic->dec_surface(); |
| 1745 } | 1746 } |
| 1746 | 1747 |
| 1747 // static | 1748 // static |
| 1748 media::VideoDecodeAccelerator::SupportedProfiles | 1749 media::VideoDecodeAccelerator::SupportedProfiles |
| 1749 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1750 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1750 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1751 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1751 } | 1752 } |
| 1752 | 1753 |
| 1753 } // namespace content | 1754 } // namespace content |
| OLD | NEW |