2 LinPhoneCallStatsImpl.java
3 Copyright (C) 2010 Belledonne Communications, Grenoble, France
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.
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.
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.
19 package org.linphone.core;
22 class LinphoneCallStatsImpl implements LinphoneCallStats {
23 private int mediaType;
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 private float localLossRate;
35 private float localLateRate;
36 private long nativePtr;
38 private native int getMediaType(long nativeStatsPtr);
39 private native int getIceState(long nativeStatsPtr);
40 private native float getDownloadBandwidth(long nativeStatsPtr);
41 private native float getUploadBandwidth(long nativeStatsPtr);
42 private native float getSenderLossRate(long nativeStatsPtr);
43 private native float getReceiverLossRate(long nativeStatsPtr);
44 private native float getSenderInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr);
45 private native float getReceiverInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr);
46 private native float getRoundTripDelay(long nativeStatsPtr);
47 private native long getLatePacketsCumulativeNumber(long nativeStatsPtr, long nativeCallPtr);
48 private native float getJitterBufferSize(long nativeStatsPtr);
49 private native float getLocalLossRate(long nativeStatsPtr);
50 private native float getLocalLateRate(long nativeStatsPtr);
51 private native void updateStats(long nativeCallPtr, int mediaType);
53 protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) {
54 nativePtr=nativeStatsPtr;
55 mediaType = getMediaType(nativeStatsPtr);
56 iceState = getIceState(nativeStatsPtr);
57 downloadBandwidth = getDownloadBandwidth(nativeStatsPtr);
58 uploadBandwidth = getUploadBandwidth(nativeStatsPtr);
59 senderLossRate = getSenderLossRate(nativeStatsPtr);
60 receiverLossRate = getReceiverLossRate(nativeStatsPtr);
61 senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr, nativeCallPtr);
62 receiverInterarrivalJitter = getReceiverInterarrivalJitter(nativeStatsPtr, nativeCallPtr);
63 roundTripDelay = getRoundTripDelay(nativeStatsPtr);
64 latePacketsCumulativeNumber = getLatePacketsCumulativeNumber(nativeStatsPtr, nativeCallPtr);
65 jitterBufferSize = getJitterBufferSize(nativeStatsPtr);
69 protected void updateRealTimeStats(LinphoneCall call){
70 updateStats( ((LinphoneCallImpl)call).nativePtr, mediaType);
71 localLossRate=getLocalLossRate(nativePtr);
72 localLateRate=getLocalLateRate(nativePtr);
75 public MediaType getMediaType() {
76 return MediaType.fromInt(mediaType);
79 public IceState getIceState() {
80 return IceState.fromInt(iceState);
83 public float getDownloadBandwidth() {
84 return downloadBandwidth;
87 public float getUploadBandwidth() {
88 return uploadBandwidth;
91 public float getSenderLossRate() {
92 return senderLossRate;
95 public float getReceiverLossRate() {
96 return receiverLossRate;
99 public float getSenderInterarrivalJitter() {
100 return senderInterarrivalJitter;
103 public float getReceiverInterarrivalJitter() {
104 return receiverInterarrivalJitter;
107 public float getRoundTripDelay() {
108 return roundTripDelay;
111 public long getLatePacketsCumulativeNumber() {
112 return latePacketsCumulativeNumber;
115 public float getJitterBufferSize() {
116 return jitterBufferSize;
119 public float getLocalLossRate(){
120 return localLossRate;
123 public float getLocalLateRate(){
124 return localLateRate;