OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_encode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 scoped_ptr<base::SharedMemory> shm( | 154 scoped_ptr<base::SharedMemory> shm( |
155 new base::SharedMemory(buffer_handle, true)); | 155 new base::SharedMemory(buffer_handle, true)); |
156 if (!shm->Map(buffer_size)) { | 156 if (!shm->Map(buffer_size)) { |
157 DLOG(ERROR) << "GpuVideoEncodeAccelerator::OnEncode(): " | 157 DLOG(ERROR) << "GpuVideoEncodeAccelerator::OnEncode(): " |
158 "could not map frame_id=" << frame_id; | 158 "could not map frame_id=" << frame_id; |
159 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); | 159 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); |
160 return; | 160 return; |
161 } | 161 } |
162 | 162 |
163 scoped_refptr<media::VideoFrame> frame = | 163 scoped_refptr<media::VideoFrame> frame = |
164 media::VideoFrame::WrapExternalSharedMemory( | 164 media::VideoFrame::WrapExternalPackedMemory( |
165 input_format_, | 165 input_format_, |
166 input_coded_size_, | 166 input_coded_size_, |
167 gfx::Rect(input_visible_size_), | 167 gfx::Rect(input_visible_size_), |
168 input_visible_size_, | 168 input_visible_size_, |
169 reinterpret_cast<uint8*>(shm->memory()), | 169 reinterpret_cast<uint8*>(shm->memory()), |
170 buffer_size, | 170 buffer_size, |
171 buffer_handle, | 171 buffer_handle, |
172 base::TimeDelta(), | 172 base::TimeDelta(), |
173 // It's turtles all the way down... | 173 // It's turtles all the way down... |
174 base::Bind(base::IgnoreResult(&base::MessageLoopProxy::PostTask), | 174 base::Bind(base::IgnoreResult(&base::MessageLoopProxy::PostTask), |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 return; | 239 return; |
240 } else if (!channel_->Send(message)) { | 240 } else if (!channel_->Send(message)) { |
241 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed: " | 241 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed: " |
242 "message->type()=" << message->type(); | 242 "message->type()=" << message->type(); |
243 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); | 243 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); |
244 return; | 244 return; |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 } // namespace content | 248 } // namespace content |
OLD | NEW |