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

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

Issue 8510039: Initial implementation of the DXVA 2.0 H.264 hardware decoder for pepper for Windows. The decodin... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_decode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12
13 #if defined(OS_WIN)
14 #include "base/win/windows_version.h"
15 #endif // OS_WIN
16
12 #include "gpu/command_buffer/common/command_buffer.h" 17 #include "gpu/command_buffer/common/command_buffer.h"
13 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
14 #include "ipc/ipc_message_utils.h" 19 #include "ipc/ipc_message_utils.h"
15 #include "content/common/gpu/gpu_channel.h" 20 #include "content/common/gpu/gpu_channel.h"
16 #include "content/common/gpu/gpu_command_buffer_stub.h" 21 #include "content/common/gpu/gpu_command_buffer_stub.h"
17 #include "content/common/gpu/gpu_messages.h" 22 #include "content/common/gpu/gpu_messages.h"
18 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 23 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
24 #if defined(OS_WIN)
25 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
26 #else // OS_WIN
19 #include "content/common/gpu/media/omx_video_decode_accelerator.h" 27 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
28 #endif
20 #include "ui/gfx/gl/gl_context.h" 29 #include "ui/gfx/gl/gl_context.h"
21 #include "ui/gfx/gl/gl_surface_egl.h" 30 #include "ui/gfx/gl/gl_surface_egl.h"
22 #endif 31 #endif
23 #include "gpu/command_buffer/service/texture_manager.h" 32 #include "gpu/command_buffer/service/texture_manager.h"
24 #include "ui/gfx/size.h" 33 #include "ui/gfx/size.h"
25 34
26 using gpu::gles2::TextureManager; 35 using gpu::gles2::TextureManager;
27 36
28 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( 37 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
29 IPC::Message::Sender* sender, 38 IPC::Message::Sender* sender,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 110 }
102 if (!Send(new AcceleratedVideoDecoderHostMsg_ErrorNotification( 111 if (!Send(new AcceleratedVideoDecoderHostMsg_ErrorNotification(
103 host_route_id_, error))) { 112 host_route_id_, error))) {
104 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ErrorNotification) " 113 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ErrorNotification) "
105 << "failed"; 114 << "failed";
106 } 115 }
107 } 116 }
108 117
109 void GpuVideoDecodeAccelerator::Initialize( 118 void GpuVideoDecodeAccelerator::Initialize(
110 const media::VideoDecodeAccelerator::Profile profile, 119 const media::VideoDecodeAccelerator::Profile profile,
111 IPC::Message* init_done_msg) { 120 IPC::Message* init_done_msg,
121 base::ProcessHandle renderer_process) {
112 DCHECK(!video_decode_accelerator_.get()); 122 DCHECK(!video_decode_accelerator_.get());
113 DCHECK(!init_done_msg_); 123 DCHECK(!init_done_msg_);
114 DCHECK(init_done_msg); 124 DCHECK(init_done_msg);
115 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 125 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
116 DCHECK(stub_ && stub_->decoder()); 126 DCHECK(stub_ && stub_->decoder());
117 init_done_msg_ = init_done_msg; 127 init_done_msg_ = init_done_msg;
Ami GONE FROM CHROMIUM 2011/12/13 02:37:12 This needs to be done outside any of the #if guard
ananta 2011/12/13 02:51:18 Will merge with your change.
118 OmxVideoDecodeAccelerator* omx_decoder = new OmxVideoDecodeAccelerator(this); 128 #if defined(OS_WIN)
119 omx_decoder->SetEglState( 129 if (base::win::GetVersion() < base::win::VERSION_WIN7) {
130 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
131 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
132 return;
133 }
134 DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
135 DXVAVideoDecodeAccelerator* video_decoder =
136 new DXVAVideoDecodeAccelerator(this, renderer_process);
137 #else // OS_WIN
138 OmxVideoDecodeAccelerator* video_decoder =
139 new OmxVideoDecodeAccelerator(this);
140 video_decoder->SetEglState(
120 gfx::GLSurfaceEGL::GetHardwareDisplay(), 141 gfx::GLSurfaceEGL::GetHardwareDisplay(),
121 stub_->decoder()->GetGLContext()->GetHandle()); 142 stub_->decoder()->GetGLContext()->GetHandle());
122 video_decode_accelerator_ = omx_decoder; 143 #endif // OS_WIN
144 video_decode_accelerator_ = video_decoder;
123 video_decode_accelerator_->Initialize(profile); 145 video_decode_accelerator_->Initialize(profile);
124 #else 146 #else
125 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 147 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
126 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 148 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
127 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 149 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
128 } 150 }
129 151
130 void GpuVideoDecodeAccelerator::OnDecode( 152 void GpuVideoDecodeAccelerator::OnDecode(
131 base::SharedMemoryHandle handle, int32 id, int32 size) { 153 base::SharedMemoryHandle handle, int32 id, int32 size) {
132 DCHECK(video_decode_accelerator_.get()); 154 DCHECK(video_decode_accelerator_.get());
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 231
210 void GpuVideoDecodeAccelerator::NotifyResetDone() { 232 void GpuVideoDecodeAccelerator::NotifyResetDone() {
211 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 233 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
212 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 234 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
213 } 235 }
214 236
215 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { 237 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) {
216 DCHECK(sender_); 238 DCHECK(sender_);
217 return sender_->Send(message); 239 return sender_->Send(message);
218 } 240 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698