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

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

Issue 1796633002: Revert of content gpu refactor: get rid of gpu related content switches. (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 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 #include <stddef.h> 10 #include <stddef.h>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/mac/mac_logging.h" 15 #include "base/mac/mac_logging.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
17 #include "base/sys_byteorder.h" 18 #include "base/sys_byteorder.h"
18 #include "base/sys_info.h" 19 #include "base/sys_info.h"
19 #include "base/thread_task_runner_handle.h" 20 #include "base/thread_task_runner_handle.h"
20 #include "base/version.h" 21 #include "base/version.h"
21 #include "content/common/gpu/media/vt_video_decode_accelerator_mac.h" 22 #include "content/common/gpu/media/vt_video_decode_accelerator_mac.h"
23 #include "content/public/common/content_switches.h"
22 #include "media/base/limits.h" 24 #include "media/base/limits.h"
23 #include "ui/gl/gl_context.h" 25 #include "ui/gl/gl_context.h"
24 #include "ui/gl/gl_image_io_surface.h" 26 #include "ui/gl/gl_image_io_surface.h"
25 #include "ui/gl/gl_implementation.h" 27 #include "ui/gl/gl_implementation.h"
26 #include "ui/gl/scoped_binders.h" 28 #include "ui/gl/scoped_binders.h"
27 29
28 using content_common_gpu_media::kModuleVt; 30 using content_common_gpu_media::kModuleVt;
29 using content_common_gpu_media::InitializeStubs; 31 using content_common_gpu_media::InitializeStubs;
30 using content_common_gpu_media::IsVtInitialized; 32 using content_common_gpu_media::IsVtInitialized;
31 using content_common_gpu_media::StubPathMap; 33 using content_common_gpu_media::StubPathMap;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 return true; 172 return true;
171 } 173 }
172 174
173 // The purpose of this function is to preload the generic and hardware-specific 175 // The purpose of this function is to preload the generic and hardware-specific
174 // libraries required by VideoToolbox before the GPU sandbox is enabled. 176 // libraries required by VideoToolbox before the GPU sandbox is enabled.
175 // VideoToolbox normally loads the hardware-specific libraries lazily, so we 177 // VideoToolbox normally loads the hardware-specific libraries lazily, so we
176 // must actually create a decompression session. If creating a decompression 178 // must actually create a decompression session. If creating a decompression
177 // session fails, hardware decoding will be disabled (Initialize() will always 179 // session fails, hardware decoding will be disabled (Initialize() will always
178 // return false). 180 // return false).
179 static bool InitializeVideoToolboxInternal() { 181 static bool InitializeVideoToolboxInternal() {
182 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
183 switches::kDisableAcceleratedVideoDecode)) {
184 return false;
185 }
186
180 if (!IsVtInitialized()) { 187 if (!IsVtInitialized()) {
181 // CoreVideo is also required, but the loader stops after the first path is 188 // CoreVideo is also required, but the loader stops after the first path is
182 // loaded. Instead we rely on the transitive dependency from VideoToolbox to 189 // loaded. Instead we rely on the transitive dependency from VideoToolbox to
183 // CoreVideo. 190 // CoreVideo.
184 StubPathMap paths; 191 StubPathMap paths;
185 paths[kModuleVt].push_back(FILE_PATH_LITERAL( 192 paths[kModuleVt].push_back(FILE_PATH_LITERAL(
186 "/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox")); 193 "/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox"));
187 if (!InitializeStubs(paths)) { 194 if (!InitializeStubs(paths)) {
188 LOG(WARNING) << "Failed to initialize VideoToolbox framework. " 195 LOG(WARNING) << "Failed to initialize VideoToolbox framework. "
189 << "Hardware accelerated video decoding will be disabled."; 196 << "Hardware accelerated video decoding will be disabled.";
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 SupportedProfile profile; 1164 SupportedProfile profile;
1158 profile.profile = supported_profile; 1165 profile.profile = supported_profile;
1159 profile.min_resolution.SetSize(16, 16); 1166 profile.min_resolution.SetSize(16, 16);
1160 profile.max_resolution.SetSize(4096, 2160); 1167 profile.max_resolution.SetSize(4096, 2160);
1161 profiles.push_back(profile); 1168 profiles.push_back(profile);
1162 } 1169 }
1163 return profiles; 1170 return profiles;
1164 } 1171 }
1165 1172
1166 } // namespace content 1173 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/video_decode_accelerator_unittest.cc ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698