| 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 "gpu/config/gpu_info.h" | |
| 10 #include "ipc/ipc_message_macros.h" | |
| 11 #include "ipc/param_traits_macros.h" | |
| 12 #include "media/base/bitstream_buffer.h" | |
| 13 #include "media/base/decrypt_config.h" | |
| 14 #include "media/base/video_types.h" | |
| 15 #include "media/video/jpeg_decode_accelerator.h" | |
| 16 #include "media/video/video_decode_accelerator.h" | |
| 17 #include "media/video/video_encode_accelerator.h" | |
| 18 | |
| 19 #undef IPC_MESSAGE_EXPORT | |
| 20 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | |
| 21 | |
| 22 #define IPC_MESSAGE_START MediaMsgStart | |
| 23 | |
| 24 #ifndef CONTENT_COMMON_GPU_MEDIA_MESSAGES_H_ | |
| 25 #define CONTENT_COMMON_GPU_MEDIA_MESSAGES_H_ | |
| 26 | |
| 27 namespace IPC { | |
| 28 template <> | |
| 29 struct ParamTraits<media::BitstreamBuffer> { | |
| 30 using param_type = media::BitstreamBuffer; | |
| 31 static void Write(base::Pickle* m, const param_type& p); | |
| 32 static bool Read(const base::Pickle* m, | |
| 33 base::PickleIterator* iter, | |
| 34 param_type* r); | |
| 35 static void Log(const param_type& p, std::string* l); | |
| 36 }; | |
| 37 | |
| 38 } // namespace IPC | |
| 39 | |
| 40 #endif // CONTENT_COMMON_GPU_MEDIA_MESSAGES_H_ | |
| 41 | |
| 42 IPC_ENUM_TRAITS_MAX_VALUE(media::JpegDecodeAccelerator::Error, | |
| 43 media::JpegDecodeAccelerator::LARGEST_ERROR_ENUM) | |
| 44 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error, | |
| 45 media::VideoEncodeAccelerator::kErrorMax) | |
| 46 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile, | |
| 47 media::VIDEO_CODEC_PROFILE_MIN, | |
| 48 media::VIDEO_CODEC_PROFILE_MAX) | |
| 49 | |
| 50 IPC_STRUCT_BEGIN(AcceleratedJpegDecoderMsg_Decode_Params) | |
| 51 IPC_STRUCT_MEMBER(media::BitstreamBuffer, input_buffer) | |
| 52 IPC_STRUCT_MEMBER(gfx::Size, coded_size) | |
| 53 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, output_video_frame_handle) | |
| 54 IPC_STRUCT_MEMBER(uint32_t, output_buffer_size) | |
| 55 IPC_STRUCT_END() | |
| 56 | |
| 57 IPC_STRUCT_BEGIN(AcceleratedVideoEncoderMsg_Encode_Params) | |
| 58 IPC_STRUCT_MEMBER(int32_t, frame_id) | |
| 59 IPC_STRUCT_MEMBER(base::TimeDelta, timestamp) | |
| 60 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, buffer_handle) | |
| 61 IPC_STRUCT_MEMBER(uint32_t, buffer_offset) | |
| 62 IPC_STRUCT_MEMBER(uint32_t, buffer_size) | |
| 63 IPC_STRUCT_MEMBER(bool, force_keyframe) | |
| 64 IPC_STRUCT_END() | |
| 65 | |
| 66 IPC_STRUCT_BEGIN(AcceleratedVideoEncoderMsg_Encode_Params2) | |
| 67 IPC_STRUCT_MEMBER(int32_t, frame_id) | |
| 68 IPC_STRUCT_MEMBER(base::TimeDelta, timestamp) | |
| 69 IPC_STRUCT_MEMBER(std::vector<gfx::GpuMemoryBufferHandle>, | |
| 70 gpu_memory_buffer_handles) | |
| 71 IPC_STRUCT_MEMBER(gfx::Size, size) | |
| 72 IPC_STRUCT_MEMBER(bool, force_keyframe) | |
| 73 IPC_STRUCT_END() | |
| 74 | |
| 75 IPC_STRUCT_TRAITS_BEGIN(media::VideoDecodeAccelerator::Config) | |
| 76 IPC_STRUCT_TRAITS_MEMBER(profile) | |
| 77 IPC_STRUCT_TRAITS_MEMBER(is_encrypted) | |
| 78 IPC_STRUCT_TRAITS_MEMBER(surface_id) | |
| 79 IPC_STRUCT_TRAITS_END() | |
| 80 | |
| 81 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile) | |
| 82 IPC_STRUCT_TRAITS_MEMBER(profile) | |
| 83 IPC_STRUCT_TRAITS_MEMBER(max_resolution) | |
| 84 IPC_STRUCT_TRAITS_MEMBER(min_resolution) | |
| 85 IPC_STRUCT_TRAITS_END() | |
| 86 | |
| 87 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorCapabilities) | |
| 88 IPC_STRUCT_TRAITS_MEMBER(supported_profiles) | |
| 89 IPC_STRUCT_TRAITS_MEMBER(flags) | |
| 90 IPC_STRUCT_TRAITS_END() | |
| 91 | |
| 92 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile) | |
| 93 IPC_STRUCT_TRAITS_MEMBER(profile) | |
| 94 IPC_STRUCT_TRAITS_MEMBER(max_resolution) | |
| 95 IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator) | |
| 96 IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator) | |
| 97 IPC_STRUCT_TRAITS_END() | |
| 98 | |
| 99 IPC_STRUCT_TRAITS_BEGIN(media::SubsampleEntry) | |
| 100 IPC_STRUCT_TRAITS_MEMBER(clear_bytes) | |
| 101 IPC_STRUCT_TRAITS_MEMBER(cypher_bytes) | |
| 102 IPC_STRUCT_TRAITS_END() | |
| 103 | |
| 104 // Create and initialize a hardware video decoder using the specified route_id. | |
| 105 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when | |
| 106 // no longer needed. | |
| 107 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder, | |
| 108 media::VideoDecodeAccelerator::Config, /* config */ | |
| 109 int32_t, /* route_id */ | |
| 110 bool /* succeeded */) | |
| 111 | |
| 112 // Create and initialize a hardware video encoder using the specified route_id. | |
| 113 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when | |
| 114 // no longer needed. | |
| 115 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder, | |
| 116 media::VideoPixelFormat /* input_format */, | |
| 117 gfx::Size /* input_visible_size */, | |
| 118 media::VideoCodecProfile /* output_profile */, | |
| 119 uint32_t /* initial_bitrate */, | |
| 120 int32_t, /* route_id */ | |
| 121 bool /* succeeded */) | |
| 122 | |
| 123 //------------------------------------------------------------------------------ | |
| 124 // Accelerated Video Decoder Messages | |
| 125 // These messages are sent from Renderer process to GPU process. | |
| 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 // Queue a video frame to the encoder to encode. |frame_id| will be returned | |
| 199 // by AcceleratedVideoEncoderHostMsg_NotifyInputDone. | |
| 200 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderMsg_Encode, | |
| 201 AcceleratedVideoEncoderMsg_Encode_Params) | |
| 202 | |
| 203 // Queue a GpuMemoryBuffer backed video frame to the encoder to encode. | |
| 204 // |frame_id| will be returned by | |
| 205 // AcceleratedVideoEncoderHostMsg_NotifyInputDone. | |
| 206 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderMsg_Encode2, | |
| 207 AcceleratedVideoEncoderMsg_Encode_Params2) | |
| 208 | |
| 209 // Queue a buffer to the encoder for use in returning output. |buffer_id| will | |
| 210 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady. | |
| 211 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer, | |
| 212 int32_t /* buffer_id */, | |
| 213 base::SharedMemoryHandle /* buffer_handle */, | |
| 214 uint32_t /* buffer_size */) | |
| 215 | |
| 216 // Request a runtime encoding parameter change. | |
| 217 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange, | |
| 218 uint32_t /* bitrate */, | |
| 219 uint32_t /* framerate */) | |
| 220 | |
| 221 //------------------------------------------------------------------------------ | |
| 222 // Accelerated Video Encoder Host Messages | |
| 223 // These messages are sent from GPU process to Renderer process. | |
| 224 | |
| 225 // Notify renderer of the input/output buffer requirements of the encoder. | |
| 226 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers, | |
| 227 uint32_t /* input_count */, | |
| 228 gfx::Size /* input_coded_size */, | |
| 229 uint32_t /* output_buffer_size */) | |
| 230 | |
| 231 // Notify the renderer that the encoder has finished using an input buffer. | |
| 232 // There is no congruent entry point in the media::VideoEncodeAccelerator | |
| 233 // interface, in VEA this same done condition is indicated by dropping the | |
| 234 // reference to the media::VideoFrame passed to VEA::Encode(). | |
| 235 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone, | |
| 236 int32_t /* frame_id */) | |
| 237 | |
| 238 // Notify the renderer that an output buffer has been filled with encoded data. | |
| 239 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady, | |
| 240 int32_t /* bitstream_buffer_id */, | |
| 241 uint32_t /* payload_size */, | |
| 242 bool /* key_frame */) | |
| 243 | |
| 244 // Report error condition. | |
| 245 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError, | |
| 246 media::VideoEncodeAccelerator::Error /* error */) | |
| 247 | |
| 248 // Send destroy request to the encoder. | |
| 249 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy) | |
| 250 | |
| 251 //------------------------------------------------------------------------------ | |
| 252 // Accelerated JPEG Decoder Messages | |
| 253 // These messages are sent from the Browser process to GPU process. | |
| 254 | |
| 255 // Decode one JPEG image from shared memory |input_buffer_handle| with size | |
| 256 // |input_buffer_size|. The input buffer is associated with |input_buffer_id| | |
| 257 // and the size of JPEG image is |coded_size|. Decoded I420 frame data will | |
| 258 // be put onto shared memory associated with |output_video_frame_handle| | |
| 259 // with size limit |output_buffer_size|. | |
| 260 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderMsg_Decode, | |
| 261 AcceleratedJpegDecoderMsg_Decode_Params) | |
| 262 | |
| 263 // Send destroy request to the decoder. | |
| 264 IPC_MESSAGE_ROUTED0(AcceleratedJpegDecoderMsg_Destroy) | |
| 265 | |
| 266 //------------------------------------------------------------------------------ | |
| 267 // Accelerated JPEG Decoder Host Messages | |
| 268 // These messages are sent from the GPU process to Browser process. | |
| 269 // | |
| 270 // Report decode status. | |
| 271 IPC_MESSAGE_ROUTED2(AcceleratedJpegDecoderHostMsg_DecodeAck, | |
| 272 int32_t, /* bitstream_buffer_id */ | |
| 273 media::JpegDecodeAccelerator::Error /* error */) | |
| OLD | NEW |