]> sjero.net Git - linphone/blob - java/impl/org/linphone/core/LinphoneCallStatsImpl.java
53fcb5ffd5fe701d54b0802e9d5a34e57cb35dee
[linphone] / java / impl / org / linphone / core / LinphoneCallStatsImpl.java
1 /*
2 LinPhoneCallStatsImpl.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
22 class LinphoneCallStatsImpl implements LinphoneCallStats {
23         private int mediaType;
24         private int iceState;
25         private float downloadBandwidth;
26         private float uploadBandwidth;
27         private float senderLossRate;
28         private float receiverLossRate;
29         private float senderInterarrivalJitter;
30         private float receiverInterarrivalJitter;
31         private float roundTripDelay;
32         private long latePacketsCumulativeNumber;
33         private float jitterBufferSize;
34
35         private native int getMediaType(long nativeStatsPtr);
36         private native int getIceState(long nativeStatsPtr);
37         private native float getDownloadBandwidth(long nativeStatsPtr);
38         private native float getUploadBandwidth(long nativeStatsPtr);
39         private native float getSenderLossRate(long nativeStatsPtr);
40         private native float getReceiverLossRate(long nativeStatsPtr);
41         private native float getSenderInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr);
42         private native float getReceiverInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr);
43         private native float getRoundTripDelay(long nativeStatsPtr);
44         private native long getLatePacketsCumulativeNumber(long nativeStatsPtr, long nativeCallPtr);
45         private native float getJitterBufferSize(long nativeStatsPtr);
46
47         protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) {
48                 mediaType = getMediaType(nativeStatsPtr);
49                 iceState = getIceState(nativeStatsPtr);
50                 downloadBandwidth = getDownloadBandwidth(nativeStatsPtr);
51                 uploadBandwidth = getUploadBandwidth(nativeStatsPtr);
52                 senderLossRate = getSenderLossRate(nativeStatsPtr);
53                 receiverLossRate = getReceiverLossRate(nativeStatsPtr);
54                 senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr, nativeCallPtr);
55                 receiverInterarrivalJitter = getReceiverInterarrivalJitter(nativeStatsPtr, nativeCallPtr);
56                 roundTripDelay = getRoundTripDelay(nativeStatsPtr);
57                 latePacketsCumulativeNumber = getLatePacketsCumulativeNumber(nativeStatsPtr, nativeCallPtr);
58                 jitterBufferSize = getJitterBufferSize(nativeStatsPtr);
59         }
60
61         public MediaType getMediaType() {
62                 return MediaType.fromInt(mediaType);
63         }
64
65         public IceState getIceState() {
66                 return IceState.fromInt(iceState);
67         }
68
69         public float getDownloadBandwidth() {
70                 return downloadBandwidth;
71         }
72
73         public float getUploadBandwidth() {
74                 return uploadBandwidth;
75         }
76
77         public float getSenderLossRate() {
78                 return senderLossRate;
79         }
80
81         public float getReceiverLossRate() {
82                 return receiverLossRate;
83         }
84
85         public float getSenderInterarrivalJitter() {
86                 return senderInterarrivalJitter;
87         }
88
89         public float getReceiverInterarrivalJitter() {
90                 return receiverInterarrivalJitter;
91         }
92
93         public float getRoundTripDelay() {
94                 return roundTripDelay;
95         }
96
97         public long getLatePacketsCumulativeNumber() {
98                 return latePacketsCumulativeNumber;
99         }
100
101         public float getJitterBufferSize() {
102                 return jitterBufferSize;
103         }
104 }