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

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

Issue 668633002: Duplicate VideoEncodeAccelerator::SupportedProfile in gpu_info.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/gpu_video_encode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 void GpuVideoEncodeAccelerator::OnWillDestroyStub() { 157 void GpuVideoEncodeAccelerator::OnWillDestroyStub() {
158 DCHECK(stub_); 158 DCHECK(stub_);
159 stub_->channel()->RemoveRoute(host_route_id_); 159 stub_->channel()->RemoveRoute(host_route_id_);
160 stub_->RemoveDestructionObserver(this); 160 stub_->RemoveDestructionObserver(this);
161 encoder_.reset(); 161 encoder_.reset();
162 delete this; 162 delete this;
163 } 163 }
164 164
165 // static 165 // static
166 std::vector<media::VideoEncodeAccelerator::SupportedProfile> 166 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
167 GpuVideoEncodeAccelerator::GetSupportedProfiles() { 167 GpuVideoEncodeAccelerator::GetSupportedProfiles() {
168 #if defined(OS_CHROMEOS) && defined(USE_X11) && defined(ARCH_CPU_ARMEL) 168 #if defined(OS_CHROMEOS) && defined(USE_X11) && defined(ARCH_CPU_ARMEL)
169 // This is a work-around for M39 because the video device is not ready at 169 // This is a work-around for M39 because the video device is not ready at
170 // boot. 170 // boot.
171 // TODO(wuchengli): remove this after http://crbug.com/418762 is fixed. 171 // TODO(wuchengli): remove this after http://crbug.com/418762 is fixed.
172 return V4L2VideoEncodeAccelerator::GetSupportedProfilesStatic(); 172 return ConvertMediaToGpuProfiles(
173 V4L2VideoEncodeAccelerator::GetSupportedProfilesStatic());
173 #endif 174 #endif
174 scoped_ptr<media::VideoEncodeAccelerator> encoder = CreateEncoder(); 175 scoped_ptr<media::VideoEncodeAccelerator> encoder = CreateEncoder();
175 if (!encoder) 176 if (!encoder)
176 return std::vector<media::VideoEncodeAccelerator::SupportedProfile>(); 177 return std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>();
177 return encoder->GetSupportedProfiles(); 178 return ConvertMediaToGpuProfiles(encoder->GetSupportedProfiles());
179 }
180
181 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
182 GpuVideoEncodeAccelerator::ConvertMediaToGpuProfiles(const std::vector<
183 media::VideoEncodeAccelerator::SupportedProfile>& media_profiles) {
184 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> profiles;
185 for (size_t i = 0; i < media_profiles.size(); i++) {
186 gpu::VideoEncodeAcceleratorSupportedProfile profile;
187 profile.profile =
188 static_cast<gpu::VideoCodecProfile>(media_profiles[i].profile);
189 profile.max_resolution = media_profiles[i].max_resolution;
190 profile.max_framerate_numerator = media_profiles[i].max_framerate_numerator;
191 profile.max_framerate_denominator =
192 media_profiles[i].max_framerate_denominator;
193 profiles.push_back(profile);
194 }
195 return profiles;
178 } 196 }
179 197
180 scoped_ptr<media::VideoEncodeAccelerator> 198 scoped_ptr<media::VideoEncodeAccelerator>
181 GpuVideoEncodeAccelerator::CreateEncoder() { 199 GpuVideoEncodeAccelerator::CreateEncoder() {
182 scoped_ptr<media::VideoEncodeAccelerator> encoder; 200 scoped_ptr<media::VideoEncodeAccelerator> encoder;
183 #if defined(OS_CHROMEOS) && defined(USE_X11) 201 #if defined(OS_CHROMEOS) && defined(USE_X11)
184 #if defined(ARCH_CPU_ARMEL) 202 #if defined(ARCH_CPU_ARMEL)
185 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); 203 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder);
186 if (device) 204 if (device)
187 encoder.reset(new V4L2VideoEncodeAccelerator(device.Pass())); 205 encoder.reset(new V4L2VideoEncodeAccelerator(device.Pass()));
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 stub_->channel()->Send(message); 322 stub_->channel()->Send(message);
305 } 323 }
306 324
307 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, 325 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message,
308 bool succeeded) { 326 bool succeeded) {
309 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); 327 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded);
310 Send(message); 328 Send(message);
311 } 329 }
312 330
313 } // namespace content 331 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698