Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: content/common/gpu/media/gpu_video_encode_accelerator.cc

Issue 795633005: Add VDA supported profile to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address patch set 13 review comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/gpu_video_encode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/numerics/safe_math.h" 12 #include "base/numerics/safe_math.h"
13 #include "base/sys_info.h" 13 #include "base/sys_info.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/common/gpu/gpu_channel.h" 15 #include "content/common/gpu/gpu_channel.h"
16 #include "content/common/gpu/gpu_messages.h" 16 #include "content/common/gpu/gpu_messages.h"
17 #include "content/common/gpu/media/gpu_video_accelerator_util.h"
17 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
18 #include "ipc/ipc_message_macros.h" 19 #include "ipc/ipc_message_macros.h"
19 #include "media/base/limits.h" 20 #include "media/base/limits.h"
20 #include "media/base/video_frame.h" 21 #include "media/base/video_frame.h"
21 22
22 #if defined(OS_CHROMEOS) 23 #if defined(OS_CHROMEOS)
23 #if defined(USE_V4L2_CODEC) 24 #if defined(USE_V4L2_CODEC)
24 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" 25 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h"
25 #endif 26 #endif
26 #if defined(ARCH_CPU_X86_FAMILY) 27 #if defined(ARCH_CPU_X86_FAMILY)
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 for (size_t i = 0; i < create_vea_fps.size(); ++i) { 173 for (size_t i = 0; i < create_vea_fps.size(); ++i) {
173 scoped_ptr<media::VideoEncodeAccelerator> 174 scoped_ptr<media::VideoEncodeAccelerator>
174 encoder = (*create_vea_fps[i])(); 175 encoder = (*create_vea_fps[i])();
175 if (!encoder) 176 if (!encoder)
176 continue; 177 continue;
177 std::vector<media::VideoEncodeAccelerator::SupportedProfile> 178 std::vector<media::VideoEncodeAccelerator::SupportedProfile>
178 vea_profiles = encoder->GetSupportedProfiles(); 179 vea_profiles = encoder->GetSupportedProfiles();
179 profiles.insert(profiles.end(), vea_profiles.begin(), vea_profiles.end()); 180 profiles.insert(profiles.end(), vea_profiles.begin(), vea_profiles.end());
180 } 181 }
181 return ConvertMediaToGpuProfiles(profiles); 182 return GpuVideoAcceleratorUtil::ConvertMediaToGpuEncodeProfiles(profiles);
182 } 183 }
183 184
184 // static 185 // static
185 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
186 GpuVideoEncodeAccelerator::ConvertMediaToGpuProfiles(const std::vector<
187 media::VideoEncodeAccelerator::SupportedProfile>& media_profiles) {
188 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> profiles;
189 for (size_t i = 0; i < media_profiles.size(); i++) {
190 gpu::VideoEncodeAcceleratorSupportedProfile profile;
191 profile.profile =
192 static_cast<gpu::VideoCodecProfile>(media_profiles[i].profile);
193 profile.max_resolution = media_profiles[i].max_resolution;
194 profile.max_framerate_numerator = media_profiles[i].max_framerate_numerator;
195 profile.max_framerate_denominator =
196 media_profiles[i].max_framerate_denominator;
197 profiles.push_back(profile);
198 }
199 return profiles;
200 }
201
202 // static
203 std::vector<GpuVideoEncodeAccelerator::CreateVEAFp> 186 std::vector<GpuVideoEncodeAccelerator::CreateVEAFp>
204 GpuVideoEncodeAccelerator::CreateVEAFps() { 187 GpuVideoEncodeAccelerator::CreateVEAFps() {
205 std::vector<GpuVideoEncodeAccelerator::CreateVEAFp> create_vea_fps; 188 std::vector<GpuVideoEncodeAccelerator::CreateVEAFp> create_vea_fps;
206 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateV4L2VEA); 189 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateV4L2VEA);
207 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA); 190 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA);
208 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateAndroidVEA); 191 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateAndroidVEA);
209 return create_vea_fps; 192 return create_vea_fps;
210 } 193 }
211 194
212 // static 195 // static
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 stub_->channel()->Send(message); 350 stub_->channel()->Send(message);
368 } 351 }
369 352
370 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, 353 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message,
371 bool succeeded) { 354 bool succeeded) {
372 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); 355 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded);
373 Send(message); 356 Send(message);
374 } 357 }
375 358
376 } // namespace content 359 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698