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