| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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 // Multiply-included message file, hence no include guard here, but see below | |
| 6 // for a much smaller-than-usual include guard section. | |
| 7 | |
| 8 #include "content/common/content_export.h" | |
| 9 #include "content/common/gpu/media/create_video_encoder_params.h" | |
| 10 #include "gpu/config/gpu_info.h" | |
| 11 #include "ipc/ipc_message_macros.h" | |
| 12 #include "ipc/param_traits_macros.h" | |
| 13 #include "media/base/bitstream_buffer.h" | |
| 14 #include "media/base/decrypt_config.h" | |
| 15 #include "media/base/video_types.h" | |
| 16 #include "media/video/jpeg_decode_accelerator.h" | |
| 17 #include "media/video/video_decode_accelerator.h" | |
| 18 #include "media/video/video_encode_accelerator.h" | |
| 19 | |
| 20 #undef IPC_MESSAGE_EXPORT | |
| 21 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | |
| 22 | |
| 23 #define IPC_MESSAGE_START MediaMsgStart | |
| 24 | |
| 25 #ifndef CONTENT_COMMON_GPU_MEDIA_MESSAGES_H_ | |
| 26 #define CONTENT_COMMON_GPU_MEDIA_MESSAGES_H_ | |
| 27 | |
| 28 namespace IPC { | |
| 29 template <> | |
| 30 struct ParamTraits<media::BitstreamBuffer> { | |
| 31 using param_type = media::BitstreamBuffer; | |
| 32 static void Write(base::Pickle* m, const param_type& p); | |
| 33 static bool Read(const base::Pickle* m, | |
| 34 base::PickleIterator* iter, | |
| 35 param_type* r); | |
| 36 static void Log(const param_type& p, std::string* l); | |
| 37 }; | |
| 38 | |
| 39 } // namespace IPC | |
| 40 | |
| 41 #endif // CONTENT_COMMON_GPU_MEDIA_MESSAGES_H_ | |
| 42 | |
| 43 IPC_ENUM_TRAITS_MAX_VALUE(media::JpegDecodeAccelerator::Error, | |
| 44 media::JpegDecodeAccelerator::LARGEST_ERROR_ENUM) | |
| 45 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error, | |
| 46 media::VideoEncodeAccelerator::kErrorMax) | |
| 47 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile, | |
| 48 media::VIDEO_CODEC_PROFILE_MIN, | |
| 49 media::VIDEO_CODEC_PROFILE_MAX) | |
| 50 | |
| 51 IPC_STRUCT_BEGIN(AcceleratedJpegDecoderMsg_Decode_Params) | |
| 52 IPC_STRUCT_MEMBER(media::BitstreamBuffer, input_buffer) | |
| 53 IPC_STRUCT_MEMBER(gfx::Size, coded_size) | |
| 54 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, output_video_frame_handle) | |
| 55 IPC_STRUCT_MEMBER(uint32_t, output_buffer_size) | |
| 56 IPC_STRUCT_END() | |
| 57 | |
| 58 IPC_STRUCT_BEGIN(AcceleratedVideoEncoderMsg_Encode_Params) | |
| 59 IPC_STRUCT_MEMBER(int32_t, frame_id) | |
| 60 IPC_STRUCT_MEMBER(base::TimeDelta, timestamp) | |
| 61 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, buffer_handle) | |
| 62 IPC_STRUCT_MEMBER(uint32_t, buffer_offset) | |
| 63 IPC_STRUCT_MEMBER(uint32_t, buffer_size) | |
| 64 IPC_STRUCT_MEMBER(bool, force_keyframe) | |
| 65 IPC_STRUCT_END() | |
| 66 | |
| 67 IPC_STRUCT_BEGIN(AcceleratedVideoEncoderMsg_Encode_Params2) | |
| 68 IPC_STRUCT_MEMBER(int32_t, frame_id) | |
| 69 IPC_STRUCT_MEMBER(base::TimeDelta, timestamp) | |
| 70 IPC_STRUCT_MEMBER(std::vector<gfx::GpuMemoryBufferHandle>, | |
| 71 gpu_memory_buffer_handles) | |
| 72 IPC_STRUCT_MEMBER(gfx::Size, size) | |
| 73 IPC_STRUCT_MEMBER(bool, force_keyframe) | |
| 74 IPC_STRUCT_END() | |
| 75 | |
| 76 IPC_STRUCT_TRAITS_BEGIN(media::VideoDecodeAccelerator::Config) | |
| 77 IPC_STRUCT_TRAITS_MEMBER(profile) | |
| 78 IPC_STRUCT_TRAITS_MEMBER(is_encrypted) | |
| 79 IPC_STRUCT_TRAITS_MEMBER(surface_id) | |
| 80 IPC_STRUCT_TRAITS_END() | |
| 81 | |
| 82 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile) | |
| 83 IPC_STRUCT_TRAITS_MEMBER(profile) | |
| 84 IPC_STRUCT_TRAITS_MEMBER(max_resolution) | |
| 85 IPC_STRUCT_TRAITS_MEMBER(min_resolution) | |
| 86 IPC_STRUCT_TRAITS_END() | |
| 87 | |
| 88 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorCapabilities) | |
| 89 IPC_STRUCT_TRAITS_MEMBER(supported_profiles) | |
| 90 IPC_STRUCT_TRAITS_MEMBER(flags) | |
| 91 IPC_STRUCT_TRAITS_END() | |
| 92 | |
| 93 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile) | |
| 94 IPC_STRUCT_TRAITS_MEMBER(profile) | |
| 95 IPC_STRUCT_TRAITS_MEMBER(max_resolution) | |
| 96 IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator) | |
| 97 IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator) | |
| 98 IPC_STRUCT_TRAITS_END() | |
| 99 | |
| 100 IPC_STRUCT_TRAITS_BEGIN(media::SubsampleEntry) | |
| 101 IPC_STRUCT_TRAITS_MEMBER(clear_bytes) | |
| 102 IPC_STRUCT_TRAITS_MEMBER(cypher_bytes) | |
| 103 IPC_STRUCT_TRAITS_END() | |
| 104 | |
| 105 IPC_STRUCT_TRAITS_BEGIN(content::CreateVideoEncoderParams) | |
| 106 IPC_STRUCT_TRAITS_MEMBER(command_buffer_route_id) | |
| 107 IPC_STRUCT_TRAITS_MEMBER(input_format) | |
| 108 IPC_STRUCT_TRAITS_MEMBER(input_visible_size) | |
| 109 IPC_STRUCT_TRAITS_MEMBER(output_profile) | |
| 110 IPC_STRUCT_TRAITS_MEMBER(initial_bitrate) | |
| 111 IPC_STRUCT_TRAITS_MEMBER(encoder_route_id) | |
| 112 IPC_STRUCT_TRAITS_END() | |
| 113 | |
| 114 //------------------------------------------------------------------------------ | |
| 115 // Accelerated Video Decoder Messages | |
| 116 // These messages are sent from Renderer process to GPU process. | |
| 117 | |
| 118 // Create and initialize a hardware video decoder using the specified route_id. | |
| 119 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when | |
| 120 // no longer needed. | |
| 121 IPC_SYNC_MESSAGE_CONTROL3_1(GpuCommandBufferMsg_CreateVideoDecoder, | |
| 122 int32_t /* command_buffer_route_id */, | |
| 123 media::VideoDecodeAccelerator::Config /* config */, | |
| 124 int32_t /* decoder_route_id */, | |
| 125 bool /* succeeded */) | |
| 126 | |
| 127 // Set a CDM on the decoder to handle encrypted buffers. | |
| 128 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_SetCdm, int32_t /* CDM ID */) | |
| 129 | |
| 130 // Send input buffer for decoding. | |
| 131 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Decode, media::BitstreamBuffer) | |
| 132 | |
| 133 // Give the texture IDs for the textures the decoder will use for output. | |
| 134 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers, | |
| 135 std::vector<int32_t>, /* Picture buffer ID */ | |
| 136 std::vector<uint32_t>) /* Texture ID */ | |
| 137 | |
| 138 // Send from Renderer process to the GPU process to recycle the given picture | |
| 139 // buffer for further decoding. | |
| 140 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer, | |
| 141 int32_t) /* Picture buffer ID */ | |
| 142 | |
| 143 // Send flush request to the decoder. | |
| 144 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush) | |
| 145 | |
| 146 // Send reset request to the decoder. | |
| 147 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset) | |
| 148 | |
| 149 // Send destroy request to the decoder. | |
| 150 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy) | |
| 151 | |
| 152 //------------------------------------------------------------------------------ | |
| 153 // Accelerated Video Decoder Host Messages | |
| 154 // These messages are sent from GPU process to Renderer process. | |
| 155 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been | |
| 156 // created. | |
| 157 | |
| 158 // Notify the CDM setting result. | |
| 159 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_CdmAttached, | |
| 160 bool) /* success */ | |
| 161 | |
| 162 // Accelerated video decoder has consumed input buffer from transfer buffer. | |
| 163 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, | |
| 164 int32_t) /* Processed buffer ID */ | |
| 165 | |
| 166 // Allocate video frames for output of the hardware video decoder. | |
| 167 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers, | |
| 168 int32_t, /* Number of video frames to generate */ | |
| 169 gfx::Size, /* Requested size of buffer */ | |
| 170 uint32_t) /* Texture target */ | |
| 171 | |
| 172 // Decoder reports that a picture is ready and buffer does not need to be passed | |
| 173 // back to the decoder. | |
| 174 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer, | |
| 175 int32_t) /* Picture buffer ID */ | |
| 176 | |
| 177 // Decoder reports that a picture is ready. | |
| 178 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderHostMsg_PictureReady, | |
| 179 int32_t, /* Picture buffer ID */ | |
| 180 int32_t, /* Bitstream buffer ID */ | |
| 181 gfx::Rect, /* Visible rectangle */ | |
| 182 bool) /* Buffer is HW overlay capable */ | |
| 183 | |
| 184 // Confirm decoder has been flushed. | |
| 185 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone) | |
| 186 | |
| 187 // Confirm decoder has been reset. | |
| 188 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone) | |
| 189 | |
| 190 // Video decoder has encountered an error. | |
| 191 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, | |
| 192 uint32_t /* Error ID */) | |
| 193 | |
| 194 //------------------------------------------------------------------------------ | |
| 195 // Accelerated Video Encoder Messages | |
| 196 // These messages are sent from the Renderer process to GPU process. | |
| 197 | |
| 198 // Create and initialize a hardware video encoder using the specified route_id. | |
| 199 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when | |
| 200 // no longer needed. | |
| 201 IPC_SYNC_MESSAGE_CONTROL1_1(GpuCommandBufferMsg_CreateVideoEncoder, | |
| 202 content::CreateVideoEncoderParams, | |
| 203 bool /* succeeded */) | |
| 204 | |
| 205 // Queue a video frame to the encoder to encode. |frame_id| will be returned | |
| 206 // by AcceleratedVideoEncoderHostMsg_NotifyInputDone. | |
| 207 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderMsg_Encode, | |
| 208 AcceleratedVideoEncoderMsg_Encode_Params) | |
| 209 | |
| 210 // Queue a GpuMemoryBuffer backed video frame to the encoder to encode. | |
| 211 // |frame_id| will be returned by | |
| 212 // AcceleratedVideoEncoderHostMsg_NotifyInputDone. | |
| 213 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderMsg_Encode2, | |
| 214 AcceleratedVideoEncoderMsg_Encode_Params2) | |
| 215 | |
| 216 // Queue a buffer to the encoder for use in returning output. |buffer_id| will | |
| 217 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady. | |
| 218 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer, | |
| 219 int32_t /* buffer_id */, | |
| 220 base::SharedMemoryHandle /* buffer_handle */, | |
| 221 uint32_t /* buffer_size */) | |
| 222 | |
| 223 // Request a runtime encoding parameter change. | |
| 224 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange, | |
| 225 uint32_t /* bitrate */, | |
| 226 uint32_t /* framerate */) | |
| 227 | |
| 228 //------------------------------------------------------------------------------ | |
| 229 // Accelerated Video Encoder Host Messages | |
| 230 // These messages are sent from GPU process to Renderer process. | |
| 231 | |
| 232 // Notify renderer of the input/output buffer requirements of the encoder. | |
| 233 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers, | |
| 234 uint32_t /* input_count */, | |
| 235 gfx::Size /* input_coded_size */, | |
| 236 uint32_t /* output_buffer_size */) | |
| 237 | |
| 238 // Notify the renderer that the encoder has finished using an input buffer. | |
| 239 // There is no congruent entry point in the media::VideoEncodeAccelerator | |
| 240 // interface, in VEA this same done condition is indicated by dropping the | |
| 241 // reference to the media::VideoFrame passed to VEA::Encode(). | |
| 242 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone, | |
| 243 int32_t /* frame_id */) | |
| 244 | |
| 245 // Notify the renderer that an output buffer has been filled with encoded data. | |
| 246 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady, | |
| 247 int32_t /* bitstream_buffer_id */, | |
| 248 uint32_t /* payload_size */, | |
| 249 bool /* key_frame */) | |
| 250 | |
| 251 // Report error condition. | |
| 252 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError, | |
| 253 media::VideoEncodeAccelerator::Error /* error */) | |
| 254 | |
| 255 // Send destroy request to the encoder. | |
| 256 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy) | |
| 257 | |
| 258 //------------------------------------------------------------------------------ | |
| 259 // Accelerated JPEG Decoder Messages | |
| 260 // These messages are sent from the Browser process to GPU process. | |
| 261 | |
| 262 // Create and initialize a hardware jpeg decoder using the specified route_id. | |
| 263 // Created decoders should be freed with AcceleratedJpegDecoderMsg_Destroy when | |
| 264 // no longer needed. | |
| 265 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CreateJpegDecoder, | |
| 266 int32_t /* route_id */, | |
| 267 bool /* succeeded */) | |
| 268 | |
| 269 // Decode one JPEG image from shared memory |input_buffer_handle| with size | |
| 270 // |input_buffer_size|. The input buffer is associated with |input_buffer_id| | |
| 271 // and the size of JPEG image is |coded_size|. Decoded I420 frame data will | |
| 272 // be put onto shared memory associated with |output_video_frame_handle| | |
| 273 // with size limit |output_buffer_size|. | |
| 274 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderMsg_Decode, | |
| 275 AcceleratedJpegDecoderMsg_Decode_Params) | |
| 276 | |
| 277 // Send destroy request to the decoder. | |
| 278 IPC_MESSAGE_ROUTED0(AcceleratedJpegDecoderMsg_Destroy) | |
| 279 | |
| 280 //------------------------------------------------------------------------------ | |
| 281 // Accelerated JPEG Decoder Host Messages | |
| 282 // These messages are sent from the GPU process to Browser process. | |
| 283 // | |
| 284 // Report decode status. | |
| 285 IPC_MESSAGE_ROUTED2(AcceleratedJpegDecoderHostMsg_DecodeAck, | |
| 286 int32_t, /* bitstream_buffer_id */ | |
| 287 media::JpegDecodeAccelerator::Error /* error */) | |
| OLD | NEW |