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

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)
Ami GONE FROM CHROMIUM 2011/12/16 07:38:54 This can be simplified to: #if cros && armel #incl
ananta 2011/12/17 00:40:25 Left this as is as we also need the "ui/gfx/gl/gl_
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 init_done_msg_ = init_done_msg; 125 init_done_msg_ = init_done_msg;
116 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 126
127 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
117 DCHECK(stub_ && stub_->decoder()); 128 DCHECK(stub_ && stub_->decoder());
118 OmxVideoDecodeAccelerator* omx_decoder = new OmxVideoDecodeAccelerator(this); 129 #if defined(OS_WIN)
119 omx_decoder->SetEglState( 130 if (base::win::GetVersion() < base::win::VERSION_WIN7) {
131 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
132 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
133 return;
134 }
135 DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
136 DXVAVideoDecodeAccelerator* video_decoder =
137 new DXVAVideoDecodeAccelerator(this, renderer_process);
138 #else // OS_WIN
139 OmxVideoDecodeAccelerator* video_decoder =
140 new OmxVideoDecodeAccelerator(this);
141 video_decoder->SetEglState(
120 gfx::GLSurfaceEGL::GetHardwareDisplay(), 142 gfx::GLSurfaceEGL::GetHardwareDisplay(),
121 stub_->decoder()->GetGLContext()->GetHandle()); 143 stub_->decoder()->GetGLContext()->GetHandle());
122 video_decode_accelerator_ = omx_decoder; 144 #endif // OS_WIN
145 video_decode_accelerator_ = video_decoder;
123 video_decode_accelerator_->Initialize(profile); 146 video_decode_accelerator_->Initialize(profile);
124 #else // Update RenderViewImpl::createMediaPlayer when adding clauses. 147 #else // Update RenderViewImpl::createMediaPlayer when adding clauses.
125 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 148 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
126 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 149 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
127 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 150 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
128 } 151 }
129 152
130 void GpuVideoDecodeAccelerator::OnDecode( 153 void GpuVideoDecodeAccelerator::OnDecode(
131 base::SharedMemoryHandle handle, int32 id, int32 size) { 154 base::SharedMemoryHandle handle, int32 id, int32 size) {
132 DCHECK(video_decode_accelerator_.get()); 155 DCHECK(video_decode_accelerator_.get());
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 232
210 void GpuVideoDecodeAccelerator::NotifyResetDone() { 233 void GpuVideoDecodeAccelerator::NotifyResetDone() {
211 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 234 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
212 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 235 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
213 } 236 }
214 237
215 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { 238 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) {
216 DCHECK(sender_); 239 DCHECK(sender_);
217 return sender_->Send(message); 240 return sender_->Send(message);
218 } 241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698