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/renderer/pepper/pepper_video_capture_host.h" | 5 #include "content/renderer/pepper/pepper_video_capture_host.h" |
6 | 6 |
7 #include "content/renderer/media/media_stream_video_source.h" | 7 #include "content/renderer/media/media_stream_video_source.h" |
8 #include "content/renderer/pepper/host_globals.h" | 8 #include "content/renderer/pepper/host_globals.h" |
9 #include "content/renderer/pepper/pepper_media_device_manager.h" | 9 #include "content/renderer/pepper/pepper_media_device_manager.h" |
10 #include "content/renderer/pepper/pepper_platform_video_capture.h" | 10 #include "content/renderer/pepper/pepper_platform_video_capture.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 // Add a reference for the plugin, which is resposible for releasing it. | 214 // Add a reference for the plugin, which is resposible for releasing it. |
215 tracker->AddRefResource(res); | 215 tracker->AddRefResource(res); |
216 } | 216 } |
217 | 217 |
218 // Add the serialized shared memory handle to params. FileDescriptor is | 218 // Add the serialized shared memory handle to params. FileDescriptor is |
219 // treated in special case. | 219 // treated in special case. |
220 { | 220 { |
221 EnterResourceNoLock<PPB_Buffer_API> enter(res, true); | 221 EnterResourceNoLock<PPB_Buffer_API> enter(res, true); |
222 DCHECK(enter.succeeded()); | 222 DCHECK(enter.succeeded()); |
223 int handle; | 223 base::SharedMemory* shm; |
224 int32_t result = enter.object()->GetSharedMemory(&handle); | 224 int32_t result = enter.object()->GetSharedMemory(&shm); |
225 DCHECK(result == PP_OK); | 225 DCHECK(result == PP_OK); |
226 // TODO(piman/brettw): Change trusted interface to return a PP_FileHandle, | |
227 // those casts are ugly. | |
228 base::PlatformFile platform_file = | |
229 #if defined(OS_WIN) | |
230 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)); | |
231 #elif defined(OS_POSIX) | |
232 handle; | |
233 #else | |
234 #error Not implemented. | |
235 #endif | |
236 params.AppendHandle(ppapi::proxy::SerializedHandle( | 226 params.AppendHandle(ppapi::proxy::SerializedHandle( |
237 dispatcher->ShareHandleWithRemote(platform_file, false), size)); | 227 dispatcher->ShareSharedMemoryHandleWithRemote(shm->handle()), size)); |
238 } | 228 } |
239 } | 229 } |
240 | 230 |
241 if (buffers_.empty()) { | 231 if (buffers_.empty()) { |
242 // We couldn't allocate/map buffers at all. Send an error and stop the | 232 // We couldn't allocate/map buffers at all. Send an error and stop the |
243 // capture. | 233 // capture. |
244 SetStatus(PP_VIDEO_CAPTURE_STATUS_STOPPING, true); | 234 SetStatus(PP_VIDEO_CAPTURE_STATUS_STOPPING, true); |
245 platform_video_capture_->StopCapture(); | 235 platform_video_capture_->StopCapture(); |
246 PostErrorReply(); | 236 PostErrorReply(); |
247 return; | 237 return; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 } | 410 } |
421 | 411 |
422 PepperVideoCaptureHost::BufferInfo::BufferInfo() | 412 PepperVideoCaptureHost::BufferInfo::BufferInfo() |
423 : in_use(false), data(NULL), buffer() { | 413 : in_use(false), data(NULL), buffer() { |
424 } | 414 } |
425 | 415 |
426 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { | 416 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { |
427 } | 417 } |
428 | 418 |
429 } // namespace content | 419 } // namespace content |
OLD | NEW |