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/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 struct VaapiVideoEncodeAccelerator::BitstreamBufferRef { | 99 struct VaapiVideoEncodeAccelerator::BitstreamBufferRef { |
100 BitstreamBufferRef(int32 id, scoped_ptr<base::SharedMemory> shm, size_t size) | 100 BitstreamBufferRef(int32 id, scoped_ptr<base::SharedMemory> shm, size_t size) |
101 : id(id), shm(shm.Pass()), size(size) {} | 101 : id(id), shm(shm.Pass()), size(size) {} |
102 const int32 id; | 102 const int32 id; |
103 const scoped_ptr<base::SharedMemory> shm; | 103 const scoped_ptr<base::SharedMemory> shm; |
104 const size_t size; | 104 const size_t size; |
105 }; | 105 }; |
106 | 106 |
107 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 107 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
108 VaapiVideoEncodeAccelerator::GetSupportedProfiles() { | 108 VaapiVideoEncodeAccelerator::GetSupportedProfiles() { |
109 std::vector<SupportedProfile> profiles; | |
110 | |
111 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 109 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
112 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) | 110 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) |
113 return profiles; | 111 return std::vector<SupportedProfile>(); |
114 | 112 |
115 SupportedProfile profile; | 113 std::vector<media::VideoCodecProfile> codecs = |
Pawel Osciak
2014/09/26 07:15:12
maybe:
s/codecs/hw_profiles/ ?
wuchengli
2014/09/26 09:02:28
Done.
The construction of VEA::SupportedProfiles
| |
116 profile.profile = media::H264PROFILE_MAIN; | 114 VaapiWrapper::GetSupportedProfiles(x_display_, |
115 base::Bind(&ReportToUMA, VAAPI_ERROR)); | |
116 | |
117 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; | |
118 media::VideoEncodeAccelerator::SupportedProfile profile; | |
117 profile.max_resolution.SetSize(1920, 1088); | 119 profile.max_resolution.SetSize(1920, 1088); |
kcwu
2014/09/26 07:50:45
Is this detectable?
Pawel Osciak
2014/09/26 07:52:27
No.
| |
118 profile.max_framerate_numerator = kDefaultFramerate; | 120 profile.max_framerate_numerator = kDefaultFramerate; |
119 profile.max_framerate_denominator = 1; | 121 profile.max_framerate_denominator = 1; |
120 profiles.push_back(profile); | 122 for (size_t i = 0; i < codecs.size(); i++) { |
121 | 123 profile.profile = codecs[i]; |
122 // This is actually only constrained (see crbug.com/345569). | 124 profiles.push_back(profile); |
123 profile.profile = media::H264PROFILE_BASELINE; | 125 } |
124 profiles.push_back(profile); | |
125 | |
126 profile.profile = media::H264PROFILE_HIGH; | |
127 profiles.push_back(profile); | |
128 | |
129 return profiles; | 126 return profiles; |
130 } | 127 } |
131 | 128 |
132 static unsigned int Log2OfPowerOf2(unsigned int x) { | 129 static unsigned int Log2OfPowerOf2(unsigned int x) { |
133 CHECK_GT(x, 0u); | 130 CHECK_GT(x, 0u); |
134 DCHECK_EQ(x & (x - 1), 0u); | 131 DCHECK_EQ(x & (x - 1), 0u); |
135 | 132 |
136 int log = 0; | 133 int log = 0; |
137 while (x) { | 134 while (x) { |
138 x >>= 1; | 135 x >>= 1; |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 } | 1058 } |
1062 | 1059 |
1063 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1060 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
1064 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1061 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
1065 } | 1062 } |
1066 | 1063 |
1067 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1064 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
1068 } | 1065 } |
1069 | 1066 |
1070 } // namespace content | 1067 } // namespace content |
OLD | NEW |