| 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 "base/memory/shared_memory.h" | 5 #include "base/memory/shared_memory.h" |
| 6 #include "content/common/content_export.h" | 6 #include "content/common/content_export.h" |
| 7 #include "content/common/media/video_capture.h" | 7 #include "content/common/media/video_capture.h" |
| 8 #include "content/public/common/common_param_traits.h" | 8 #include "content/public/common/common_param_traits.h" |
| 9 #include "ipc/ipc_message_macros.h" | 9 #include "ipc/ipc_message_macros.h" |
| 10 #include "media/base/video_capture_types.h" | 10 #include "media/base/video_capture_types.h" |
| 11 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
| 12 #include "ui/gfx/gpu_memory_buffer.h" | |
| 13 | 12 |
| 14 #undef IPC_MESSAGE_EXPORT | 13 #undef IPC_MESSAGE_EXPORT |
| 15 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 14 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 16 #define IPC_MESSAGE_START VideoCaptureMsgStart | 15 #define IPC_MESSAGE_START VideoCaptureMsgStart |
| 17 | 16 |
| 18 IPC_ENUM_TRAITS_MAX_VALUE(content::VideoCaptureState, | |
| 19 content::VIDEO_CAPTURE_STATE_LAST) | |
| 20 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::StorageType, | 17 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::StorageType, |
| 21 media::VideoFrame::STORAGE_LAST) | 18 media::VideoFrame::STORAGE_LAST) |
| 22 | 19 |
| 23 IPC_STRUCT_BEGIN(VideoCaptureMsg_BufferReady_Params) | 20 IPC_STRUCT_BEGIN(VideoCaptureMsg_BufferReady_Params) |
| 24 IPC_STRUCT_MEMBER(int, device_id) | 21 IPC_STRUCT_MEMBER(int, device_id) |
| 25 IPC_STRUCT_MEMBER(int, buffer_id) | 22 IPC_STRUCT_MEMBER(int, buffer_id) |
| 26 IPC_STRUCT_MEMBER(base::TimeDelta, timestamp) | 23 IPC_STRUCT_MEMBER(base::TimeDelta, timestamp) |
| 27 IPC_STRUCT_MEMBER(base::DictionaryValue, metadata) | 24 IPC_STRUCT_MEMBER(base::DictionaryValue, metadata) |
| 28 IPC_STRUCT_MEMBER(media::VideoPixelFormat, pixel_format) | 25 IPC_STRUCT_MEMBER(media::VideoPixelFormat, pixel_format) |
| 29 IPC_STRUCT_MEMBER(media::VideoFrame::StorageType, storage_type) | 26 IPC_STRUCT_MEMBER(media::VideoFrame::StorageType, storage_type) |
| 30 IPC_STRUCT_MEMBER(gfx::Size, coded_size) | 27 IPC_STRUCT_MEMBER(gfx::Size, coded_size) |
| 31 IPC_STRUCT_MEMBER(gfx::Rect, visible_rect) | 28 IPC_STRUCT_MEMBER(gfx::Rect, visible_rect) |
| 32 IPC_STRUCT_END() | 29 IPC_STRUCT_END() |
| 33 | 30 |
| 34 // TODO(nick): device_id in these messages is basically just a route_id. We | 31 // TODO(nick): device_id in these messages is basically just a route_id. We |
| 35 // should shift to IPC_MESSAGE_ROUTED and use MessageRouter in the filter impls. | 32 // should shift to IPC_MESSAGE_ROUTED and use MessageRouter in the filter impls. |
| 36 | 33 |
| 37 // Notify the renderer process about the state update such as | |
| 38 // Start/Pause/Stop. | |
| 39 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_StateChanged, | |
| 40 int /* device id */, | |
| 41 content::VideoCaptureState /* new state */) | |
| 42 | |
| 43 // Tell the renderer process that a new buffer is allocated for video capture. | 34 // Tell the renderer process that a new buffer is allocated for video capture. |
| 44 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewBuffer, | 35 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewBuffer, |
| 45 int /* device id */, | 36 int /* device id */, |
| 46 base::SharedMemoryHandle /* handle */, | 37 base::SharedMemoryHandle /* handle */, |
| 47 int /* length */, | 38 int /* length */, |
| 48 int /* buffer_id */) | 39 int /* buffer_id */) |
| 49 | 40 |
| 50 // Tell the renderer process that it should release a buffer previously | 41 // Tell the renderer process that it should release a buffer previously |
| 51 // allocated by VideoCaptureMsg_NewBuffer. | 42 // allocated by VideoCaptureMsg_NewBuffer. |
| 52 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_FreeBuffer, | 43 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_FreeBuffer, |
| 53 int /* device id */, | 44 int /* device id */, |
| 54 int /* buffer_id */) | 45 int /* buffer_id */) |
| 55 | 46 |
| 56 // Tell the renderer process that a Buffer is available from video capture, and | 47 // Tell the renderer process that a Buffer is available from video capture, and |
| 57 // send the associated VideoFrame constituent parts as IPC parameters. | 48 // send the associated VideoFrame constituent parts as IPC parameters. |
| 58 IPC_MESSAGE_CONTROL1(VideoCaptureMsg_BufferReady, | 49 IPC_MESSAGE_CONTROL1(VideoCaptureMsg_BufferReady, |
| 59 VideoCaptureMsg_BufferReady_Params) | 50 VideoCaptureMsg_BufferReady_Params) |
| 60 | |
| 61 // Tell the browser process that the renderer has finished reading from | |
| 62 // a buffer previously delivered by VideoCaptureMsg_BufferReady. | |
| 63 IPC_MESSAGE_CONTROL4(VideoCaptureHostMsg_BufferReady, | |
| 64 int /* device_id */, | |
| 65 int /* buffer_id */, | |
| 66 gpu::SyncToken /* sync_token */, | |
| 67 double /* consumer_resource_utilization */) | |
| OLD | NEW |