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

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

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