android: 'synchronized' native calls to liblinphone
Avoids dead locks in exosip.
This commit is contained in:
parent
e37088be43
commit
e0c3390938
1 changed files with 48 additions and 48 deletions
|
@ -216,17 +216,17 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
public synchronized void setNetworkReachable(boolean isReachable) {
|
public synchronized void setNetworkReachable(boolean isReachable) {
|
||||||
setNetworkStateReachable(nativePtr,isReachable);
|
setNetworkStateReachable(nativePtr,isReachable);
|
||||||
}
|
}
|
||||||
public void setPlaybackGain(float gain) {
|
public synchronized void setPlaybackGain(float gain) {
|
||||||
setPlaybackGain(nativePtr,gain);
|
setPlaybackGain(nativePtr,gain);
|
||||||
|
|
||||||
}
|
}
|
||||||
public float getPlaybackGain() {
|
public synchronized float getPlaybackGain() {
|
||||||
return getPlaybackGain(nativePtr);
|
return getPlaybackGain(nativePtr);
|
||||||
}
|
}
|
||||||
public void muteMic(boolean isMuted) {
|
public synchronized void muteMic(boolean isMuted) {
|
||||||
muteMic(nativePtr,isMuted);
|
muteMic(nativePtr,isMuted);
|
||||||
}
|
}
|
||||||
public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException {
|
public synchronized LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException {
|
||||||
long lAddress = interpretUrl(nativePtr,destination);
|
long lAddress = interpretUrl(nativePtr,destination);
|
||||||
if (lAddress != 0) {
|
if (lAddress != 0) {
|
||||||
return new LinphoneAddressImpl(lAddress,true);
|
return new LinphoneAddressImpl(lAddress,true);
|
||||||
|
@ -234,7 +234,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
throw new LinphoneCoreException("Cannot interpret ["+destination+"]");
|
throw new LinphoneCoreException("Cannot interpret ["+destination+"]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException {
|
public synchronized LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException {
|
||||||
long lNativePtr = inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr);
|
long lNativePtr = inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr);
|
||||||
if (lNativePtr!=0) {
|
if (lNativePtr!=0) {
|
||||||
return new LinphoneCallImpl(lNativePtr);
|
return new LinphoneCallImpl(lNativePtr);
|
||||||
|
@ -243,16 +243,16 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendDtmf(char number) {
|
public synchronized void sendDtmf(char number) {
|
||||||
sendDtmf(nativePtr,number);
|
sendDtmf(nativePtr,number);
|
||||||
}
|
}
|
||||||
public void clearCallLogs() {
|
public synchronized void clearCallLogs() {
|
||||||
clearCallLogs(nativePtr);
|
clearCallLogs(nativePtr);
|
||||||
}
|
}
|
||||||
public boolean isMicMuted() {
|
public synchronized boolean isMicMuted() {
|
||||||
return isMicMuted(nativePtr);
|
return isMicMuted(nativePtr);
|
||||||
}
|
}
|
||||||
public PayloadType findPayloadType(String mime, int clockRate) {
|
public synchronized PayloadType findPayloadType(String mime, int clockRate) {
|
||||||
isValid();
|
isValid();
|
||||||
long playLoadType = findPayloadType(nativePtr, mime, clockRate);
|
long playLoadType = findPayloadType(nativePtr, mime, clockRate);
|
||||||
if (playLoadType == 0) {
|
if (playLoadType == 0) {
|
||||||
|
@ -261,7 +261,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
return new PayloadTypeImpl(playLoadType);
|
return new PayloadTypeImpl(playLoadType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void enablePayloadType(PayloadType pt, boolean enable)
|
public synchronized void enablePayloadType(PayloadType pt, boolean enable)
|
||||||
throws LinphoneCoreException {
|
throws LinphoneCoreException {
|
||||||
isValid();
|
isValid();
|
||||||
if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) {
|
if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) {
|
||||||
|
@ -269,11 +269,11 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public void enableEchoCancellation(boolean enable) {
|
public synchronized void enableEchoCancellation(boolean enable) {
|
||||||
isValid();
|
isValid();
|
||||||
enableEchoCancellation(nativePtr, enable);
|
enableEchoCancellation(nativePtr, enable);
|
||||||
}
|
}
|
||||||
public boolean isEchoCancellationEnabled() {
|
public synchronized boolean isEchoCancellationEnabled() {
|
||||||
isValid();
|
isValid();
|
||||||
return isEchoCancellationEnabled(nativePtr);
|
return isEchoCancellationEnabled(nativePtr);
|
||||||
|
|
||||||
|
@ -305,27 +305,27 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public void playDtmf(char number, int duration) {
|
public synchronized void playDtmf(char number, int duration) {
|
||||||
playDtmf(nativePtr,number, duration);
|
playDtmf(nativePtr,number, duration);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void stopDtmf() {
|
public synchronized void stopDtmf() {
|
||||||
stopDtmf(nativePtr);
|
stopDtmf(nativePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFriend(LinphoneFriend lf) throws LinphoneCoreException {
|
public synchronized void addFriend(LinphoneFriend lf) throws LinphoneCoreException {
|
||||||
addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr);
|
addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void setPresenceInfo(int minute_away, String alternative_contact,
|
public synchronized void setPresenceInfo(int minute_away, String alternative_contact,
|
||||||
OnlineStatus status) {
|
OnlineStatus status) {
|
||||||
setPresenceInfo(nativePtr,minute_away,alternative_contact,status.mValue);
|
setPresenceInfo(nativePtr,minute_away,alternative_contact,status.mValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
public LinphoneChatRoom createChatRoom(String to) {
|
public synchronized LinphoneChatRoom createChatRoom(String to) {
|
||||||
return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to));
|
return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to));
|
||||||
}
|
}
|
||||||
public void setPreviewWindow(Object w) {
|
public synchronized void setPreviewWindow(Object w) {
|
||||||
if (mPreviewWindow!=null)
|
if (mPreviewWindow!=null)
|
||||||
mPreviewWindow.setListener(null);
|
mPreviewWindow.setListener(null);
|
||||||
mPreviewWindow=new AndroidVideoWindowImpl((SurfaceView)w);
|
mPreviewWindow=new AndroidVideoWindowImpl((SurfaceView)w);
|
||||||
|
@ -339,7 +339,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void setVideoWindow(Object w) {
|
public synchronized void setVideoWindow(Object w) {
|
||||||
if (mVideoWindow!=null)
|
if (mVideoWindow!=null)
|
||||||
mVideoWindow.setListener(null);
|
mVideoWindow.setListener(null);
|
||||||
mVideoWindow=new AndroidVideoWindowImpl((SurfaceView) w);
|
mVideoWindow=new AndroidVideoWindowImpl((SurfaceView) w);
|
||||||
|
@ -353,30 +353,30 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void enableVideo(boolean vcap_enabled, boolean display_enabled) {
|
public synchronized void enableVideo(boolean vcap_enabled, boolean display_enabled) {
|
||||||
enableVideo(nativePtr,vcap_enabled, display_enabled);
|
enableVideo(nativePtr,vcap_enabled, display_enabled);
|
||||||
}
|
}
|
||||||
public boolean isVideoEnabled() {
|
public synchronized boolean isVideoEnabled() {
|
||||||
return isVideoEnabled(nativePtr);
|
return isVideoEnabled(nativePtr);
|
||||||
}
|
}
|
||||||
public FirewallPolicy getFirewallPolicy() {
|
public synchronized FirewallPolicy getFirewallPolicy() {
|
||||||
return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr));
|
return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr));
|
||||||
}
|
}
|
||||||
public String getStunServer() {
|
public synchronized String getStunServer() {
|
||||||
return getStunServer(nativePtr);
|
return getStunServer(nativePtr);
|
||||||
}
|
}
|
||||||
public void setFirewallPolicy(FirewallPolicy pol) {
|
public synchronized void setFirewallPolicy(FirewallPolicy pol) {
|
||||||
setFirewallPolicy(nativePtr,pol.value());
|
setFirewallPolicy(nativePtr,pol.value());
|
||||||
}
|
}
|
||||||
public void setStunServer(String stunServer) {
|
public synchronized void setStunServer(String stunServer) {
|
||||||
setStunServer(nativePtr,stunServer);
|
setStunServer(nativePtr,stunServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinphoneCallParams createDefaultCallParameters() {
|
public synchronized LinphoneCallParams createDefaultCallParameters() {
|
||||||
return new LinphoneCallParamsImpl(createDefaultCallParams(nativePtr));
|
return new LinphoneCallParamsImpl(createDefaultCallParams(nativePtr));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException {
|
public synchronized LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException {
|
||||||
long ptrDestination = ((LinphoneAddressImpl)to).nativePtr;
|
long ptrDestination = ((LinphoneAddressImpl)to).nativePtr;
|
||||||
long ptrParams =((LinphoneCallParamsImpl)params).nativePtr;
|
long ptrParams =((LinphoneCallParamsImpl)params).nativePtr;
|
||||||
|
|
||||||
|
@ -388,25 +388,25 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int updateCall(LinphoneCall call, LinphoneCallParams params) {
|
public synchronized int updateCall(LinphoneCall call, LinphoneCallParams params) {
|
||||||
long ptrCall = ((LinphoneCallImpl) call).nativePtr;
|
long ptrCall = ((LinphoneCallImpl) call).nativePtr;
|
||||||
long ptrParams = params!=null ? ((LinphoneCallParamsImpl)params).nativePtr : 0;
|
long ptrParams = params!=null ? ((LinphoneCallParamsImpl)params).nativePtr : 0;
|
||||||
|
|
||||||
return updateCall(nativePtr, ptrCall, ptrParams);
|
return updateCall(nativePtr, ptrCall, ptrParams);
|
||||||
}
|
}
|
||||||
public void setUploadBandwidth(int bw) {
|
public synchronized void setUploadBandwidth(int bw) {
|
||||||
setUploadBandwidth(nativePtr, bw);
|
setUploadBandwidth(nativePtr, bw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDownloadBandwidth(int bw) {
|
public synchronized void setDownloadBandwidth(int bw) {
|
||||||
setDownloadBandwidth(nativePtr, bw);
|
setDownloadBandwidth(nativePtr, bw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPreferredVideoSize(VideoSize vSize) {
|
public synchronized void setPreferredVideoSize(VideoSize vSize) {
|
||||||
setPreferredVideoSize(nativePtr, vSize.width, vSize.height);
|
setPreferredVideoSize(nativePtr, vSize.width, vSize.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VideoSize getPreferredVideoSize() {
|
public synchronized VideoSize getPreferredVideoSize() {
|
||||||
int[] nativeSize = getPreferredVideoSize(nativePtr);
|
int[] nativeSize = getPreferredVideoSize(nativePtr);
|
||||||
|
|
||||||
VideoSize vSize = new VideoSize();
|
VideoSize vSize = new VideoSize();
|
||||||
|
@ -414,18 +414,18 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
vSize.height = nativeSize[1];
|
vSize.height = nativeSize[1];
|
||||||
return vSize;
|
return vSize;
|
||||||
}
|
}
|
||||||
public void setRing(String path) {
|
public synchronized void setRing(String path) {
|
||||||
setRing(nativePtr, path);
|
setRing(nativePtr, path);
|
||||||
}
|
}
|
||||||
public String getRing() {
|
public synchronized String getRing() {
|
||||||
return getRing(nativePtr);
|
return getRing(nativePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRootCA(String path) {
|
public synchronized void setRootCA(String path) {
|
||||||
setRootCA(nativePtr, path);
|
setRootCA(nativePtr, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PayloadType[] getVideoCodecs() {
|
public synchronized PayloadType[] getVideoCodecs() {
|
||||||
long[] typesPtr = listVideoPayloadTypes(nativePtr);
|
long[] typesPtr = listVideoPayloadTypes(nativePtr);
|
||||||
if (typesPtr == null) return null;
|
if (typesPtr == null) return null;
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
|
|
||||||
return codecs;
|
return codecs;
|
||||||
}
|
}
|
||||||
public PayloadType[] getAudioCodecs() {
|
public synchronized PayloadType[] getAudioCodecs() {
|
||||||
long[] typesPtr = listAudioPayloadTypes(nativePtr);
|
long[] typesPtr = listAudioPayloadTypes(nativePtr);
|
||||||
if (typesPtr == null) return null;
|
if (typesPtr == null) return null;
|
||||||
|
|
||||||
|
@ -449,21 +449,21 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
|
|
||||||
return codecs;
|
return codecs;
|
||||||
}
|
}
|
||||||
public boolean isNetworkReachable() {
|
public synchronized boolean isNetworkReachable() {
|
||||||
throw new RuntimeException("Not implemented");
|
throw new RuntimeException("Not implemented");
|
||||||
}
|
}
|
||||||
public void enableKeepAlive(boolean enable) {
|
public synchronized void enableKeepAlive(boolean enable) {
|
||||||
enableKeepAlive(nativePtr,enable);
|
enableKeepAlive(nativePtr,enable);
|
||||||
|
|
||||||
}
|
}
|
||||||
public boolean isKeepAliveEnabled() {
|
public synchronized boolean isKeepAliveEnabled() {
|
||||||
return isKeepAliveEnabled(nativePtr);
|
return isKeepAliveEnabled(nativePtr);
|
||||||
}
|
}
|
||||||
public void startEchoCalibration(Object data) throws LinphoneCoreException {
|
public synchronized void startEchoCalibration(Object data) throws LinphoneCoreException {
|
||||||
startEchoCalibration(nativePtr, data);
|
startEchoCalibration(nativePtr, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transports getSignalingTransportPorts() {
|
public synchronized Transports getSignalingTransportPorts() {
|
||||||
Transports transports = new Transports();
|
Transports transports = new Transports();
|
||||||
transports.udp = getSignalingTransportPort(nativePtr, 0);
|
transports.udp = getSignalingTransportPort(nativePtr, 0);
|
||||||
transports.tcp = getSignalingTransportPort(nativePtr, 1);
|
transports.tcp = getSignalingTransportPort(nativePtr, 1);
|
||||||
|
@ -472,14 +472,14 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
// Code is the index in the structure
|
// Code is the index in the structure
|
||||||
return transports;
|
return transports;
|
||||||
}
|
}
|
||||||
public void setSignalingTransportPorts(Transports transports) {
|
public synchronized void setSignalingTransportPorts(Transports transports) {
|
||||||
setSignalingTransportPorts(nativePtr, transports.udp, transports.tcp, transports.tls);
|
setSignalingTransportPorts(nativePtr, transports.udp, transports.tcp, transports.tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableIpv6(boolean enable) {
|
public synchronized void enableIpv6(boolean enable) {
|
||||||
enableIpv6(nativePtr,enable);
|
enableIpv6(nativePtr,enable);
|
||||||
}
|
}
|
||||||
public void adjustSoftwareVolume(int i) {
|
public synchronized void adjustSoftwareVolume(int i) {
|
||||||
adjustSoftwareVolume(nativePtr, i);
|
adjustSoftwareVolume(nativePtr, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,15 +492,15 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
public synchronized boolean pauseAllCalls() {
|
public synchronized boolean pauseAllCalls() {
|
||||||
return 0 == pauseAllCalls(nativePtr);
|
return 0 == pauseAllCalls(nativePtr);
|
||||||
}
|
}
|
||||||
public void setDownloadPtime(int ptime) {
|
public synchronized void setDownloadPtime(int ptime) {
|
||||||
setDownloadPtime(nativePtr,ptime);
|
setDownloadPtime(nativePtr,ptime);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void setUploadPtime(int ptime) {
|
public synchronized void setUploadPtime(int ptime) {
|
||||||
setUploadPtime(nativePtr,ptime);
|
setUploadPtime(nativePtr,ptime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZrtpSecretsCache(String file) {
|
public synchronized void setZrtpSecretsCache(String file) {
|
||||||
setZrtpSecretsCache(nativePtr,file);
|
setZrtpSecretsCache(nativePtr,file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue