| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 if (it == pictures_.end()) { | 284 if (it == pictures_.end()) { |
| 285 LOG(ERROR) << "Picture id " << picture_buffer_id << " does not exist"; | 285 LOG(ERROR) << "Picture id " << picture_buffer_id << " does not exist"; |
| 286 return NULL; | 286 return NULL; |
| 287 } | 287 } |
| 288 | 288 |
| 289 return it->second.get(); | 289 return it->second.get(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( | 292 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( |
| 293 const base::Callback<bool(void)>& make_context_current, | 293 const base::Callback<bool(void)>& make_context_current, |
| 294 const base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)>& | 294 const base::Callback<void(uint32, uint32, scoped_refptr<gl::GLImage>)>& |
| 295 bind_image) | 295 bind_image) |
| 296 : make_context_current_(make_context_current), | 296 : make_context_current_(make_context_current), |
| 297 state_(kUninitialized), | 297 state_(kUninitialized), |
| 298 input_ready_(&lock_), | 298 input_ready_(&lock_), |
| 299 surfaces_available_(&lock_), | 299 surfaces_available_(&lock_), |
| 300 message_loop_(base::MessageLoop::current()), | 300 message_loop_(base::MessageLoop::current()), |
| 301 decoder_thread_("VaapiDecoderThread"), | 301 decoder_thread_("VaapiDecoderThread"), |
| 302 num_frames_at_client_(0), | 302 num_frames_at_client_(0), |
| 303 num_stream_bufs_at_decoder_(0), | 303 num_stream_bufs_at_decoder_(0), |
| 304 finish_flush_pending_(false), | 304 finish_flush_pending_(false), |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 | 725 |
| 726 for (size_t i = 0; i < buffers.size(); ++i) { | 726 for (size_t i = 0; i < buffers.size(); ++i) { |
| 727 DVLOG(2) << "Assigning picture id: " << buffers[i].id() | 727 DVLOG(2) << "Assigning picture id: " << buffers[i].id() |
| 728 << " to texture id: " << buffers[i].texture_id() | 728 << " to texture id: " << buffers[i].texture_id() |
| 729 << " VASurfaceID: " << va_surface_ids[i]; | 729 << " VASurfaceID: " << va_surface_ids[i]; |
| 730 | 730 |
| 731 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( | 731 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( |
| 732 vaapi_wrapper_.get(), make_context_current_, buffers[i].id(), | 732 vaapi_wrapper_.get(), make_context_current_, buffers[i].id(), |
| 733 buffers[i].texture_id(), requested_pic_size_)); | 733 buffers[i].texture_id(), requested_pic_size_)); |
| 734 | 734 |
| 735 scoped_refptr<gfx::GLImage> image = picture->GetImageToBind(); | 735 scoped_refptr<gl::GLImage> image = picture->GetImageToBind(); |
| 736 if (image) { | 736 if (image) { |
| 737 bind_image_.Run(buffers[i].internal_texture_id(), | 737 bind_image_.Run(buffers[i].internal_texture_id(), |
| 738 VaapiPicture::GetGLTextureTarget(), image); | 738 VaapiPicture::GetGLTextureTarget(), image); |
| 739 } | 739 } |
| 740 | 740 |
| 741 RETURN_AND_NOTIFY_ON_FAILURE( | 741 RETURN_AND_NOTIFY_ON_FAILURE( |
| 742 picture.get(), "Failed assigning picture buffer to a texture.", | 742 picture.get(), "Failed assigning picture buffer to a texture.", |
| 743 PLATFORM_FAILURE, ); | 743 PLATFORM_FAILURE, ); |
| 744 | 744 |
| 745 bool inserted = | 745 bool inserted = |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 return vaapi_pic->dec_surface(); | 1731 return vaapi_pic->dec_surface(); |
| 1732 } | 1732 } |
| 1733 | 1733 |
| 1734 // static | 1734 // static |
| 1735 media::VideoDecodeAccelerator::SupportedProfiles | 1735 media::VideoDecodeAccelerator::SupportedProfiles |
| 1736 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1736 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1737 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1737 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1738 } | 1738 } |
| 1739 | 1739 |
| 1740 } // namespace content | 1740 } // namespace content |
| OLD | NEW |