| 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 const gfx::Size& frame_size, |
| 120 const std::vector<uint8_t>& extra_data, |
| 119 IPC::Message* init_done_msg) { | 121 IPC::Message* init_done_msg) { |
| 120 DCHECK(!video_decode_accelerator_.get()); | 122 DCHECK(!video_decode_accelerator_.get()); |
| 121 DCHECK(!init_done_msg_); | 123 DCHECK(!init_done_msg_); |
| 122 DCHECK(init_done_msg); | 124 DCHECK(init_done_msg); |
| 123 init_done_msg_ = init_done_msg; | 125 init_done_msg_ = init_done_msg; |
| 124 | 126 |
| 125 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN) | 127 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN) |
| 126 DCHECK(stub_ && stub_->decoder()); | 128 DCHECK(stub_ && stub_->decoder()); |
| 127 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
| 128 if (base::win::GetVersion() < base::win::VERSION_WIN7) { | 130 if (base::win::GetVersion() < base::win::VERSION_WIN7) { |
| 129 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 131 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
| 130 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 132 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 131 return; | 133 return; |
| 132 } | 134 } |
| 133 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; | 135 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; |
| 134 DXVAVideoDecodeAccelerator* video_decoder = | 136 DXVAVideoDecodeAccelerator* video_decoder = |
| 135 new DXVAVideoDecodeAccelerator(this); | 137 new DXVAVideoDecodeAccelerator(this); |
| 136 #else // OS_WIN | 138 #else // OS_WIN |
| 137 OmxVideoDecodeAccelerator* video_decoder = | 139 OmxVideoDecodeAccelerator* video_decoder = |
| 138 new OmxVideoDecodeAccelerator(this); | 140 new OmxVideoDecodeAccelerator(this); |
| 139 video_decoder->SetEglState( | 141 video_decoder->SetEglState( |
| 140 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 142 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
| 141 stub_->decoder()->GetGLContext()->GetHandle()); | 143 stub_->decoder()->GetGLContext()->GetHandle()); |
| 142 #endif // OS_WIN | 144 #endif // OS_WIN |
| 143 video_decode_accelerator_ = video_decoder; | 145 video_decode_accelerator_ = video_decoder; |
| 144 if (!video_decode_accelerator_->Initialize(profile)) | 146 if (!video_decode_accelerator_->Initialize(profile, frame_size, extra_data)) |
| 145 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 147 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 146 #else // Update RenderViewImpl::createMediaPlayer when adding clauses. | 148 #else // Update RenderViewImpl::createMediaPlayer when adding clauses. |
| 147 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 149 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
| 148 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 150 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 149 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 151 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 150 } | 152 } |
| 151 | 153 |
| 152 void GpuVideoDecodeAccelerator::OnDecode( | 154 void GpuVideoDecodeAccelerator::OnDecode( |
| 153 base::SharedMemoryHandle handle, int32 id, int32 size) { | 155 base::SharedMemoryHandle handle, int32 id, int32 size) { |
| 154 DCHECK(video_decode_accelerator_.get()); | 156 DCHECK(video_decode_accelerator_.get()); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 237 |
| 236 void GpuVideoDecodeAccelerator::NotifyResetDone() { | 238 void GpuVideoDecodeAccelerator::NotifyResetDone() { |
| 237 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) | 239 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) |
| 238 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; | 240 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; |
| 239 } | 241 } |
| 240 | 242 |
| 241 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 243 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
| 242 DCHECK(sender_); | 244 DCHECK(sender_); |
| 243 return sender_->Send(message); | 245 return sender_->Send(message); |
| 244 } | 246 } |
| OLD | NEW |