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

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

Issue 1820553002: Expose encrypted_only attribute on VDA supported profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix logs. Created 4 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/android_video_decode_accelerator.h" 5 #include "content/common/gpu/media/android_video_decode_accelerator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 codec_ == media::kCodecVP9 || 310 codec_ == media::kCodecVP9 ||
311 codec_ == media::kCodecH264; 311 codec_ == media::kCodecH264;
312 312
313 if (!profile_supported) { 313 if (!profile_supported) {
314 LOG(ERROR) << "Unsupported profile: " << config.profile; 314 LOG(ERROR) << "Unsupported profile: " << config.profile;
315 return false; 315 return false;
316 } 316 }
317 317
318 // Only use MediaCodec for VP8/9 if it's likely backed by hardware 318 // Only use MediaCodec for VP8/9 if it's likely backed by hardware
319 // or if the stream is encrypted. 319 // or if the stream is encrypted.
320 if ((codec_ == media::kCodecVP8 || codec_ == media::kCodecVP9) && 320 if (codec_ == media::kCodecVP8 || codec_ == media::kCodecVP9) {
321 !is_encrypted_) { 321 DCHECK(is_encrypted_ ||
322 if (media::VideoCodecBridge::IsKnownUnaccelerated( 322 !media::VideoCodecBridge::IsKnownUnaccelerated(
323 codec_, media::MEDIA_CODEC_DECODER)) { 323 codec_, media::MEDIA_CODEC_DECODER));
324 DVLOG(1) << "Initialization failed: "
325 << (codec_ == media::kCodecVP8 ? "vp8" : "vp9")
326 << " is not hardware accelerated";
327 return false;
328 }
329 } 324 }
330 325
331 if (!make_context_current_.Run()) { 326 if (!make_context_current_.Run()) {
332 LOG(ERROR) << "Failed to make this decoder's GL context current."; 327 LOG(ERROR) << "Failed to make this decoder's GL context current.";
333 return false; 328 return false;
334 } 329 }
335 330
336 if (!gl_decoder_) { 331 if (!gl_decoder_) {
337 LOG(ERROR) << "Failed to get gles2 decoder instance."; 332 LOG(ERROR) << "Failed to get gles2 decoder instance.";
338 return false; 333 return false;
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 AndroidVideoDecodeAccelerator::GetCapabilities() { 1163 AndroidVideoDecodeAccelerator::GetCapabilities() {
1169 Capabilities capabilities; 1164 Capabilities capabilities;
1170 SupportedProfiles& profiles = capabilities.supported_profiles; 1165 SupportedProfiles& profiles = capabilities.supported_profiles;
1171 1166
1172 SupportedProfile profile; 1167 SupportedProfile profile;
1173 1168
1174 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) { 1169 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) {
1175 profile.profile = media::VP8PROFILE_ANY; 1170 profile.profile = media::VP8PROFILE_ANY;
1176 profile.min_resolution.SetSize(0, 0); 1171 profile.min_resolution.SetSize(0, 0);
1177 profile.max_resolution.SetSize(1920, 1088); 1172 profile.max_resolution.SetSize(1920, 1088);
1173 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated(
Ken Russell (switch to Gerrit) 2016/03/19 00:25:36 It's a little confusing to readers that the encryp
DaleCurtis 2016/03/19 00:29:06 Good point. Comment added explaining why this is t
1174 media::kCodecVP8, media::MEDIA_CODEC_DECODER);
1178 profiles.push_back(profile); 1175 profiles.push_back(profile);
1179 } 1176 }
1180 1177
1181 if (media::PlatformHasVp9Support()) { 1178 if (media::PlatformHasVp9Support()) {
1182 profile.profile = media::VP9PROFILE_ANY; 1179 profile.profile = media::VP9PROFILE_ANY;
1183 profile.min_resolution.SetSize(0, 0); 1180 profile.min_resolution.SetSize(0, 0);
1184 profile.max_resolution.SetSize(1920, 1088); 1181 profile.max_resolution.SetSize(1920, 1088);
1182 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated(
1183 media::kCodecVP9, media::MEDIA_CODEC_DECODER);
1185 profiles.push_back(profile); 1184 profiles.push_back(profile);
1186 } 1185 }
1187 1186
1188 for (const auto& supported_profile : kSupportedH264Profiles) { 1187 for (const auto& supported_profile : kSupportedH264Profiles) {
1189 SupportedProfile profile; 1188 SupportedProfile profile;
1190 profile.profile = supported_profile; 1189 profile.profile = supported_profile;
1191 profile.min_resolution.SetSize(0, 0); 1190 profile.min_resolution.SetSize(0, 0);
1192 // Advertise support for 4k and let the MediaCodec fail when decoding if it 1191 // Advertise support for 4k and let the MediaCodec fail when decoding if it
1193 // doesn't support the resolution. It's assumed that consumers won't have 1192 // doesn't support the resolution. It's assumed that consumers won't have
1194 // software fallback for H264 on Android anyway. 1193 // software fallback for H264 on Android anyway.
1195 profile.max_resolution.SetSize(3840, 2160); 1194 profile.max_resolution.SetSize(3840, 2160);
1196 profiles.push_back(profile); 1195 profiles.push_back(profile);
1197 } 1196 }
1198 1197
1199 if (UseDeferredRenderingStrategy()) { 1198 if (UseDeferredRenderingStrategy()) {
1200 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: 1199 capabilities.flags = media::VideoDecodeAccelerator::Capabilities::
1201 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | 1200 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE |
1202 media::VideoDecodeAccelerator::Capabilities:: 1201 media::VideoDecodeAccelerator::Capabilities::
1203 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; 1202 SUPPORTS_EXTERNAL_OUTPUT_SURFACE;
1204 } 1203 }
1205 1204
1206 return capabilities; 1205 return capabilities;
1207 } 1206 }
1208 1207
1209 } // namespace content 1208 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_param_traits_macros.h ('k') | content/common/gpu/media/gpu_video_accelerator_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698