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

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

Issue 1801343002: Revert of H264 HW encode using VideoToolbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 13 matching lines...) Expand all
24 24
25 #if defined(OS_CHROMEOS) 25 #if defined(OS_CHROMEOS)
26 #if defined(USE_V4L2_CODEC) 26 #if defined(USE_V4L2_CODEC)
27 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" 27 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h"
28 #endif 28 #endif
29 #if defined(ARCH_CPU_X86_FAMILY) 29 #if defined(ARCH_CPU_X86_FAMILY)
30 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" 30 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h"
31 #endif 31 #endif
32 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 32 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
33 #include "content/common/gpu/media/android_video_encode_accelerator.h" 33 #include "content/common/gpu/media/android_video_encode_accelerator.h"
34 #elif defined(OS_MACOSX)
35 #include "content/common/gpu/media/vt_video_encode_accelerator_mac.h"
36 #endif 34 #endif
37 35
38 namespace content { 36 namespace content {
39 37
40 namespace { 38 namespace {
41 39
42 // Allocation and destruction of buffer are done on the Browser process, so we 40 // Allocation and destruction of buffer are done on the Browser process, so we
43 // don't need to handle synchronization here. 41 // don't need to handle synchronization here.
44 void DestroyGpuMemoryBuffer(const gpu::SyncToken& sync_token) {} 42 void DestroyGpuMemoryBuffer(const gpu::SyncToken& sync_token) {}
45 43
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateV4L2VEA); 204 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateV4L2VEA);
207 #endif 205 #endif
208 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) 206 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
209 if (!gpu_preferences.disable_vaapi_accelerated_video_encode) 207 if (!gpu_preferences.disable_vaapi_accelerated_video_encode)
210 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA); 208 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA);
211 #endif 209 #endif
212 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 210 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
213 if (!gpu_preferences.disable_web_rtc_hw_encoding) 211 if (!gpu_preferences.disable_web_rtc_hw_encoding)
214 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateAndroidVEA); 212 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateAndroidVEA);
215 #endif 213 #endif
216 #if defined(OS_MACOSX)
217 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVTVEA);
218 #endif
219 return create_vea_fps; 214 return create_vea_fps;
220 } 215 }
221 216
222 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) 217 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
223 // static 218 // static
224 scoped_ptr<media::VideoEncodeAccelerator> 219 scoped_ptr<media::VideoEncodeAccelerator>
225 GpuVideoEncodeAccelerator::CreateV4L2VEA() { 220 GpuVideoEncodeAccelerator::CreateV4L2VEA() {
226 scoped_ptr<media::VideoEncodeAccelerator> encoder; 221 scoped_ptr<media::VideoEncodeAccelerator> encoder;
227 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); 222 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder);
228 if (device) 223 if (device)
(...skipping 13 matching lines...) Expand all
242 237
243 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 238 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
244 // static 239 // static
245 scoped_ptr<media::VideoEncodeAccelerator> 240 scoped_ptr<media::VideoEncodeAccelerator>
246 GpuVideoEncodeAccelerator::CreateAndroidVEA() { 241 GpuVideoEncodeAccelerator::CreateAndroidVEA() {
247 return make_scoped_ptr<media::VideoEncodeAccelerator>( 242 return make_scoped_ptr<media::VideoEncodeAccelerator>(
248 new AndroidVideoEncodeAccelerator()); 243 new AndroidVideoEncodeAccelerator());
249 } 244 }
250 #endif 245 #endif
251 246
252 #if defined(OS_MACOSX)
253 // static
254 scoped_ptr<media::VideoEncodeAccelerator>
255 GpuVideoEncodeAccelerator::CreateVTVEA() {
256 return make_scoped_ptr<media::VideoEncodeAccelerator>(
257 new VTVideoEncodeAccelerator());
258 }
259 #endif
260
261 void GpuVideoEncodeAccelerator::OnEncode( 247 void GpuVideoEncodeAccelerator::OnEncode(
262 const AcceleratedVideoEncoderMsg_Encode_Params& params) { 248 const AcceleratedVideoEncoderMsg_Encode_Params& params) {
263 DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode: frame_id = " 249 DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode: frame_id = "
264 << params.frame_id << ", buffer_size=" << params.buffer_size 250 << params.frame_id << ", buffer_size=" << params.buffer_size
265 << ", force_keyframe=" << params.force_keyframe; 251 << ", force_keyframe=" << params.force_keyframe;
266 DCHECK_EQ(media::PIXEL_FORMAT_I420, input_format_); 252 DCHECK_EQ(media::PIXEL_FORMAT_I420, input_format_);
267 253
268 // Wrap into a SharedMemory in the beginning, so that |params.buffer_handle| 254 // Wrap into a SharedMemory in the beginning, so that |params.buffer_handle|
269 // is cleaned properly in case of an early return. 255 // is cleaned properly in case of an early return.
270 scoped_ptr<base::SharedMemory> shm( 256 scoped_ptr<base::SharedMemory> shm(
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 Send(new AcceleratedVideoEncoderHostMsg_NotifyInputDone(host_route_id_, 454 Send(new AcceleratedVideoEncoderHostMsg_NotifyInputDone(host_route_id_,
469 frame_id)); 455 frame_id));
470 // Just let |buffers| fall out of scope. 456 // Just let |buffers| fall out of scope.
471 } 457 }
472 458
473 void GpuVideoEncodeAccelerator::Send(IPC::Message* message) { 459 void GpuVideoEncodeAccelerator::Send(IPC::Message* message) {
474 stub_->channel()->Send(message); 460 stub_->channel()->Send(message);
475 } 461 }
476 462
477 } // namespace content 463 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/gpu_video_encode_accelerator.h ('k') | content/common/gpu/media/video_encode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698