OLD | NEW |
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" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 if (!Send(new AcceleratedVideoDecoderHostMsg_ErrorNotification( | 110 if (!Send(new AcceleratedVideoDecoderHostMsg_ErrorNotification( |
111 host_route_id_, error))) { | 111 host_route_id_, error))) { |
112 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ErrorNotification) " | 112 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ErrorNotification) " |
113 << "failed"; | 113 << "failed"; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 void GpuVideoDecodeAccelerator::Initialize( | 117 void GpuVideoDecodeAccelerator::Initialize( |
118 const media::VideoCodecProfile profile, | 118 const media::VideoCodecProfile profile, |
119 IPC::Message* init_done_msg) { | 119 IPC::Message* init_done_msg, |
| 120 base::ProcessHandle renderer_process) { |
120 DCHECK(!video_decode_accelerator_.get()); | 121 DCHECK(!video_decode_accelerator_.get()); |
121 DCHECK(!init_done_msg_); | 122 DCHECK(!init_done_msg_); |
122 DCHECK(init_done_msg); | 123 DCHECK(init_done_msg); |
123 init_done_msg_ = init_done_msg; | 124 init_done_msg_ = init_done_msg; |
124 | 125 |
125 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN) | 126 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN) |
126 DCHECK(stub_ && stub_->decoder()); | 127 DCHECK(stub_ && stub_->decoder()); |
127 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
128 if (base::win::GetVersion() < base::win::VERSION_WIN7) { | 129 if (base::win::GetVersion() < base::win::VERSION_WIN7) { |
129 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 130 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
130 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 131 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
131 return; | 132 return; |
132 } | 133 } |
133 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; | 134 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; |
134 DXVAVideoDecodeAccelerator* video_decoder = | 135 DXVAVideoDecodeAccelerator* video_decoder = |
135 new DXVAVideoDecodeAccelerator(this); | 136 new DXVAVideoDecodeAccelerator(this, renderer_process); |
136 #else // OS_WIN | 137 #else // OS_WIN |
137 OmxVideoDecodeAccelerator* video_decoder = | 138 OmxVideoDecodeAccelerator* video_decoder = |
138 new OmxVideoDecodeAccelerator(this); | 139 new OmxVideoDecodeAccelerator(this); |
139 video_decoder->SetEglState( | 140 video_decoder->SetEglState( |
140 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 141 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
141 stub_->decoder()->GetGLContext()->GetHandle()); | 142 stub_->decoder()->GetGLContext()->GetHandle()); |
142 #endif // OS_WIN | 143 #endif // OS_WIN |
143 video_decode_accelerator_ = video_decoder; | 144 video_decode_accelerator_ = video_decoder; |
144 if (!video_decode_accelerator_->Initialize(profile)) | 145 if (!video_decode_accelerator_->Initialize(profile)) |
145 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 146 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 236 |
236 void GpuVideoDecodeAccelerator::NotifyResetDone() { | 237 void GpuVideoDecodeAccelerator::NotifyResetDone() { |
237 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) | 238 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) |
238 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; | 239 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; |
239 } | 240 } |
240 | 241 |
241 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 242 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
242 DCHECK(sender_); | 243 DCHECK(sender_); |
243 return sender_->Send(message); | 244 return sender_->Send(message); |
244 } | 245 } |
OLD | NEW |