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

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

Issue 1809943002: Select BackingStrategy based on GpuPreferences (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
19 #include "content/common/gpu/gpu_channel.h" 19 #include "content/common/gpu/gpu_channel.h"
20 #include "content/common/gpu/media/android_copying_backing_strategy.h" 20 #include "content/common/gpu/media/android_copying_backing_strategy.h"
21 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h " 21 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h "
22 #include "content/common/gpu/media/avda_return_on_failure.h" 22 #include "content/common/gpu/media/avda_return_on_failure.h"
23 #include "content/common/gpu/media/shared_memory_region.h" 23 #include "content/common/gpu/media/shared_memory_region.h"
24 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 24 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
25 #include "gpu/command_buffer/service/gpu_switches.h"
26 #include "gpu/command_buffer/service/mailbox_manager.h" 25 #include "gpu/command_buffer/service/mailbox_manager.h"
27 #include "media/base/android/media_codec_bridge.h" 26 #include "media/base/android/media_codec_bridge.h"
28 #include "media/base/android/media_codec_util.h" 27 #include "media/base/android/media_codec_util.h"
29 #include "media/base/bind_to_current_loop.h" 28 #include "media/base/bind_to_current_loop.h"
30 #include "media/base/bitstream_buffer.h" 29 #include "media/base/bitstream_buffer.h"
31 #include "media/base/limits.h" 30 #include "media/base/limits.h"
32 #include "media/base/media.h" 31 #include "media/base/media.h"
33 #include "media/base/timestamp_constants.h" 32 #include "media/base/timestamp_constants.h"
34 #include "media/base/video_decoder_config.h" 33 #include "media/base/video_decoder_config.h"
35 #include "media/video/picture.h" 34 #include "media/video/picture.h"
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 } else { 1147 } else {
1149 most_recent_work_ = now; 1148 most_recent_work_ = now;
1150 } 1149 }
1151 1150
1152 if (should_be_running) 1151 if (should_be_running)
1153 g_avda_timer.Pointer()->StartTimer(this); 1152 g_avda_timer.Pointer()->StartTimer(this);
1154 else 1153 else
1155 g_avda_timer.Pointer()->StopTimer(this); 1154 g_avda_timer.Pointer()->StopTimer(this);
1156 } 1155 }
1157 1156
1158 // static
1159 bool AndroidVideoDecodeAccelerator::UseDeferredRenderingStrategy() { 1157 bool AndroidVideoDecodeAccelerator::UseDeferredRenderingStrategy() {
1160 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
1161 // TODO(liberato, watk): Figure out what we want to do about zero copy for 1158 // TODO(liberato, watk): Figure out what we want to do about zero copy for
1162 // fullscreen external SurfaceView in WebView. http://crbug.com/582170. 1159 // fullscreen external SurfaceView in WebView. http://crbug.com/582170.
1163 return !cmd_line->HasSwitch(switches::kEnableThreadedTextureMailboxes); 1160 const gpu::GpuPreferences& gpu_preferences =
liberato (no reviews please) 2016/03/22 21:22:08 i was thinking that you might pass in the GpuPrefe
william.xie 2016/03/22 23:11:07 Thanks Frank, per https://codereview.chromium.org/
DaleCurtis 2016/03/22 23:14:32 I believe Frank just means you should have UseDefe
william.xie 2016/03/22 23:37:26 Done.
1161 gl_decoder_->GetContextGroup()->gpu_preferences();
1162 return !gpu_preferences.enable_threaded_texture_mailboxes;
1164 } 1163 }
1165 1164
1166 // static 1165 // static
1167 media::VideoDecodeAccelerator::Capabilities 1166 media::VideoDecodeAccelerator::Capabilities
1168 AndroidVideoDecodeAccelerator::GetCapabilities() { 1167 AndroidVideoDecodeAccelerator::GetCapabilities(
1168 const gpu::GpuPreferences& gpu_preferences) {
1169 Capabilities capabilities; 1169 Capabilities capabilities;
1170 SupportedProfiles& profiles = capabilities.supported_profiles; 1170 SupportedProfiles& profiles = capabilities.supported_profiles;
1171 1171
1172 SupportedProfile profile; 1172 SupportedProfile profile;
1173 1173
1174 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) { 1174 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) {
1175 profile.profile = media::VP8PROFILE_ANY; 1175 profile.profile = media::VP8PROFILE_ANY;
1176 profile.min_resolution.SetSize(0, 0); 1176 profile.min_resolution.SetSize(0, 0);
1177 profile.max_resolution.SetSize(1920, 1088); 1177 profile.max_resolution.SetSize(1920, 1088);
1178 profiles.push_back(profile); 1178 profiles.push_back(profile);
(...skipping 10 matching lines...) Expand all
1189 SupportedProfile profile; 1189 SupportedProfile profile;
1190 profile.profile = supported_profile; 1190 profile.profile = supported_profile;
1191 profile.min_resolution.SetSize(0, 0); 1191 profile.min_resolution.SetSize(0, 0);
1192 // Advertise support for 4k and let the MediaCodec fail when decoding if it 1192 // 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 1193 // doesn't support the resolution. It's assumed that consumers won't have
1194 // software fallback for H264 on Android anyway. 1194 // software fallback for H264 on Android anyway.
1195 profile.max_resolution.SetSize(3840, 2160); 1195 profile.max_resolution.SetSize(3840, 2160);
1196 profiles.push_back(profile); 1196 profiles.push_back(profile);
1197 } 1197 }
1198 1198
1199 if (UseDeferredRenderingStrategy()) { 1199 if (!gpu_preferences.enable_threaded_texture_mailboxes) {
1200 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: 1200 capabilities.flags = media::VideoDecodeAccelerator::Capabilities::
1201 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | 1201 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE |
1202 media::VideoDecodeAccelerator::Capabilities:: 1202 media::VideoDecodeAccelerator::Capabilities::
1203 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; 1203 SUPPORTS_EXTERNAL_OUTPUT_SURFACE;
1204 } 1204 }
1205 1205
1206 return capabilities; 1206 return capabilities;
1207 } 1207 }
1208 1208
1209 } // namespace content 1209 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/android_video_decode_accelerator.h ('k') | content/common/gpu/media/gpu_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698