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

Side by Side Diff: media/gpu/ipc/service/gpu_video_encode_accelerator.cc

Issue 2172703002: Revert of H264 HW encode using MediaFoundation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 "media/gpu/ipc/service/gpu_video_encode_accelerator.h" 5 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 17 matching lines...) Expand all
28 #if defined(USE_V4L2_CODEC) 28 #if defined(USE_V4L2_CODEC)
29 #include "media/gpu/v4l2_video_encode_accelerator.h" 29 #include "media/gpu/v4l2_video_encode_accelerator.h"
30 #endif 30 #endif
31 #if defined(ARCH_CPU_X86_FAMILY) 31 #if defined(ARCH_CPU_X86_FAMILY)
32 #include "media/gpu/vaapi_video_encode_accelerator.h" 32 #include "media/gpu/vaapi_video_encode_accelerator.h"
33 #endif 33 #endif
34 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 34 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
35 #include "media/gpu/android_video_encode_accelerator.h" 35 #include "media/gpu/android_video_encode_accelerator.h"
36 #elif defined(OS_MACOSX) 36 #elif defined(OS_MACOSX)
37 #include "media/gpu/vt_video_encode_accelerator_mac.h" 37 #include "media/gpu/vt_video_encode_accelerator_mac.h"
38 #elif defined(OS_WIN)
39 #include "media/base/media_switches.h"
40 #include "media/gpu/media_foundation_video_encode_accelerator_win.h"
41 #endif 38 #endif
42 39
43 namespace media { 40 namespace media {
44 41
45 static bool MakeDecoderContextCurrent( 42 static bool MakeDecoderContextCurrent(
46 const base::WeakPtr<gpu::GpuCommandBufferStub> stub) { 43 const base::WeakPtr<gpu::GpuCommandBufferStub> stub) {
47 if (!stub) { 44 if (!stub) {
48 DLOG(ERROR) << "Stub is gone; won't MakeCurrent()."; 45 DLOG(ERROR) << "Stub is gone; won't MakeCurrent().";
49 return false; 46 return false;
50 } 47 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if (!gpu_preferences.disable_vaapi_accelerated_video_encode) 201 if (!gpu_preferences.disable_vaapi_accelerated_video_encode)
205 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA); 202 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA);
206 #endif 203 #endif
207 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 204 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
208 if (!gpu_preferences.disable_web_rtc_hw_encoding) 205 if (!gpu_preferences.disable_web_rtc_hw_encoding)
209 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateAndroidVEA); 206 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateAndroidVEA);
210 #endif 207 #endif
211 #if defined(OS_MACOSX) 208 #if defined(OS_MACOSX)
212 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVTVEA); 209 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVTVEA);
213 #endif 210 #endif
214 #if defined(OS_WIN)
215 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
216 switches::kEnableMFH264Encoding)) {
217 create_vea_fps.push_back(
218 &GpuVideoEncodeAccelerator::CreateMediaFoundationVEA);
219 }
220 #endif
221 return create_vea_fps; 211 return create_vea_fps;
222 } 212 }
223 213
224 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) 214 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
225 // static 215 // static
226 std::unique_ptr<VideoEncodeAccelerator> 216 std::unique_ptr<VideoEncodeAccelerator>
227 GpuVideoEncodeAccelerator::CreateV4L2VEA() { 217 GpuVideoEncodeAccelerator::CreateV4L2VEA() {
228 std::unique_ptr<VideoEncodeAccelerator> encoder; 218 std::unique_ptr<VideoEncodeAccelerator> encoder;
229 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); 219 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder);
230 if (device) 220 if (device)
(...skipping 22 matching lines...) Expand all
253 243
254 #if defined(OS_MACOSX) 244 #if defined(OS_MACOSX)
255 // static 245 // static
256 std::unique_ptr<VideoEncodeAccelerator> 246 std::unique_ptr<VideoEncodeAccelerator>
257 GpuVideoEncodeAccelerator::CreateVTVEA() { 247 GpuVideoEncodeAccelerator::CreateVTVEA() {
258 return base::WrapUnique<VideoEncodeAccelerator>( 248 return base::WrapUnique<VideoEncodeAccelerator>(
259 new VTVideoEncodeAccelerator()); 249 new VTVideoEncodeAccelerator());
260 } 250 }
261 #endif 251 #endif
262 252
263 #if defined(OS_WIN)
264 // static
265 std::unique_ptr<media::VideoEncodeAccelerator>
266 GpuVideoEncodeAccelerator::CreateMediaFoundationVEA() {
267 return base::WrapUnique<media::VideoEncodeAccelerator>(
268 new MediaFoundationVideoEncodeAccelerator());
269 }
270 #endif
271
272 void GpuVideoEncodeAccelerator::OnEncode( 253 void GpuVideoEncodeAccelerator::OnEncode(
273 const AcceleratedVideoEncoderMsg_Encode_Params& params) { 254 const AcceleratedVideoEncoderMsg_Encode_Params& params) {
274 DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode: frame_id = " 255 DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode: frame_id = "
275 << params.frame_id << ", buffer_size=" << params.buffer_size 256 << params.frame_id << ", buffer_size=" << params.buffer_size
276 << ", force_keyframe=" << params.force_keyframe; 257 << ", force_keyframe=" << params.force_keyframe;
277 DCHECK_EQ(PIXEL_FORMAT_I420, input_format_); 258 DCHECK_EQ(PIXEL_FORMAT_I420, input_format_);
278 259
279 // Wrap into a SharedMemory in the beginning, so that |params.buffer_handle| 260 // Wrap into a SharedMemory in the beginning, so that |params.buffer_handle|
280 // is cleaned properly in case of an early return. 261 // is cleaned properly in case of an early return.
281 std::unique_ptr<base::SharedMemory> shm( 262 std::unique_ptr<base::SharedMemory> shm(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 Send(new AcceleratedVideoEncoderHostMsg_NotifyInputDone(host_route_id_, 367 Send(new AcceleratedVideoEncoderHostMsg_NotifyInputDone(host_route_id_,
387 frame_id)); 368 frame_id));
388 // Just let |shm| fall out of scope. 369 // Just let |shm| fall out of scope.
389 } 370 }
390 371
391 void GpuVideoEncodeAccelerator::Send(IPC::Message* message) { 372 void GpuVideoEncodeAccelerator::Send(IPC::Message* message) {
392 stub_->channel()->Send(message); 373 stub_->channel()->Send(message);
393 } 374 }
394 375
395 } // namespace media 376 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/ipc/service/gpu_video_encode_accelerator.h ('k') | media/gpu/media_foundation_video_encode_accelerator_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698