OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/memory/shared_memory.h" |
| 6 #include "ipc/ipc_message_macros.h" |
| 7 #include "media/video/capture/video_capture_types.h" |
| 8 #include "media/video/video_encode_types.h" |
| 9 |
| 10 #undef IPC_MESSAGE_EXPORT |
| 11 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 12 #define IPC_MESSAGE_START EncodedVideoCaptureMsgStart |
| 13 |
| 14 #if !defined(OS_ANDROID) |
| 15 IPC_ENUM_TRAITS(media::VideoCodec) |
| 16 #endif // !defined(OS_ANDROID) |
| 17 |
| 18 IPC_STRUCT_TRAITS_BEGIN(media::VideoEncodingConfig) |
| 19 IPC_STRUCT_TRAITS_MEMBER(codec_type) |
| 20 IPC_STRUCT_TRAITS_MEMBER(codec_name) |
| 21 IPC_STRUCT_TRAITS_MEMBER(max_resolution) |
| 22 IPC_STRUCT_TRAITS_MEMBER(max_frames_per_second) |
| 23 IPC_STRUCT_TRAITS_MEMBER(max_bitrate) |
| 24 IPC_STRUCT_TRAITS_END() |
| 25 |
| 26 IPC_STRUCT_TRAITS_BEGIN(media::RuntimeVideoEncodingParameters) |
| 27 IPC_STRUCT_TRAITS_MEMBER(target_bitrate) |
| 28 IPC_STRUCT_TRAITS_MEMBER(max_bitrate) |
| 29 IPC_STRUCT_TRAITS_MEMBER(frames_per_second) |
| 30 IPC_STRUCT_TRAITS_END() |
| 31 |
| 32 IPC_STRUCT_TRAITS_BEGIN(media::VideoEncodingParameters) |
| 33 IPC_STRUCT_TRAITS_MEMBER(codec_name) |
| 34 IPC_STRUCT_TRAITS_MEMBER(resolution) |
| 35 IPC_STRUCT_TRAITS_MEMBER(runtime_params) |
| 36 IPC_STRUCT_TRAITS_END() |
| 37 |
| 38 IPC_STRUCT_TRAITS_BEGIN(media::BufferEncodingMetadata) |
| 39 IPC_STRUCT_TRAITS_MEMBER(timestamp) |
| 40 IPC_STRUCT_TRAITS_MEMBER(key_frame) |
| 41 IPC_STRUCT_TRAITS_END() |
| 42 |
| 43 //------------------------------------------------------------------------------ |
| 44 // Renderer Source Messages |
| 45 // These are messages from the renderer to the browser process. |
| 46 |
| 47 // Queries the encoding capabilities for the device. A successful request |
| 48 // results in EncoderVideoSourceMessage_CapabilitiesAvailable message. |
| 49 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_GetCapabilities, |
| 50 int /* device_id */, |
| 51 media::VideoCaptureSessionId /* session_id */) |
| 52 |
| 53 // Message from renderer to browser process to create a bitstream with specific |
| 54 // parameters. A successful request results in beginning of streaming and |
| 55 // EncoderVideoCaptureMsg_BitstreamCreated message to renderer. A failed request |
| 56 // triggers EncodedVideoCaptureMsg_BitstreamDestroyed message. |session_id| is |
| 57 // the capture session id returned by the MediaStreamManager. The renderer is |
| 58 // responsible for generating unique |device_id| within its context that will be |
| 59 // used to identify bitstreams in IPC. |
| 60 IPC_MESSAGE_CONTROL3(EncodedVideoCaptureHostMsg_OpenBitstream, |
| 61 int /* device_id */, |
| 62 media::VideoCaptureSessionId /* session_id */, |
| 63 media::VideoEncodingParameters /* params */) |
| 64 |
| 65 // Stops streaming a bitstream. When browser has finalized the bitstream it will |
| 66 // trigger EncodedVideoCaptureMsg_BitstreamClosed message back to renderer. |
| 67 // Renderer must be prepared to receive EncodedVideoCaptureMsg_BitstreamReady |
| 68 // messages until it receives EncodedVideoCaptureMsg_BitstreamClosed message. |
| 69 IPC_MESSAGE_CONTROL1(EncodedVideoCaptureHostMsg_CloseBitstream, |
| 70 int /* device_id */) |
| 71 |
| 72 // Sets a stream's bitstream configuration. Will always result in |
| 73 // EncodedVideoCaptureMsg_BitstreamConfigChanged message containing |
| 74 // currently active parameters, regardless of whether this call succeeded or |
| 75 // not. |
| 76 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_TryConfigureBitstream, |
| 77 int /* device_id */, |
| 78 media::RuntimeVideoEncodingParameters /* params */) |
| 79 |
| 80 // Notifies that the data within a buffer has been processed and it can be |
| 81 // reused to encode upcoming bitstream. |
| 82 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_BitstreamBufferConsumed, |
| 83 int /* device_id */, |
| 84 int /* buffer_id */) |
| 85 |
| 86 //------------------------------------------------------------------------------ |
| 87 // Renderer Messages |
| 88 // These are messages from the browser to the renderer process. |
| 89 |
| 90 // Reports the encoding capabilities of the device. |
| 91 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureMsg_CapabilitiesAvailable, |
| 92 int /* device_id */, |
| 93 media::VideoEncodingCapabilities /* capabilities */) |
| 94 |
| 95 // Acknowledges a request to open an encoded video bitstream. When this message |
| 96 // occurs, bitstream can be considered to be streaming, and renderer should be |
| 97 // ready to start accepting EncodedVideoCaptureMsg_BitstreamReady messages and |
| 98 // buffers contained within them. Shared memory buffers used to deliver the |
| 99 // bitstream are assigned with buffer IDs as specified by the buffers parameter. |
| 100 // All buffers have the same size as indicated by |buffer_size|. |
| 101 IPC_MESSAGE_CONTROL4(EncodedVideoCaptureMsg_BitstreamOpened, |
| 102 int /* device_id */, |
| 103 media::VideoEncodingParameters /* params */, |
| 104 std::vector<base::SharedMemoryHandle> /* buffers */, |
| 105 uint32 /* buffer_size */) |
| 106 |
| 107 // Acknowledges a request to close an encoded video bitstream. |
| 108 IPC_MESSAGE_CONTROL1(EncodedVideoCaptureMsg_BitstreamClosed, |
| 109 int /* device_id */) |
| 110 |
| 111 // Informs the clients of the current encoding parameters, regardless of whether |
| 112 // the previous request to change them has been successful or not. It is usually |
| 113 // called in response to EncodedVideoCaptureHostMsg_TryConfigureBitstream |
| 114 // at runtime, but can occur also as a result of config change initiated by |
| 115 // encoder or other clients in the system, e.g. if there are multiple clients |
| 116 // and bitstream config change is requested from one client, all clients should |
| 117 // be prepared to handle the configuration change. |
| 118 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureMsg_BitstreamConfigChanged, |
| 119 int /* device_id */, |
| 120 media::RuntimeVideoEncodingParameters /* current_params */) |
| 121 |
| 122 // Indicates that a bitstream buffer is available for the stream. The value of |
| 123 // |size| indicates the amount of valid bitstream data (in bytes). |
| 124 IPC_MESSAGE_CONTROL4(EncodedVideoCaptureMsg_BitstreamReady, |
| 125 int /* device_id */, |
| 126 int /* buffer_id */, |
| 127 uint32 /* size */, |
| 128 media::BufferEncodingMetadata /* metadata */) |
OLD | NEW |