| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_PictureReady) failed"; | 79 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_PictureReady) failed"; |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 void GpuVideoDecodeAccelerator::NotifyEndOfStream() { | 83 void GpuVideoDecodeAccelerator::NotifyEndOfStream() { |
| 84 Send(new AcceleratedVideoDecoderHostMsg_EndOfStream(host_route_id_)); | 84 Send(new AcceleratedVideoDecoderHostMsg_EndOfStream(host_route_id_)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void GpuVideoDecodeAccelerator::NotifyError( | 87 void GpuVideoDecodeAccelerator::NotifyError( |
| 88 media::VideoDecodeAccelerator::Error error) { | 88 media::VideoDecodeAccelerator::Error error) { |
| 89 if (init_done_msg_) { |
| 90 // If we get an error while we're initializing, NotifyInitializeDone won't |
| 91 // be called, so we need to send the reply (with an error) here. |
| 92 init_done_msg_->set_reply_error(); |
| 93 Send(init_done_msg_); |
| 94 init_done_msg_ = NULL; |
| 95 } |
| 89 if (!Send(new AcceleratedVideoDecoderHostMsg_ErrorNotification( | 96 if (!Send(new AcceleratedVideoDecoderHostMsg_ErrorNotification( |
| 90 host_route_id_, error))) { | 97 host_route_id_, error))) { |
| 91 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ErrorNotification) " | 98 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ErrorNotification) " |
| 92 << "failed"; | 99 << "failed"; |
| 93 } | 100 } |
| 94 } | 101 } |
| 95 | 102 |
| 96 void GpuVideoDecodeAccelerator::Initialize( | 103 void GpuVideoDecodeAccelerator::Initialize( |
| 97 const std::vector<int32>& configs, | 104 const std::vector<int32>& configs, |
| 98 IPC::Message* init_done_msg) { | 105 IPC::Message* init_done_msg) { |
| 99 DCHECK(!video_decode_accelerator_.get()); | 106 DCHECK(!video_decode_accelerator_.get()); |
| 100 DCHECK(!init_done_msg_); | 107 DCHECK(!init_done_msg_); |
| 101 DCHECK(init_done_msg); | 108 DCHECK(init_done_msg); |
| 102 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 109 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 103 DCHECK(stub_ && stub_->scheduler()); | 110 DCHECK(stub_ && stub_->scheduler()); |
| 104 init_done_msg_ = init_done_msg; | 111 init_done_msg_ = init_done_msg; |
| 105 OmxVideoDecodeAccelerator* omx_decoder = new OmxVideoDecodeAccelerator(this); | 112 OmxVideoDecodeAccelerator* omx_decoder = new OmxVideoDecodeAccelerator(this); |
| 106 omx_decoder->SetEglState( | 113 omx_decoder->SetEglState( |
| 107 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 114 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
| 108 stub_->scheduler()->decoder()->GetGLContext()->GetHandle()); | 115 stub_->scheduler()->decoder()->GetGLContext()->GetHandle()); |
| 109 video_decode_accelerator_ = omx_decoder; | 116 video_decode_accelerator_ = omx_decoder; |
| 110 video_decode_accelerator_->Initialize(configs); | 117 video_decode_accelerator_->Initialize(configs); |
| 111 #else | 118 #else |
| 112 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 119 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
| 120 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 113 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 121 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 114 } | 122 } |
| 115 | 123 |
| 116 void GpuVideoDecodeAccelerator::OnDecode( | 124 void GpuVideoDecodeAccelerator::OnDecode( |
| 117 base::SharedMemoryHandle handle, int32 id, int32 size) { | 125 base::SharedMemoryHandle handle, int32 id, int32 size) { |
| 118 DCHECK(video_decode_accelerator_.get()); | 126 DCHECK(video_decode_accelerator_.get()); |
| 119 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); | 127 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); |
| 120 } | 128 } |
| 121 | 129 |
| 122 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( | 130 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 193 |
| 186 void GpuVideoDecodeAccelerator::NotifyResetDone() { | 194 void GpuVideoDecodeAccelerator::NotifyResetDone() { |
| 187 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) | 195 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) |
| 188 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; | 196 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; |
| 189 } | 197 } |
| 190 | 198 |
| 191 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 199 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
| 192 DCHECK(sender_); | 200 DCHECK(sender_); |
| 193 return sender_->Send(message); | 201 return sender_->Send(message); |
| 194 } | 202 } |
| OLD | NEW |