| OLD | NEW |
| (Empty) |
| 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 | |
| 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 // Requests a key frame in the encoded bitstream. Upon receiving this request, | |
| 81 // browser will try to encode an upcoming captured frame as a key frame. This | |
| 82 // allows the receiver to quickly recover from data loss. The request is served | |
| 83 // on a best-effort basis and there is no explicit acknowledgement. | |
| 84 IPC_MESSAGE_CONTROL1(EncodedVideoCaptureHostMsg_RequestKeyFrame, | |
| 85 int /* device_id */) | |
| 86 | |
| 87 // Notifies that the data within a buffer has been processed and it can be | |
| 88 // reused to encode upcoming bitstream. | |
| 89 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_BitstreamBufferConsumed, | |
| 90 int /* device_id */, | |
| 91 int /* buffer_id */) | |
| 92 | |
| 93 //------------------------------------------------------------------------------ | |
| 94 // Renderer Messages | |
| 95 // These are messages from the browser to the renderer process. | |
| 96 | |
| 97 // Reports the encoding capabilities of the device. | |
| 98 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureMsg_CapabilitiesAvailable, | |
| 99 int /* device_id */, | |
| 100 media::VideoEncodingCapabilities /* capabilities */) | |
| 101 | |
| 102 // Acknowledges a request to open an encoded video bitstream. When this message | |
| 103 // occurs, bitstream can be considered to be streaming, and renderer should be | |
| 104 // ready to start accepting EncodedVideoCaptureMsg_BitstreamReady messages and | |
| 105 // buffers contained within them. Shared memory buffers used to deliver the | |
| 106 // bitstream are assigned with buffer IDs as specified by the buffers parameter. | |
| 107 // All buffers have the same size as indicated by |buffer_size|. | |
| 108 IPC_MESSAGE_CONTROL4(EncodedVideoCaptureMsg_BitstreamOpened, | |
| 109 int /* device_id */, | |
| 110 media::VideoEncodingParameters /* params */, | |
| 111 std::vector<base::SharedMemoryHandle> /* buffers */, | |
| 112 uint32 /* buffer_size */) | |
| 113 | |
| 114 // Acknowledges a request to close an encoded video bitstream. | |
| 115 IPC_MESSAGE_CONTROL1(EncodedVideoCaptureMsg_BitstreamClosed, | |
| 116 int /* device_id */) | |
| 117 | |
| 118 // Informs the clients of the current encoding parameters, regardless of whether | |
| 119 // the previous request to change them has been successful or not. It is usually | |
| 120 // called in response to EncodedVideoCaptureHostMsg_TryConfigureBitstream | |
| 121 // at runtime, but can occur also as a result of config change initiated by | |
| 122 // encoder or other clients in the system, e.g. if there are multiple clients | |
| 123 // and bitstream config change is requested from one client, all clients should | |
| 124 // be prepared to handle the configuration change. | |
| 125 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureMsg_BitstreamConfigChanged, | |
| 126 int /* device_id */, | |
| 127 media::RuntimeVideoEncodingParameters /* current_params */) | |
| 128 | |
| 129 // Indicates that a bitstream buffer is available for the stream. The value of | |
| 130 // |size| indicates the amount of valid bitstream data (in bytes). | |
| 131 IPC_MESSAGE_CONTROL4(EncodedVideoCaptureMsg_BitstreamReady, | |
| 132 int /* device_id */, | |
| 133 int /* buffer_id */, | |
| 134 uint32 /* size */, | |
| 135 media::BufferEncodingMetadata /* metadata */) | |
| OLD | NEW |