OLD | NEW |
---|---|
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 "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/cpu.h" | |
10 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
13 #include "content/common/gpu/media/h264_dpb.h" | 14 #include "content/common/gpu/media/h264_dpb.h" |
14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
15 #include "media/base/bind_to_current_loop.h" | 16 #include "media/base/bind_to_current_loop.h" |
16 #include "third_party/libva/va/va_enc_h264.h" | 17 #include "third_party/libva/va/va_enc_h264.h" |
17 | 18 |
18 #define DVLOGF(level) DVLOG(level) << __FUNCTION__ << "(): " | 19 #define DVLOGF(level) DVLOG(level) << __FUNCTION__ << "(): " |
19 | 20 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 const int32 id; | 103 const int32 id; |
103 const scoped_ptr<base::SharedMemory> shm; | 104 const scoped_ptr<base::SharedMemory> shm; |
104 const size_t size; | 105 const size_t size; |
105 }; | 106 }; |
106 | 107 |
107 // static | 108 // static |
108 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 109 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
109 VaapiVideoEncodeAccelerator::GetSupportedProfiles() { | 110 VaapiVideoEncodeAccelerator::GetSupportedProfiles() { |
110 std::vector<SupportedProfile> profiles; | 111 std::vector<SupportedProfile> profiles; |
111 | 112 |
113 base::CPU cpu; | |
112 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 114 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
113 if (!cmd_line->HasSwitch(switches::kEnableVaapiAcceleratedVideoEncode)) | 115 bool encode_enabled = |
116 (!cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode) && | |
117 (cpu.vendor_name() == "GenuineIntel") && (cpu.model() == 55)); | |
piman
2014/07/07 17:57:47
You said this was used in the renderer? Does this
Pawel Osciak
2014/07/08 05:32:42
Yes, this is in renderer. PreSandboxStartup() (htt
| |
118 | |
119 if (!encode_enabled) | |
114 return profiles; | 120 return profiles; |
115 | 121 |
116 SupportedProfile profile; | 122 SupportedProfile profile; |
117 profile.profile = media::H264PROFILE_MAIN; | 123 profile.profile = media::H264PROFILE_MAIN; |
118 profile.max_resolution.SetSize(1920, 1088); | 124 profile.max_resolution.SetSize(1920, 1088); |
119 profile.max_framerate.numerator = kDefaultFramerate; | 125 profile.max_framerate.numerator = kDefaultFramerate; |
120 profile.max_framerate.denominator = 1; | 126 profile.max_framerate.denominator = 1; |
121 profiles.push_back(profile); | 127 profiles.push_back(profile); |
122 | 128 |
123 // This is actually only constrained (see crbug.com/345569). | 129 // This is actually only constrained (see crbug.com/345569). |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1052 } | 1058 } |
1053 | 1059 |
1054 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1060 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
1055 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1061 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
1056 } | 1062 } |
1057 | 1063 |
1058 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1064 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
1059 } | 1065 } |
1060 | 1066 |
1061 } // namespace content | 1067 } // namespace content |
OLD | NEW |