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

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: clean up Created 8 years, 7 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
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"
20 #include "ui/gfx/size.h"
21 #include "ui/gl/gl_context.h"
22 #include "ui/gl/gl_surface_egl.h"
23 23
24 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
25 #if defined(OS_WIN) 24 #if defined(OS_WIN)
26 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" 25 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
27 #else // OS_WIN 26 #include "base/win/windows_version.h"
jochen (gone - plz use gerrit) 2012/05/19 20:16:11 nit. alphabetical ordering
Ami GONE FROM CHROMIUM 2012/05/19 20:46:12 sort order
sail 2012/05/30 03:51:33 Done.
sail 2012/05/30 03:51:33 Done.
27 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
28 #include "content/common/gpu/media/omx_video_decode_accelerator.h" 28 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
29 #endif // OS_WIN 29 #elif defined(OS_MACOSX)
30 #include "ui/gl/gl_context.h" 30 #include "content/common/gpu/media/mac_video_decode_accelerator.h"
31 #include "ui/gl/gl_surface_egl.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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void GpuVideoDecodeAccelerator::Initialize( 116 void GpuVideoDecodeAccelerator::Initialize(
121 const media::VideoCodecProfile profile, 117 const media::VideoCodecProfile profile,
122 const gfx::Size& frame_size, 118 const gfx::Size& frame_size,
123 const std::vector<uint8_t>& extra_data, 119 const std::vector<uint8_t>& extra_data,
124 IPC::Message* init_done_msg) { 120 IPC::Message* init_done_msg) {
125 DCHECK(!video_decode_accelerator_.get()); 121 DCHECK(!video_decode_accelerator_.get());
126 DCHECK(!init_done_msg_); 122 DCHECK(!init_done_msg_);
127 DCHECK(init_done_msg); 123 DCHECK(init_done_msg);
128 init_done_msg_ = init_done_msg; 124 init_done_msg_ = init_done_msg;
129 125
130 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
131 DCHECK(stub_ && stub_->decoder());
132 #if defined(OS_WIN) 126 #if defined(OS_WIN)
133 if (base::win::GetVersion() < base::win::VERSION_WIN7) { 127 if (base::win::GetVersion() < base::win::VERSION_WIN7) {
134 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 128 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
135 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 129 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
136 return; 130 return;
137 } 131 }
138 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; 132 DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
139 DXVAVideoDecodeAccelerator* video_decoder = 133 scoped_refptr<DXVAVideoDecodeAccelerator> video_decoder(
Ami GONE FROM CHROMIUM 2012/05/19 20:46:12 Since you're already duplicating the assignment to
sail 2012/05/29 04:21:28 Unfortunately, the code still needs to be able to
140 new DXVAVideoDecodeAccelerator(this); 134 new DXVAVideoDecodeAccelerator(this));
141 #else // OS_WIN 135 video_decode_accelerator_ = video_decoder;
142 OmxVideoDecodeAccelerator* video_decoder = 136 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
143 new OmxVideoDecodeAccelerator(this); 137 scoped_refptr<OmxVideoDecodeAccelerator> video_decoder(
138 new OmxVideoDecodeAccelerator(this));
144 video_decoder->SetEglState( 139 video_decoder->SetEglState(
145 gfx::GLSurfaceEGL::GetHardwareDisplay(), 140 gfx::GLSurfaceEGL::GetHardwareDisplay(),
146 stub_->decoder()->GetGLContext()->GetHandle()); 141 stub_->decoder()->GetGLContext()->GetHandle());
147 #endif // OS_WIN
148 video_decode_accelerator_ = video_decoder; 142 video_decode_accelerator_ = video_decoder;
149 if (!video_decode_accelerator_->Initialize(profile, frame_size, extra_data)) 143 #elif defined(OS_MACOSX)
150 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 144 scoped_refptr<MacVideoDecodeAccelerator> video_decoder(
145 new MacVideoDecodeAccelerator(this));
146 video_decoder->SetGLContext(stub_->decoder()->GetGLContext()->GetHandle());
147 video_decode_accelerator_ = video_decoder;
151 #else // Update RenderViewImpl::createMediaPlayer when adding clauses. 148 #else // Update RenderViewImpl::createMediaPlayer when adding clauses.
Ami GONE FROM CHROMIUM 2012/05/19 20:46:12 I'm pretty sure you need to rebase this CL to pick
sail 2012/05/29 04:21:28 Yea definitely. I'll rebase all the CLs as things
152 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 149 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
153 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 150 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
154 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 151 return;
152 #endif
153
154 if (!video_decode_accelerator_->Initialize(profile, frame_size, extra_data))
155 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
155 } 156 }
156 157
157 void GpuVideoDecodeAccelerator::OnDecode( 158 void GpuVideoDecodeAccelerator::OnDecode(
158 base::SharedMemoryHandle handle, int32 id, int32 size) { 159 base::SharedMemoryHandle handle, int32 id, int32 size) {
159 DCHECK(video_decode_accelerator_.get()); 160 DCHECK(video_decode_accelerator_.get());
160 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); 161 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size));
161 } 162 }
162 163
163 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( 164 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
164 const std::vector<int32>& buffer_ids, 165 const std::vector<int32>& buffer_ids,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 241
241 void GpuVideoDecodeAccelerator::NotifyResetDone() { 242 void GpuVideoDecodeAccelerator::NotifyResetDone() {
242 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 243 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
243 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 244 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
244 } 245 }
245 246
246 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { 247 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) {
247 DCHECK(sender_); 248 DCHECK(sender_);
248 return sender_->Send(message); 249 return sender_->Send(message);
249 } 250 }
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/common/gles2_cmd_utils.cc » ('j') | ppapi/examples/video_decode/video_decode.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698