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 "media/gpu/vaapi_video_decode_accelerator.h" | 5 #include "media/gpu/vaapi_video_decode_accelerator.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 DCHECK(requested_pic_size_ == buffers[0].size()); | 788 DCHECK(requested_pic_size_ == buffers[0].size()); |
789 | 789 |
790 std::vector<VASurfaceID> va_surface_ids; | 790 std::vector<VASurfaceID> va_surface_ids; |
791 RETURN_AND_NOTIFY_ON_FAILURE( | 791 RETURN_AND_NOTIFY_ON_FAILURE( |
792 vaapi_wrapper_->CreateSurfaces(VA_RT_FORMAT_YUV420, requested_pic_size_, | 792 vaapi_wrapper_->CreateSurfaces(VA_RT_FORMAT_YUV420, requested_pic_size_, |
793 buffers.size(), &va_surface_ids), | 793 buffers.size(), &va_surface_ids), |
794 "Failed creating VA Surfaces", PLATFORM_FAILURE, ); | 794 "Failed creating VA Surfaces", PLATFORM_FAILURE, ); |
795 DCHECK_EQ(va_surface_ids.size(), buffers.size()); | 795 DCHECK_EQ(va_surface_ids.size(), buffers.size()); |
796 | 796 |
797 for (size_t i = 0; i < buffers.size(); ++i) { | 797 for (size_t i = 0; i < buffers.size(); ++i) { |
798 uint32_t texture_id = | 798 uint32_t client_id = !buffers[i].client_texture_ids().empty() |
799 buffers[i].texture_ids().size() > 0 ? buffers[i].texture_ids()[0] : 0; | 799 ? buffers[i].client_texture_ids()[0] |
800 uint32_t internal_texture_id = buffers[i].internal_texture_ids().size() > 0 | 800 : 0; |
801 ? buffers[i].internal_texture_ids()[0] | 801 uint32_t service_id = !buffers[i].service_texture_ids().empty() |
802 : 0; | 802 ? buffers[i].service_texture_ids()[0] |
| 803 : 0; |
803 | 804 |
804 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( | 805 linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( |
805 vaapi_wrapper_, make_context_current_cb_, bind_image_cb_, | 806 vaapi_wrapper_, make_context_current_cb_, bind_image_cb_, |
806 buffers[i].id(), requested_pic_size_, texture_id, internal_texture_id)); | 807 buffers[i].id(), requested_pic_size_, service_id, client_id)); |
807 RETURN_AND_NOTIFY_ON_FAILURE( | 808 RETURN_AND_NOTIFY_ON_FAILURE( |
808 picture.get(), "Failed creating a VaapiPicture", PLATFORM_FAILURE, ); | 809 picture.get(), "Failed creating a VaapiPicture", PLATFORM_FAILURE, ); |
809 | 810 |
810 bool inserted = | 811 bool inserted = |
811 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; | 812 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; |
812 DCHECK(inserted); | 813 DCHECK(inserted); |
813 | 814 |
814 if (output_mode_ == Config::OutputMode::ALLOCATE) { | 815 if (output_mode_ == Config::OutputMode::ALLOCATE) { |
815 RETURN_AND_NOTIFY_ON_FAILURE( | 816 RETURN_AND_NOTIFY_ON_FAILURE( |
816 picture->Allocate(output_format_), | 817 picture->Allocate(output_format_), |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 return vaapi_pic->dec_surface(); | 1882 return vaapi_pic->dec_surface(); |
1882 } | 1883 } |
1883 | 1884 |
1884 // static | 1885 // static |
1885 VideoDecodeAccelerator::SupportedProfiles | 1886 VideoDecodeAccelerator::SupportedProfiles |
1886 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1887 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
1887 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1888 return VaapiWrapper::GetSupportedDecodeProfiles(); |
1888 } | 1889 } |
1889 | 1890 |
1890 } // namespace media | 1891 } // namespace media |
OLD | NEW |