1 /** \addtogroup  RTP_Stack
2  *  @{
3  */
4 
5 /**
6  * @brief   This file contains RTP protocol stack related constants, enums, structures and
7  * callback defines.
8  *
9  */
10 
11 /**
12  * Copyright (C) 2022 The Android Open Source Project
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  *      http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  */
26 
27 #ifndef _RTP_SERVICE_TYPES_H_
28 #define _RTP_SERVICE_TYPES_H_
29 
30 #include <RtpPfDatatypes.h>
31 
32 typedef void* RTPSESSIONID;
33 
34 typedef enum
35 {
36     RTPSVC_RECEIVE_RTP_IND,
37     RTPSVC_RECEIVE_RTCP_SR_IND,
38     RTPSVC_RECEIVE_RTCP_RR_IND,
39     RTPSVC_RECEIVE_RTCP_SDES_IND,
40     RTPSVC_RECEIVE_RTCP_BYE_IND,
41     RTPSVC_RECEIVE_RTCP_APP_IND,  // 5
42     RTPSVC_SESS_READY_DEL_IND,
43     RTPSVC_CREATE_MEMBER_IND,
44     RTPSVC_DELETE_MEMBER_IND,
45     RTPSVC_SSRC_COLLISION_CHANGED_IND,
46     RTPSVC_MEMBER_COLLISION_IND,  // 10
47     RTPSVC_RECEIVE_RTCP_TIMER_EXPIRY_IND,
48     RTPSVC_UNKNOWN_ERR_IND,
49     RTPSVC_RECEIVE_RTCP_FB_IND,
50     RTPSVC_RECEIVE_RTCP_PAYLOAD_FB_IND,
51     RTPSVC_LAST_IND_FROM_STACK = 0x7fff
52 } tRtpSvc_IndicationFromStack;
53 
54 typedef RtpDt_Void (*RtpSvc_AppIndCbFunc)(
55         tRtpSvc_IndicationFromStack eIndType, RtpDt_Void* pData, RtpDt_Void* pvUserData);
56 
57 typedef RtpDt_Void (*RtpSvc_AppIndCbRtcp)(RtpDt_Void* pData, RtpDt_Void* pvUserData);
58 typedef RtpDt_Int32 (*RtpSvc_SendToPeerCb)(RtpDt_UChar*, RtpSvc_Length, RtpDt_Void* pvUserData);
59 typedef RtpDt_Int32 (*RtcpSvc_SendToPeerCb)(RtpDt_UChar*, RtpSvc_Length, RtpDt_Void* pvUserData);
60 
61 typedef struct
62 {
63     RtpDt_UInt32 payloadType;
64     RtpDt_UInt32 samplingRate;
65 } tRtpSvc_SetPayloadParam;
66 
67 typedef struct
68 {
69     eRtp_Bool bMbit;
70     RtpDt_UChar byPayLoadType;
71     eRtp_Bool bUseLastTimestamp;
72     RtpDt_UInt32 diffFromLastRtpTimestamp;
73 
74     // Rtp extension header
75     eRtp_Bool bXbit;
76     RtpDt_UInt16 wDefinedByProfile;
77     RtpDt_UInt16 wExtLen;
78     RtpDt_Int8* pExtData;
79     RtpDt_Int32 nExtDataSize;
80 } tRtpSvc_SendRtpPacketParam;
81 
82 /*
83 typedef struct
84 {
85     eRtp_Bool    bMbit;
86     RtpDt_UChar    byPayLoadType;
87     eRtp_Bool    bUseLastTimestamp;
88     RtpDt_UInt32    ssrc;
89 }RtpSvc_SendRtcpAppPacketParm;    */
90 
91 typedef struct
92 {
93     eRtp_Bool bMbit;
94     RtpDt_UInt32 dwTimestamp;
95     RtpDt_UInt32 dwPayloadType;
96     RtpDt_UInt16 dwSeqNum;
97     RtpDt_UInt32 dwSsrc;
98 
99     RtpDt_UInt16 wMsgHdrLen;
100     RtpDt_UChar* pMsgHdr;
101 
102     RtpDt_UInt16 wMsgBodyLen;
103     RtpDt_UChar* pMsgBody;
104 
105     /* RTP Header extension */
106     RtpDt_UInt16 wDefinedByProfile;
107     RtpDt_UInt16 wExtLen;
108     RtpDt_UChar* pExtData;
109     RtpDt_UInt16 wExtDataSize;
110 } tRtpSvcIndSt_ReceiveRtpInd;
111 
112 typedef struct
113 {
114     RtpDt_UInt16 wSubType;
115     RtpDt_UInt32 dwName;
116     RtpDt_UInt16 wMsgLen;  // total RTCP length
117     RtpDt_UChar* pMsg;     // total RTCP Packet(Hdr + App Info)
118 } tRtpSvcIndSt_ReceiveRtcpAppInd;
119 
120 // To support RTCP Feedback
121 typedef struct
122 {
123     RtpDt_UInt16 wPayloadType;
124     RtpDt_UInt16 wFmt;
125     RtpDt_UInt32 dwMediaSsrc;
126     RtpDt_UInt16 wMsgLen;  // total RTCP length
127     RtpDt_UChar* pMsg;     // total RTCP Packet(Hdr + App Info)
128 } tRtpSvcIndSt_ReceiveRtcpFeedbackInd;
129 
130 typedef struct
131 {
132     RtpDt_UInt16 wMsgLen;
133     RtpDt_UChar* pMsg;
134 } tRtpSvcIndSt_ReceiveOtherRtcpInd;
135 
136 typedef struct
137 {
138     RtpDt_UInt32 dwOldSsrc;
139     RtpDt_UInt32 dwNewSsrc;
140 } tRtpSvcIndSt_SsrcCollisionInd;
141 
142 typedef struct
143 {
144     unsigned int ssrc;
145     unsigned int fractionLost;
146     unsigned int cumPktsLost;
147     unsigned int extHighSeqNum;
148     unsigned int jitter;
149     unsigned int lsr;
150     unsigned int delayLsr;
151 } tRtpSvcRecvReport;
152 
153 typedef struct
154 {
155     unsigned int ntpTimestampMsw;
156     unsigned int ntpTimestampLsw;
157     unsigned int rtpTimestamp;
158     unsigned int sendPktCount;
159     unsigned int sendOctCount;
160     tRtpSvcRecvReport stRecvRpt;  // only one RR block is supported.
161 } tNotifyReceiveRtcpSrInd;
162 
163 typedef struct
164 {
165     tRtpSvcRecvReport stRecvRpt;  // only one RR block is supported.
166 } tNotifyReceiveRtcpRrInd;
167 
168 #endif /* End of _RTP_SERVICE_TYPES_H_*/
169 
170 /** @}*/
171