]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneCallStats.java
add jni and java accessors for realtime late and loss rates
[linphone] / java / common / org / linphone / core / LinphoneCallStats.java
1 /*
2 LinPhoneCallStats.java
3 Copyright (C) 2010  Belledonne Communications, Grenoble, France
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19 package org.linphone.core;
20
21 import java.util.Vector;
22
23
24 public interface LinphoneCallStats {
25         static public class MediaType {
26                 static private Vector<MediaType> values = new Vector<MediaType>();
27                 /**
28                  * Audio
29                  */
30                 static public MediaType Audio = new MediaType(0, "Audio");
31                 /**
32                  * Video
33                  */
34                 static public MediaType Video = new MediaType(1, "Video");
35                 protected final int mValue;
36                 private final String mStringValue;
37
38                 private MediaType(int value, String stringValue) {
39                         mValue = value;
40                         values.addElement(this);
41                         mStringValue = stringValue;
42                 }
43                 public static MediaType fromInt(int value) {
44                         for (int i = 0; i < values.size(); i++) {
45                                 MediaType mtype = (MediaType) values.elementAt(i);
46                                 if (mtype.mValue == value) return mtype;
47                         }
48                         throw new RuntimeException("MediaType not found [" + value + "]");
49                 }
50                 public String toString() {
51                         return mStringValue;
52                 }
53         }
54         static public class IceState {
55                 static private Vector<IceState> values = new Vector<IceState>();
56                 /**
57                  * Not activated
58                  */
59                 static public IceState NotActivated = new IceState(0, "Not activated");
60                 /**
61                  * Failed
62                  */
63                 static public IceState Failed = new IceState(1, "Failed");
64                 /**
65                  * In progress
66                  */
67                 static public IceState InProgress = new IceState(2, "In progress");
68                 /**
69                  * Host connection
70                  */
71                 static public IceState HostConnection = new IceState(3, "Host connection");
72                 /**
73                  * Reflexive connection
74                  */
75                 static public IceState ReflexiveConnection = new IceState(4, "Reflexive connection");
76                 /**
77                  * Relay connection
78                  */
79                 static public IceState RelayConnection = new IceState(5, "Relay connection");
80                 protected final int mValue;
81                 private final String mStringValue;
82
83                 private IceState(int value, String stringValue) {
84                         mValue = value;
85                         values.addElement(this);
86                         mStringValue = stringValue;
87                 }
88                 public static IceState fromInt(int value) {
89                         for (int i = 0; i < values.size(); i++) {
90                                 IceState mstate = (IceState) values.elementAt(i);
91                                 if (mstate.mValue == value) return mstate;
92                         }
93                         throw new RuntimeException("IceState not found [" + value + "]");
94                 }
95                 public String toString() {
96                         return mStringValue;
97                 }
98         }
99
100         /**
101          * Get the stats media type
102          * @return MediaType
103          */
104         public MediaType getMediaType();
105
106         /**
107          * Get the ICE state
108          */
109         public IceState getIceState();
110
111         /**
112          * Get the download bandwidth in kbit/s
113          * @return The download bandwidth
114          */
115         public float getDownloadBandwidth();
116
117         /**
118          * Get the upload bandwidth in kbit/s
119          * @return The upload bandwidth
120          */
121         public float getUploadBandwidth();
122
123         /**
124          * Get the local loss rate since last report
125          * @return The sender loss rate
126          */
127         public float getSenderLossRate();
128
129         /**
130          * Get the remote reported loss rate since last report
131          * @return The receiver loss rate
132          */
133         public float getReceiverLossRate();
134
135         /**
136          * Get the local interarrival jitter
137          * @return The interarrival jitter at last emitted sender report
138          */
139         public float getSenderInterarrivalJitter();
140
141         /**
142          * Get the remote reported interarrival jitter
143          * @return The interarrival jitter at last received receiver report
144          */
145         public float getReceiverInterarrivalJitter();
146
147         /**
148          * Get the round trip delay
149          * @return The round trip delay in seconds, -1 if the information is not available
150          */
151         public float getRoundTripDelay();
152
153         /**
154          * Get the cumulative number of late packets
155          * @return The cumulative number of late packets
156          */
157         public long getLatePacketsCumulativeNumber();
158
159         /**
160          * Get the jitter buffer size
161          * @return The jitter buffer size in milliseconds
162          */
163         public float getJitterBufferSize();
164
165         /**
166          * Get the local loss rate. Unlike getSenderLossRate() that returns this loss rate "since last emitted RTCP report", the value returned here is updated every second.
167          * @return The local loss rate percentage.
168         **/
169         public float getLocalLossRate();
170
171         /**
172          * Get the local late packets rate. The value returned here is updated every second.
173          * @return The local late rate percentage.
174         **/
175         public float getLocalLateRate();
176 }