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

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: rebase 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 scoped_ptr<media::VideoEncodeAccelerator> encoder = CreateEncoder(); 168 scoped_ptr<media::VideoEncodeAccelerator> encoder = CreateEncoder();
169 if (!encoder) 169 if (!encoder)
170 return std::vector<media::VideoEncodeAccelerator::SupportedProfile>(); 170 return std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>();
171 return encoder->GetSupportedProfiles(); 171 return ConvertMediaToGpuProfiles(encoder->GetSupportedProfiles());
172 }
173
174 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
175 GpuVideoEncodeAccelerator::ConvertMediaToGpuProfiles(const std::vector<
176 media::VideoEncodeAccelerator::SupportedProfile>& media_profiles) {
177 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> profiles;
178 for (size_t i = 0; i < media_profiles.size(); i++) {
179 gpu::VideoEncodeAcceleratorSupportedProfile profile;
180 profile.profile =
181 static_cast<gpu::VideoCodecProfile>(media_profiles[i].profile);
182 profile.max_resolution = media_profiles[i].max_resolution;
183 profile.max_framerate_numerator = media_profiles[i].max_framerate_numerator;
184 profile.max_framerate_denominator =
185 media_profiles[i].max_framerate_denominator;
186 profiles.push_back(profile);
187 }
188 return profiles;
172 } 189 }
173 190
174 scoped_ptr<media::VideoEncodeAccelerator> 191 scoped_ptr<media::VideoEncodeAccelerator>
175 GpuVideoEncodeAccelerator::CreateEncoder() { 192 GpuVideoEncodeAccelerator::CreateEncoder() {
176 scoped_ptr<media::VideoEncodeAccelerator> encoder; 193 scoped_ptr<media::VideoEncodeAccelerator> encoder;
177 #if defined(OS_CHROMEOS) && defined(USE_X11) 194 #if defined(OS_CHROMEOS) && defined(USE_X11)
178 #if defined(ARCH_CPU_ARMEL) 195 #if defined(ARCH_CPU_ARMEL)
179 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); 196 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder);
180 if (device) 197 if (device)
181 encoder.reset(new V4L2VideoEncodeAccelerator(device.Pass())); 198 encoder.reset(new V4L2VideoEncodeAccelerator(device.Pass()));
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 stub_->channel()->Send(message); 315 stub_->channel()->Send(message);
299 } 316 }
300 317
301 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, 318 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message,
302 bool succeeded) { 319 bool succeeded) {
303 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); 320 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded);
304 Send(message); 321 Send(message);
305 } 322 }
306 323
307 } // namespace content 324 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698