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

Unified Diff: content/public/renderer/video_encode_accelerator.cc

Issue 568413002: Add VEA supported profiles to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address piman's comment -- create codecs_ lazily Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/public/renderer/video_encode_accelerator.cc
diff --git a/content/public/renderer/video_encode_accelerator.cc b/content/public/renderer/video_encode_accelerator.cc
index f1859c3cc59b421d1c3d0e14bceca3341d056a06..0a2c0f1ec73b370d2f00520ebb246d8d6014bb69 100644
--- a/content/public/renderer/video_encode_accelerator.cc
+++ b/content/public/renderer/video_encode_accelerator.cc
@@ -11,6 +11,21 @@
namespace content {
+// The supported profiles of video encode accelerator.
+static std::vector<media::VideoEncodeAccelerator::SupportedProfile>*
+ g_supported_profiles = NULL;
+
+static void GetSupportedVideoEncodeAcceleratorProfilesInternal(
+ scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories,
+ base::WaitableEvent* waiter,
+ std::vector<media::VideoEncodeAccelerator::SupportedProfile>* profiles) {
+ scoped_ptr<media::VideoEncodeAccelerator> video_encoder =
+ gpu_factories->CreateVideoEncodeAccelerator();
+ if (video_encoder)
+ *profiles = video_encoder->GetSupportedProfiles();
+ waiter->Signal();
+}
+
void CreateVideoEncodeAccelerator(
const OnCreateVideoEncodeAcceleratorCallback& callback) {
DCHECK(!callback.is_null());
@@ -35,7 +50,21 @@ void CreateVideoEncodeAccelerator(
std::vector<media::VideoEncodeAccelerator::SupportedProfile>
kcwu 2014/09/19 11:15:54 Since you cached the result to global variable, ch
GetSupportedVideoEncodeAcceleratorProfiles() {
- return GpuVideoEncodeAcceleratorHost::GetSupportedProfiles();
+ if (!g_supported_profiles) {
+ g_supported_profiles =
+ new std::vector<media::VideoEncodeAccelerator::SupportedProfile>();
+ scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories =
+ RenderThreadImpl::current()->GetGpuFactories();
+ base::WaitableEvent waiter(true, false);
+ gpu_factories->GetTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&GetSupportedVideoEncodeAcceleratorProfilesInternal,
+ gpu_factories,
+ &waiter,
+ g_supported_profiles));
+ waiter.Wait();
+ }
+ return *g_supported_profiles;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698