1 /**
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef IMSMEDIA_RTP_RECEPTION_STATISTICS_H
18 #define IMSMEDIA_RTP_RECEPTION_STATISTICS_H
19 
20 #include <binder/Parcel.h>
21 #include <binder/Parcelable.h>
22 #include <binder/Status.h>
23 #include <stdint.h>
24 
25 namespace android
26 {
27 
28 namespace telephony
29 {
30 
31 namespace imsmedia
32 {
33 
34 /* Native representation of android.telephony.imsmedia.RtpReceptionStats */
35 
36 class RtpReceptionStats : public Parcelable
37 {
38 public:
39     RtpReceptionStats();
40     RtpReceptionStats(const int32_t rtpTimestamp, const int32_t rtcpSrTimestamp, const int64_t ntp,
41             const int32_t jitterBuffer, const int32_t roundTripTime);
42     RtpReceptionStats(const RtpReceptionStats& params);
43     virtual ~RtpReceptionStats();
44     RtpReceptionStats& operator=(const RtpReceptionStats& params);
45     bool operator==(const RtpReceptionStats& params) const;
46     bool operator!=(const RtpReceptionStats& params) const;
47     status_t writeToParcel(Parcel* out) const;
48     status_t readFromParcel(const Parcel* in);
49     int32_t getRtpTimestamp();
50     void setRtpTimestamp(const int32_t timestamp);
51     int32_t getRtcpSrTimestamp();
52     void setRtcpSrTimestamp(const int32_t timestamp);
53     int64_t getRtcpSrNtpTimestamp();
54     void setRtcpSrNtpTimestamp(const int64_t ntp);
55     int32_t getJitterBufferMs();
56     void setJitterBufferMs(const int32_t jitterBufferMs);
57     int32_t getRoundTripTimeMs();
58     void setRoundTripTimeMs(const int32_t roundTripTimeMs);
59     void setDefaultConfig();
60 
61 private:
62     /* The timestamp reflects the sampling instant of the latest RTP packet received */
63     int32_t mRtpTimestamp;
64     /* The timestamp reflects the sampling instant of the latest RTCP-SR packet received */
65     int32_t mRtcpSrTimestamp;
66     /* The NTP timestamp of latest RTCP-SR packet received */
67     int64_t mRtcpSrNtpTimestamp;
68     /** The mean jitter buffer delay of a media stream from received to playback, measured in
69      * milliseconds, within the reporting interval */
70     int32_t mJitterBufferMs;
71     /* The round trip time delay in millisecond when latest RTP packet received */
72     int32_t mRoundTripTimeMs;
73 };
74 
75 }  // namespace imsmedia
76 
77 }  // namespace telephony
78 
79 }  // namespace android
80 
81 #endif  // IMSMEDIA_RTP_RECEPTION_STATISTICS_H
82