Chromium Code Reviews| 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::StatusCode) | |
| 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(codec) | |
| 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 to the comma. | |
|
Ami GONE FROM CHROMIUM
2013/03/19 18:01:49
s/to/on/
also, :'(
vmr
2013/03/20 12:09:14
Done.
| |
| 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 | |
|
Ami GONE FROM CHROMIUM
2013/03/19 18:01:49
I think the sentence of l.53-56 is a convoluted wa
vmr
2013/03/20 12:09:14
This is probably the least good part of this featu
| |
| 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. Encoding parameters on which the bitstream has | |
| 103 // been created are contained in the message with a boolean value (is_mutable), | |
| 104 // which informs whether the client can adjust the bitstream config using | |
| 105 // TryConfigureBitstream. When this message occurs bitstream can be considered | |
| 106 // to be streaming and Renderer should be ready to start accepting | |
| 107 // EncodedVideoSourceMsg_BitstreamReady messages and buffers contained within | |
| 108 // them. Shared memory buffers used to deliver the bitstream are assigned with | |
| 109 // buffer ids as specified by the buffers parameter. | |
| 110 IPC_MESSAGE_CONTROL5(EncodedVideoSourceMsg_BitstreamCreated, | |
| 111 int /* device id */, | |
| 112 int /* stream id */, | |
| 113 media::VideoEncodingParameters /* params */, | |
| 114 bool /* is_mutable */, | |
| 115 BitstreamBufferMap /* buffers */) | |
|
Ami GONE FROM CHROMIUM
2013/03/19 18:01:49
This requires you to decide how many buffers to al
vmr
2013/03/20 12:09:14
This is fair point.
| |
| 116 | |
| 117 // Message from Browser to Renderer process to acknowledge a request to destroy | |
| 118 // an encoded video bitstream. Also used to signal renderer process that an | |
| 119 // unrecoverable error has occurred and as a result bitstream has been | |
| 120 // destroyed. | |
| 121 IPC_MESSAGE_CONTROL3(EncodedVideoSourceMsg_BitstreamDestroyed, | |
| 122 int /* device id */, | |
| 123 int /* stream id */, | |
| 124 media::EncodedVideoBitstream::StatusCode /* status */) | |
| 125 | |
| 126 // Message from Browser to Renderer process to inform the clients of the current | |
| 127 // encoding parameters, regardless of whether the previous request to change | |
| 128 // them has been successful or not. This is called usually as a response to | |
| 129 // EncodedVideoSourceHostMsg_TryConfigureBitstream during runtime, but can occur | |
| 130 // also as a result of config change initiated by encoder or other clients in | |
| 131 // the system. E.g. if there are multiple clients and bitstream config change is | |
| 132 // requested from one client, all clients should be prepared to handle the | |
| 133 // configuration change. | |
| 134 IPC_MESSAGE_CONTROL3(EncodedVideoSourceMsg_BitstreamConfigChanged, | |
| 135 int /* device id */, | |
| 136 int /* stream id */, | |
| 137 media::RuntimeVideoEncodingParameters /* current_params */) | |
| 138 | |
| 139 // Message from Browser to Renderer process indicating that a bitstream buffer | |
| 140 // is available for the stream. | |
| 141 IPC_MESSAGE_CONTROL4(EncodedVideoSourceMsg_BitstreamReady, | |
| 142 int /* device id */, | |
| 143 int /* stream_id */, | |
| 144 int /* buffer_id */, | |
| 145 media::BufferEncodingMetadata /* metadata */) | |
| 146 | |
| OLD | NEW |