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

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

Issue 795633005: Add VDA supported profile to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nit 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 5 #include <algorithm>
6 6
7 #include <CoreVideo/CoreVideo.h> 7 #include <CoreVideo/CoreVideo.h>
8 #include <OpenGL/CGLIOSurface.h> 8 #include <OpenGL/CGLIOSurface.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 10
(...skipping 15 matching lines...) Expand all
26 using content_common_gpu_media::StubPathMap; 26 using content_common_gpu_media::StubPathMap;
27 27
28 #define NOTIFY_STATUS(name, status, session_failure) \ 28 #define NOTIFY_STATUS(name, status, session_failure) \
29 do { \ 29 do { \
30 OSSTATUS_DLOG(ERROR, status) << name; \ 30 OSSTATUS_DLOG(ERROR, status) << name; \
31 NotifyError(PLATFORM_FAILURE, session_failure); \ 31 NotifyError(PLATFORM_FAILURE, session_failure); \
32 } while (0) 32 } while (0)
33 33
34 namespace content { 34 namespace content {
35 35
36 // Only H.264 with 4:2:0 chroma sampling is supported.
37 static const media::VideoCodecProfile kSupportedProfiles[] = {
38 media::H264PROFILE_BASELINE,
39 media::H264PROFILE_MAIN,
40 media::H264PROFILE_EXTENDED,
41 media::H264PROFILE_HIGH,
42 media::H264PROFILE_HIGH10PROFILE,
43 media::H264PROFILE_SCALABLEBASELINE,
44 media::H264PROFILE_SCALABLEHIGH,
45 media::H264PROFILE_STEREOHIGH,
46 media::H264PROFILE_MULTIVIEWHIGH,
47 };
48
36 // Size to use for NALU length headers in AVC format (can be 1, 2, or 4). 49 // Size to use for NALU length headers in AVC format (can be 1, 2, or 4).
37 static const int kNALUHeaderLength = 4; 50 static const int kNALUHeaderLength = 4;
38 51
39 // We request 5 picture buffers from the client, each of which has a texture ID 52 // We request 5 picture buffers from the client, each of which has a texture ID
40 // that we can bind decoded frames to. We need enough to satisfy preroll, and 53 // that we can bind decoded frames to. We need enough to satisfy preroll, and
41 // enough to avoid unnecessary stalling, but no more than that. The resource 54 // enough to avoid unnecessary stalling, but no more than that. The resource
42 // requirements are low, as we don't need the textures to be backed by storage. 55 // requirements are low, as we don't need the textures to be backed by storage.
43 static const int kNumPictureBuffers = media::limits::kMaxVideoFrames + 1; 56 static const int kNumPictureBuffers = media::limits::kMaxVideoFrames + 1;
44 57
45 // Maximum number of frames to queue for reordering before we stop asking for 58 // Maximum number of frames to queue for reordering before we stop asking for
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 317
305 bool VTVideoDecodeAccelerator::Initialize( 318 bool VTVideoDecodeAccelerator::Initialize(
306 media::VideoCodecProfile profile, 319 media::VideoCodecProfile profile,
307 Client* client) { 320 Client* client) {
308 DCHECK(gpu_thread_checker_.CalledOnValidThread()); 321 DCHECK(gpu_thread_checker_.CalledOnValidThread());
309 client_ = client; 322 client_ = client;
310 323
311 if (!InitializeVideoToolbox()) 324 if (!InitializeVideoToolbox())
312 return false; 325 return false;
313 326
314 // Only H.264 with 4:2:0 chroma sampling is supported. 327 bool profile_supported = false;
315 if (profile < media::H264PROFILE_MIN || 328 for (const auto& supported_profile : kSupportedProfiles) {
316 profile > media::H264PROFILE_MAX || 329 if (profile == supported_profile) {
317 profile == media::H264PROFILE_HIGH422PROFILE || 330 profile_supported = true;
318 profile == media::H264PROFILE_HIGH444PREDICTIVEPROFILE) { 331 break;
332 }
333 }
334 if (!profile_supported)
319 return false; 335 return false;
320 }
321 336
322 // Spawn a thread to handle parsing and calling VideoToolbox. 337 // Spawn a thread to handle parsing and calling VideoToolbox.
323 if (!decoder_thread_.Start()) 338 if (!decoder_thread_.Start())
324 return false; 339 return false;
325 340
326 // Count the session as successfully initialized. 341 // Count the session as successfully initialized.
327 UMA_HISTOGRAM_ENUMERATION("Media.VTVDA.SessionFailureReason", 342 UMA_HISTOGRAM_ENUMERATION("Media.VTVDA.SessionFailureReason",
328 SFT_SUCCESSFULLY_INITIALIZED, 343 SFT_SUCCESSFULLY_INITIALIZED,
329 SFT_MAX + 1); 344 SFT_MAX + 1);
330 return true; 345 return true;
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 client_->NotifyEndOfBitstreamBuffer(bitstream_id); 1062 client_->NotifyEndOfBitstreamBuffer(bitstream_id);
1048 assigned_bitstream_ids_.clear(); 1063 assigned_bitstream_ids_.clear();
1049 state_ = STATE_DESTROYING; 1064 state_ = STATE_DESTROYING;
1050 QueueFlush(TASK_DESTROY); 1065 QueueFlush(TASK_DESTROY);
1051 } 1066 }
1052 1067
1053 bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() { 1068 bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() {
1054 return false; 1069 return false;
1055 } 1070 }
1056 1071
1072 // static
1073 std::vector<media::VideoDecodeAccelerator::SupportedProfile>
1074 VTVideoDecodeAccelerator::GetSupportedProfiles() {
1075 std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles;
1076 for (const auto& supported_profile : kSupportedProfiles) {
1077 media::VideoDecodeAccelerator::SupportedProfile profile;
1078 profile.profile = supported_profile;
1079 profile.min_resolution.SetSize(480, 360);
1080 profile.max_resolution.SetSize(4096, 2160);
1081 profiles.push_back(profile);
1082 }
1083 return profiles;
1084 }
1085
1057 } // namespace content 1086 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698