| 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/shared_memory.h" |
| 6 #include "content/common/content_export.h" |
| 7 #include "ipc/ipc_message_macros.h" |
| 8 #include "ipc/ipc_message_start.h" |
| 9 #include "media/video/encoded_video_source.h" |
| 10 #include "media/video/video_encode_types.h" |
| 11 |
| 12 #undef IPC_MESSAGE_EXPORT |
| 13 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 14 #define IPC_MESSAGE_START EncodedVideoSourceMsgStart |
| 15 |
| 16 IPC_ENUM_TRAITS(media::VideoCodec) |
| 17 |
| 18 IPC_ENUM_TRAITS(media::EncodedVideoBitstream::DestructionReason) |
| 19 |
| 20 IPC_STRUCT_TRAITS_BEGIN(media::TemporalLayerParameters) |
| 21 IPC_STRUCT_TRAITS_MEMBER(enabled) |
| 22 IPC_STRUCT_TRAITS_MEMBER(target_bitrate) |
| 23 IPC_STRUCT_TRAITS_END() |
| 24 |
| 25 IPC_STRUCT_TRAITS_BEGIN(media::RuntimeVideoEncodingParameters) |
| 26 IPC_STRUCT_TRAITS_MEMBER(frames_per_second) |
| 27 IPC_STRUCT_TRAITS_MEMBER(max_bitrate) |
| 28 IPC_STRUCT_TRAITS_MEMBER(max_qp) |
| 29 IPC_STRUCT_TRAITS_MEMBER(temporal_layer_params) |
| 30 IPC_STRUCT_TRAITS_END() |
| 31 |
| 32 IPC_STRUCT_TRAITS_BEGIN(media::VideoEncodingParameters) |
| 33 IPC_STRUCT_TRAITS_MEMBER(profile) |
| 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(frame_type_flags) |
| 41 IPC_STRUCT_TRAITS_MEMBER(temporal_layer_id) |
| 42 IPC_STRUCT_TRAITS_MEMBER(layer_sync) |
| 43 IPC_STRUCT_TRAITS_MEMBER(droppable) |
| 44 IPC_STRUCT_TRAITS_END() |
| 45 |
| 46 // Need to typedef BitstreamBufferMap in order to prevent the IPC message macros |
| 47 // from choking on the comma. |
| 48 typedef std::map<int, base::SharedMemoryHandle> BitstreamBufferMap; |
| 49 |
| 50 // Message from Renderer to Browser process to create a bitstream with specific |
| 51 // parameters. A successful request results in beginning of streaming and |
| 52 // EncoderVideoSourceMsg_BitstreamCreated message to Renderer. A failed request |
| 53 // triggers EncodedVideoSourceMsg_BitstreamDestroyed message. As this set of |
| 54 // messages is designed to work with existing device, device_id is determined |
| 55 // on the basis which device is providing the encoded video source |
| 56 // functionality. Renderer is responsible for generating unique stream_id within |
| 57 // its context that will be used to identify bitstreams in IPC. |
| 58 IPC_MESSAGE_CONTROL3(EncodedVideoSourceHostMsg_CreateBitstream, |
| 59 int /* device_id */, |
| 60 int /* stream_id */, |
| 61 media::VideoEncodingParameters /* params */) |
| 62 |
| 63 // Message from Renderer to Browser process to tell that the data within a |
| 64 // buffer has been processed and it can be reused to encode upcoming bitstream. |
| 65 IPC_MESSAGE_CONTROL3(EncodedVideoSourceHostMsg_BitstreamBufferConsumed, |
| 66 int /* device_id */, |
| 67 int /* stream_id */, |
| 68 int /* buffer_id */) |
| 69 |
| 70 // Message from Renderer to Browser process to stop streaming a bitstream. When |
| 71 // Browser has finalized the bitstream it will trigger |
| 72 // EncodedVideoSourceMsg_BitstreamDestroyed message back from Browser to |
| 73 // Renderer. Renderer must be prepared to receive |
| 74 // EncodedVideoSourceMsg_BitstreamReady messages until it has received the |
| 75 // EncodedVideoSourceMsg_BitstreamDestroyed message. |
| 76 IPC_MESSAGE_CONTROL2(EncodedVideoSourceHostMsg_DestroyBitstream, |
| 77 int /* device_id */, |
| 78 int /* stream_id */) |
| 79 |
| 80 // Message from Renderer to Browser process to set a stream's bitstream config. |
| 81 // Will always result in EncodedVideoSourceMsg_BitstreamConfigChanged containing |
| 82 // currently active parameters, regardless of whether this call succeeded or |
| 83 // not. |
| 84 IPC_MESSAGE_CONTROL3(EncodedVideoSourceHostMsg_TryConfigureBitstream, |
| 85 int /* device_id */, |
| 86 int /* stream_id */, |
| 87 media::RuntimeVideoEncodingParameters /* params */) |
| 88 |
| 89 // Message from Renderer to Browser process to request special frames from the |
| 90 // encoded video source. There will be no acknowledgement for this request and |
| 91 // the effect is only visible in the bitstream buffers passed to client |
| 92 // through the EncodedVideoSourceMsg_BitstreamReady message. This request is |
| 93 // served on a best-effort basis and client is not given any guarantees of the |
| 94 // realization or timing of the request. Flags parameter will be interpreted in |
| 95 // codec-specific manner using enumerations. |
| 96 IPC_MESSAGE_CONTROL3(EncodedVideoSourceHostMsg_RequestSpecialFrame, |
| 97 int /* device_id */, |
| 98 int /* stream_id */, |
| 99 int /* flags */) |
| 100 |
| 101 // Message from Browser to Renderer process to acknowledge a request to create |
| 102 // an encoded video bitstream. When this message occurs bitstream can be |
| 103 // considered to be streaming and Renderer should be ready to start accepting |
| 104 // EncodedVideoSourceMsg_BitstreamReady messages and buffers contained within |
| 105 // them. Shared memory buffers used to deliver the bitstream are assigned with |
| 106 // buffer ids as specified by the buffers parameter. |
| 107 IPC_MESSAGE_CONTROL4(EncodedVideoSourceMsg_BitstreamCreated, |
| 108 int /* device id */, |
| 109 int /* stream id */, |
| 110 media::VideoEncodingParameters /* params */, |
| 111 BitstreamBufferMap /* buffers */) |
| 112 |
| 113 // Message from Browser to Renderer process to acknowledge a request to destroy |
| 114 // an encoded video bitstream. Also used to signal renderer process that an |
| 115 // unrecoverable error has occurred and as a result bitstream has been |
| 116 // destroyed. |
| 117 IPC_MESSAGE_CONTROL3(EncodedVideoSourceMsg_BitstreamDestroyed, |
| 118 int /* device id */, |
| 119 int /* stream id */, |
| 120 media::EncodedVideoBitstream::DestructionReason /* rslt */) |
| 121 |
| 122 // Message from Browser to Renderer process to inform the clients of the current |
| 123 // encoding parameters, regardless of whether the previous request to change |
| 124 // them has been successful or not. This is called usually as a response to |
| 125 // EncodedVideoSourceHostMsg_TryConfigureBitstream during runtime, but can occur |
| 126 // also as a result of config change initiated by encoder or other clients in |
| 127 // the system. E.g. if there are multiple clients and bitstream config change is |
| 128 // requested from one client, all clients should be prepared to handle the |
| 129 // configuration change. |
| 130 IPC_MESSAGE_CONTROL3(EncodedVideoSourceMsg_BitstreamConfigChanged, |
| 131 int /* device id */, |
| 132 int /* stream id */, |
| 133 media::RuntimeVideoEncodingParameters /* current_params */) |
| 134 |
| 135 // Message from Browser to Renderer process indicating that a bitstream buffer |
| 136 // is available for the stream. |
| 137 IPC_MESSAGE_CONTROL4(EncodedVideoSourceMsg_BitstreamReady, |
| 138 int /* device id */, |
| 139 int /* stream_id */, |
| 140 int /* buffer_id */, |
| 141 media::BufferEncodingMetadata /* metadata */) |
| 142 |
| OLD | NEW |