Add JNI to access call statistics.
This commit is contained in:
parent
b84edf9849
commit
055d28c5ce
3 changed files with 102 additions and 0 deletions
|
@ -55,6 +55,8 @@ import org.linphone.core.LinphoneAuthInfo;
|
|||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
import org.linphone.core.LinphoneCallStats.MediaType;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
|
@ -1002,6 +1004,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
mListenerDispatcher.onCallStateChanged(call, state, message);
|
||||
}
|
||||
|
||||
public void callStatsUpdated(final LinphoneCore lc, final LinphoneCall call, final LinphoneCallStats stats) {}
|
||||
|
||||
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
||||
boolean encrypted, String authenticationToken) {
|
||||
mListenerDispatcher.onCallEncryptionChanged(call, encrypted, authenticationToken);
|
||||
|
|
|
@ -23,6 +23,9 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
|
||||
protected final long nativePtr;
|
||||
boolean ownPtr = false;
|
||||
private LinphoneCallStats audioStats;
|
||||
private LinphoneCallStats videoStats;
|
||||
|
||||
native private void finalize(long nativePtr);
|
||||
native private long getCallLog(long nativePtr);
|
||||
private native boolean isIncoming(long nativePtr);
|
||||
|
@ -58,6 +61,18 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
public void setAudioStats(LinphoneCallStats stats) {
|
||||
audioStats = stats;
|
||||
}
|
||||
public void setVideoStats(LinphoneCallStats stats) {
|
||||
videoStats = stats;
|
||||
}
|
||||
public LinphoneCallStats getAudioStats() {
|
||||
return audioStats;
|
||||
}
|
||||
public LinphoneCallStats getVideoStats() {
|
||||
return videoStats;
|
||||
}
|
||||
public CallDirection getDirection() {
|
||||
return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing;
|
||||
}
|
||||
|
|
83
src/org/linphone/core/LinphoneCallStatsImpl.java
Normal file
83
src/org/linphone/core/LinphoneCallStatsImpl.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
LinPhoneCallStatsImpl.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
|
||||
class LinphoneCallStatsImpl implements LinphoneCallStats {
|
||||
private int mediaType;
|
||||
private float senderLossRate;
|
||||
private float receiverLossRate;
|
||||
private float senderInterarrivalJitter;
|
||||
private float receiverInterarrivalJitter;
|
||||
private float roundTripDelay;
|
||||
private long latePacketsCumulativeNumber;
|
||||
private float jitterBufferSize;
|
||||
|
||||
private native int getMediaType(long nativeStatsPtr);
|
||||
private native float getSenderLossRate(long nativeStatsPtr);
|
||||
private native float getReceiverLossRate(long nativeStatsPtr);
|
||||
private native float getSenderInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr);
|
||||
private native float getReceiverInterarrivalJitter(long nativeStatsPtr, long nativeCallPtr);
|
||||
private native float getRoundTripDelay(long nativeStatsPtr);
|
||||
private native long getLatePacketsCumulativeNumber(long nativeStatsPtr, long nativeCallPtr);
|
||||
private native float getJitterBufferSize(long nativeStatsPtr);
|
||||
|
||||
protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) {
|
||||
mediaType = getMediaType(nativeStatsPtr);
|
||||
senderLossRate = getSenderLossRate(nativeStatsPtr);
|
||||
receiverLossRate = getReceiverLossRate(nativeStatsPtr);
|
||||
senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr, nativeCallPtr);
|
||||
receiverInterarrivalJitter = getReceiverInterarrivalJitter(nativeStatsPtr, nativeCallPtr);
|
||||
roundTripDelay = getRoundTripDelay(nativeStatsPtr);
|
||||
latePacketsCumulativeNumber = getLatePacketsCumulativeNumber(nativeStatsPtr, nativeCallPtr);
|
||||
jitterBufferSize = getJitterBufferSize(nativeStatsPtr);
|
||||
}
|
||||
|
||||
public MediaType getMediaType() {
|
||||
return MediaType.fromInt(mediaType);
|
||||
}
|
||||
|
||||
public float getSenderLossRate() {
|
||||
return senderLossRate;
|
||||
}
|
||||
|
||||
public float getReceiverLossRate() {
|
||||
return receiverLossRate;
|
||||
}
|
||||
|
||||
public float getSenderInterarrivalJitter() {
|
||||
return senderInterarrivalJitter;
|
||||
}
|
||||
|
||||
public float getReceiverInterarrivalJitter() {
|
||||
return receiverInterarrivalJitter;
|
||||
}
|
||||
|
||||
public float getRoundTripDelay() {
|
||||
return roundTripDelay;
|
||||
}
|
||||
|
||||
public long getLatePacketsCumulativeNumber() {
|
||||
return latePacketsCumulativeNumber;
|
||||
}
|
||||
|
||||
public float getJitterBufferSize() {
|
||||
return jitterBufferSize;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue