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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 << " to texture id: " << buffers[i].texture_id() | 740 << " to texture id: " << buffers[i].texture_id() |
742 << " VASurfaceID: " << va_surface_ids[i]; | 741 << " VASurfaceID: " << va_surface_ids[i]; |
743 | 742 |
744 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( | 743 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( |
745 vaapi_wrapper_, make_context_current_, buffers[i].id(), | 744 vaapi_wrapper_, make_context_current_, buffers[i].id(), |
746 buffers[i].texture_id(), requested_pic_size_)); | 745 buffers[i].texture_id(), requested_pic_size_)); |
747 | 746 |
748 scoped_refptr<gl::GLImage> image = picture->GetImageToBind(); | 747 scoped_refptr<gl::GLImage> image = picture->GetImageToBind(); |
749 if (image) { | 748 if (image) { |
750 bind_image_.Run(buffers[i].internal_texture_id(), | 749 bind_image_.Run(buffers[i].internal_texture_id(), |
751 VaapiPicture::GetGLTextureTarget(), image); | 750 VaapiPicture::GetGLTextureTarget(), image, true); |
752 } | 751 } |
753 | 752 |
754 RETURN_AND_NOTIFY_ON_FAILURE( | 753 RETURN_AND_NOTIFY_ON_FAILURE( |
755 picture.get(), "Failed assigning picture buffer to a texture.", | 754 picture.get(), "Failed assigning picture buffer to a texture.", |
756 PLATFORM_FAILURE, ); | 755 PLATFORM_FAILURE, ); |
757 | 756 |
758 bool inserted = | 757 bool inserted = |
759 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; | 758 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; |
760 DCHECK(inserted); | 759 DCHECK(inserted); |
761 | 760 |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 return vaapi_pic->dec_surface(); | 1744 return vaapi_pic->dec_surface(); |
1746 } | 1745 } |
1747 | 1746 |
1748 // static | 1747 // static |
1749 media::VideoDecodeAccelerator::SupportedProfiles | 1748 media::VideoDecodeAccelerator::SupportedProfiles |
1750 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1749 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
1751 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1750 return VaapiWrapper::GetSupportedDecodeProfiles(); |
1752 } | 1751 } |
1753 | 1752 |
1754 } // namespace content | 1753 } // namespace content |
OLD | NEW |