cast_messages.h revision 010d83a9304c5a91596085d917d248abff47903a
1// Copyright 2014 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// IPC messages for the Cast transport API.
6// Multiply-included message file, hence no include guard.
7
8#include "ipc/ipc_message_macros.h"
9#include "media/cast/cast_sender.h"
10#include "media/cast/logging/logging_defines.h"
11#include "media/cast/rtcp/rtcp_defines.h"
12#include "media/cast/transport/cast_transport_sender.h"
13#include "net/base/ip_endpoint.h"
14#include "net/base/net_util.h"
15
16#undef IPC_MESSAGE_EXPORT
17#define IPC_MESSAGE_EXPORT
18#define IPC_MESSAGE_START CastMsgStart
19
20IPC_ENUM_TRAITS_MAX_VALUE(media::cast::transport::AudioCodec,
21                          media::cast::transport::kAudioCodecLast)
22IPC_ENUM_TRAITS_MAX_VALUE(media::cast::transport::VideoCodec,
23                          media::cast::transport::kVideoCodecLast)
24IPC_ENUM_TRAITS_MAX_VALUE(media::cast::transport::RtcpSenderFrameStatus,
25                          media::cast::transport::kRtcpSenderFrameStatusLast)
26IPC_ENUM_TRAITS_MAX_VALUE(media::cast::transport::CastTransportStatus,
27                          media::cast::transport::CAST_TRANSPORT_STATUS_LAST)
28IPC_ENUM_TRAITS_MAX_VALUE(media::cast::CastLoggingEvent,
29                          media::cast::kNumOfLoggingEvents)
30
31IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::EncodedAudioFrame)
32  IPC_STRUCT_TRAITS_MEMBER(codec)
33  IPC_STRUCT_TRAITS_MEMBER(frame_id)
34  IPC_STRUCT_TRAITS_MEMBER(rtp_timestamp)
35  IPC_STRUCT_TRAITS_MEMBER(data)
36IPC_STRUCT_TRAITS_END()
37
38IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::EncodedVideoFrame)
39  IPC_STRUCT_TRAITS_MEMBER(codec)
40  IPC_STRUCT_TRAITS_MEMBER(key_frame)
41  IPC_STRUCT_TRAITS_MEMBER(frame_id)
42  IPC_STRUCT_TRAITS_MEMBER(last_referenced_frame_id)
43  IPC_STRUCT_TRAITS_MEMBER(rtp_timestamp)
44  IPC_STRUCT_TRAITS_MEMBER(data)
45IPC_STRUCT_TRAITS_END()
46
47IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::RtcpSenderInfo)
48  IPC_STRUCT_TRAITS_MEMBER(ntp_seconds)
49  IPC_STRUCT_TRAITS_MEMBER(ntp_fraction)
50  IPC_STRUCT_TRAITS_MEMBER(rtp_timestamp)
51  IPC_STRUCT_TRAITS_MEMBER(send_packet_count)
52  IPC_STRUCT_TRAITS_MEMBER(send_octet_count)
53IPC_STRUCT_TRAITS_END()
54
55IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::RtcpDlrrReportBlock)
56  IPC_STRUCT_TRAITS_MEMBER(last_rr)
57  IPC_STRUCT_TRAITS_MEMBER(delay_since_last_rr)
58IPC_STRUCT_TRAITS_END()
59
60IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::RtcpSenderFrameLogMessage)
61  IPC_STRUCT_TRAITS_MEMBER(frame_status)
62  IPC_STRUCT_TRAITS_MEMBER(rtp_timestamp)
63IPC_STRUCT_TRAITS_END()
64
65IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::RtpConfig)
66  IPC_STRUCT_TRAITS_MEMBER(ssrc)
67  IPC_STRUCT_TRAITS_MEMBER(max_delay_ms)
68  IPC_STRUCT_TRAITS_MEMBER(payload_type)
69  IPC_STRUCT_TRAITS_MEMBER(aes_key)
70  IPC_STRUCT_TRAITS_MEMBER(aes_iv_mask)
71IPC_STRUCT_TRAITS_END()
72
73IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::CastTransportRtpConfig)
74  IPC_STRUCT_TRAITS_MEMBER(config)
75  IPC_STRUCT_TRAITS_MEMBER(max_outstanding_frames)
76IPC_STRUCT_TRAITS_END()
77
78IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::CastTransportAudioConfig)
79  IPC_STRUCT_TRAITS_MEMBER(rtp)
80  IPC_STRUCT_TRAITS_MEMBER(codec)
81  IPC_STRUCT_TRAITS_MEMBER(frequency)
82  IPC_STRUCT_TRAITS_MEMBER(channels)
83IPC_STRUCT_TRAITS_END()
84
85IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::CastTransportVideoConfig)
86  IPC_STRUCT_TRAITS_MEMBER(rtp)
87  IPC_STRUCT_TRAITS_MEMBER(codec)
88IPC_STRUCT_TRAITS_END()
89
90IPC_STRUCT_TRAITS_BEGIN(media::cast::transport::SendRtcpFromRtpSenderData)
91  IPC_STRUCT_TRAITS_MEMBER(packet_type_flags)
92  IPC_STRUCT_TRAITS_MEMBER(sending_ssrc)
93  IPC_STRUCT_TRAITS_MEMBER(c_name)
94IPC_STRUCT_TRAITS_END()
95
96IPC_STRUCT_TRAITS_BEGIN(media::cast::PacketEvent)
97  IPC_STRUCT_TRAITS_MEMBER(rtp_timestamp)
98  IPC_STRUCT_TRAITS_MEMBER(frame_id)
99  IPC_STRUCT_TRAITS_MEMBER(max_packet_id)
100  IPC_STRUCT_TRAITS_MEMBER(packet_id)
101  IPC_STRUCT_TRAITS_MEMBER(size)
102  IPC_STRUCT_TRAITS_MEMBER(timestamp)
103  IPC_STRUCT_TRAITS_MEMBER(type)
104IPC_STRUCT_TRAITS_END()
105
106// Cast messages sent from the browser to the renderer.
107
108IPC_MESSAGE_CONTROL2(CastMsg_ReceivedPacket,
109                     int32 /* channel_id */,
110                     media::cast::Packet /* packet */);
111
112IPC_MESSAGE_CONTROL2(
113    CastMsg_NotifyStatusChange,
114    int32 /* channel_id */,
115    media::cast::transport::CastTransportStatus /* status */);
116
117IPC_MESSAGE_CONTROL5(
118    CastMsg_RtpStatistics,
119    int32 /* channel_id */,
120    bool /* audio */,
121    media::cast::transport::RtcpSenderInfo /* sender_info */,
122    base::TimeTicks /* time_sent */,
123    uint32 /* rtp_timestamp */);
124
125IPC_MESSAGE_CONTROL2(CastMsg_RawEvents,
126                     int32 /* channel_id */,
127                     std::vector<media::cast::PacketEvent> /* packet_events */);
128
129// Cast messages sent from the renderer to the browser.
130
131IPC_MESSAGE_CONTROL2(
132  CastHostMsg_InitializeAudio,
133  int32 /*channel_id*/,
134  media::cast::transport::CastTransportAudioConfig /*config*/)
135
136IPC_MESSAGE_CONTROL2(
137  CastHostMsg_InitializeVideo,
138  int32 /*channel_id*/,
139  media::cast::transport::CastTransportVideoConfig /*config*/)
140
141IPC_MESSAGE_CONTROL3(
142    CastHostMsg_InsertCodedAudioFrame,
143    int32 /* channel_id */,
144    media::cast::transport::EncodedAudioFrame /* audio_frame */,
145    base::TimeTicks /* recorded_time */)
146
147IPC_MESSAGE_CONTROL3(
148    CastHostMsg_InsertCodedVideoFrame,
149    int32 /* channel_id */,
150    media::cast::transport::EncodedVideoFrame /* video_frame */,
151    base::TimeTicks /* recorded_time */)
152
153IPC_MESSAGE_CONTROL5(
154    CastHostMsg_SendRtcpFromRtpSender,
155    int32 /* channel_id */,
156    media::cast::transport::SendRtcpFromRtpSenderData /* flags, ssrc, name */,
157    media::cast::transport::RtcpSenderInfo /* sender_info */,
158    media::cast::transport::RtcpDlrrReportBlock /* dlrr */,
159    media::cast::transport::RtcpSenderLogMessage /* sender_log */)
160
161IPC_MESSAGE_CONTROL3(
162    CastHostMsg_ResendPackets,
163    int32 /* channel_id */,
164    bool /* is_audio */,
165    media::cast::MissingFramesAndPacketsMap /* missing_packets */)
166
167IPC_MESSAGE_CONTROL2(
168    CastHostMsg_New,
169    int32 /* channel_id */,
170    net::IPEndPoint /*remote_end_point*/);
171
172IPC_MESSAGE_CONTROL1(
173    CastHostMsg_Delete,
174    int32 /* channel_id */);
175