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

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

Issue 10411042: hook up new MacVideoDecodeAccelerator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/common/gles2_cmd_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 12
13 #if defined(OS_WIN)
14 #include "base/win/windows_version.h"
15 #endif // OS_WIN
16
17 #include "content/common/gpu/gpu_channel.h" 13 #include "content/common/gpu/gpu_channel.h"
18 #include "content/common/gpu/gpu_command_buffer_stub.h" 14 #include "content/common/gpu/gpu_command_buffer_stub.h"
19 #include "content/common/gpu/gpu_messages.h" 15 #include "content/common/gpu/gpu_messages.h"
20 #include "gpu/command_buffer/common/command_buffer.h" 16 #include "gpu/command_buffer/common/command_buffer.h"
17 #include "gpu/command_buffer/service/texture_manager.h"
21 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
22 #include "ipc/ipc_message_utils.h" 19 #include "ipc/ipc_message_utils.h"
23 20 #include "ui/gfx/size.h"
24 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
25 #if defined(OS_WIN)
26 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
27 #else // OS_WIN
28 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
29 #endif // OS_WIN
30 #include "ui/gl/gl_context.h" 21 #include "ui/gl/gl_context.h"
31 #include "ui/gl/gl_surface_egl.h" 22 #include "ui/gl/gl_surface_egl.h"
23
24 #if defined(OS_WIN)
25 #include "base/win/windows_version.h"
26 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
27 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
28 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
29 #elif defined(OS_MACOSX)
30 #include "content/common/gpu/media/mac_video_decode_accelerator.h"
32 #endif 31 #endif
33 32
34 #include "gpu/command_buffer/service/texture_manager.h"
35 #include "ui/gfx/size.h"
36
37 using gpu::gles2::TextureManager; 33 using gpu::gles2::TextureManager;
38 34
39 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( 35 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
40 IPC::Message::Sender* sender, 36 IPC::Message::Sender* sender,
41 int32 host_route_id, 37 int32 host_route_id,
42 GpuCommandBufferStub* stub) 38 GpuCommandBufferStub* stub)
43 : sender_(sender), 39 : sender_(sender),
44 init_done_msg_(NULL), 40 init_done_msg_(NULL),
45 host_route_id_(host_route_id), 41 host_route_id_(host_route_id),
46 stub_(stub), 42 stub_(stub),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 114 }
119 115
120 void GpuVideoDecodeAccelerator::Initialize( 116 void GpuVideoDecodeAccelerator::Initialize(
121 const media::VideoCodecProfile profile, 117 const media::VideoCodecProfile profile,
122 IPC::Message* init_done_msg) { 118 IPC::Message* init_done_msg) {
123 DCHECK(!video_decode_accelerator_.get()); 119 DCHECK(!video_decode_accelerator_.get());
124 DCHECK(!init_done_msg_); 120 DCHECK(!init_done_msg_);
125 DCHECK(init_done_msg); 121 DCHECK(init_done_msg);
126 init_done_msg_ = init_done_msg; 122 init_done_msg_ = init_done_msg;
127 123
128 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
129 DCHECK(stub_ && stub_->decoder());
130 #if defined(OS_WIN) 124 #if defined(OS_WIN)
131 if (base::win::GetVersion() < base::win::VERSION_WIN7) { 125 if (base::win::GetVersion() < base::win::VERSION_WIN7) {
132 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 126 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
133 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 127 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
134 return; 128 return;
135 } 129 }
136 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; 130 DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
137 DXVAVideoDecodeAccelerator* video_decoder = 131 scoped_refptr<DXVAVideoDecodeAccelerator> video_decoder(
138 new DXVAVideoDecodeAccelerator(this); 132 new DXVAVideoDecodeAccelerator(this));
139 #else // OS_WIN 133 video_decode_accelerator_ = video_decoder;
140 OmxVideoDecodeAccelerator* video_decoder = 134 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
141 new OmxVideoDecodeAccelerator(this); 135 scoped_refptr<OmxVideoDecodeAccelerator> video_decoder(
136 new OmxVideoDecodeAccelerator(this));
142 video_decoder->SetEglState( 137 video_decoder->SetEglState(
143 gfx::GLSurfaceEGL::GetHardwareDisplay(), 138 gfx::GLSurfaceEGL::GetHardwareDisplay(),
144 stub_->decoder()->GetGLContext()->GetHandle()); 139 stub_->decoder()->GetGLContext()->GetHandle());
145 #endif // OS_WIN 140 #elif defined(OS_MACOSX)
141 scoped_refptr<MacVideoDecodeAccelerator> video_decoder(
142 new MacVideoDecodeAccelerator(this));
143 video_decoder->SetCGLContext(static_cast<CGLContextObj>(
144 stub_->decoder()->GetGLContext()->GetHandle()));
146 video_decode_accelerator_ = video_decoder; 145 video_decode_accelerator_ = video_decoder;
146 #else
147 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
148 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
149 return;
150 #endif
151
147 if (!video_decode_accelerator_->Initialize(profile)) 152 if (!video_decode_accelerator_->Initialize(profile))
148 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 153 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
149 #else // Update RenderViewImpl::createMediaPlayer when adding clauses.
150 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
151 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
152 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
153 } 154 }
154 155
155 void GpuVideoDecodeAccelerator::OnDecode( 156 void GpuVideoDecodeAccelerator::OnDecode(
156 base::SharedMemoryHandle handle, int32 id, int32 size) { 157 base::SharedMemoryHandle handle, int32 id, int32 size) {
157 DCHECK(video_decode_accelerator_.get()); 158 DCHECK(video_decode_accelerator_.get());
158 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); 159 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size));
159 } 160 }
160 161
161 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( 162 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
162 const std::vector<int32>& buffer_ids, 163 const std::vector<int32>& buffer_ids,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 239
239 void GpuVideoDecodeAccelerator::NotifyResetDone() { 240 void GpuVideoDecodeAccelerator::NotifyResetDone() {
240 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 241 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
241 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 242 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
242 } 243 }
243 244
244 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { 245 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) {
245 DCHECK(sender_); 246 DCHECK(sender_);
246 return sender_->Send(message); 247 return sender_->Send(message);
247 } 248 }
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/common/gles2_cmd_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698