Merge remote-tracking branch 'linphone/master'

This commit is contained in:
Simon Morlat 2015-02-25 15:52:51 +01:00
commit 0ef22d69c4
8 changed files with 128 additions and 38 deletions

View file

@ -818,11 +818,6 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from,
linphone_call_init_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], LINPHONE_CALL_STATS_AUDIO);
linphone_call_init_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], LINPHONE_CALL_STATS_VIDEO);
#ifdef ANDROID
ms_message("Call [%p] acquires both wifi and multicast lock",call);
linphone_core_wifi_lock_acquire(call->core);
linphone_core_multicast_lock_acquire(call->core); /*does no affect battery more than regular rtp traffic*/
#endif
}
void linphone_call_init_stats(LinphoneCallStats *stats, int type) {
@ -1248,13 +1243,14 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
call->prevstate=call->state;
if (call->state==LinphoneCallEnd || call->state==LinphoneCallError){
if (cstate!=LinphoneCallReleased){
ms_warning("Spurious call state change from %s to %s, ignored.",linphone_call_state_to_string(call->state),
linphone_call_state_to_string(cstate));
ms_warning("Spurious call state change from %s to %s, ignored." ,linphone_call_state_to_string(call->state)
,linphone_call_state_to_string(cstate));
return;
}
}
ms_message("Call %p: moving from state %s to %s",call,linphone_call_state_to_string(call->state),
linphone_call_state_to_string(cstate));
ms_message("Call %p: moving from state %s to %s",call
,linphone_call_state_to_string(call->state)
,linphone_call_state_to_string(cstate));
if (cstate!=LinphoneCallRefered){
/*LinphoneCallRefered is rather an event, not a state.
@ -1262,32 +1258,53 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
call->state=cstate;
}
if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){
switch (cstate) {
case LinphoneCallOutgoingInit:
case LinphoneCallIncomingReceived:
#ifdef ANDROID
ms_message("Call [%p] acquires both wifi and multicast lock",call);
linphone_core_wifi_lock_acquire(call->core);
linphone_core_multicast_lock_acquire(call->core); /*does no affect battery more than regular rtp traffic*/
#endif
break;
case LinphoneCallEnd:
case LinphoneCallError:
switch(call->non_op_error.reason){
case SalReasonDeclined:
call->log->status=LinphoneCallDeclined;
break;
case SalReasonRequestTimeout:
call->log->status=LinphoneCallMissed;
case SalReasonDeclined:
call->log->status=LinphoneCallDeclined;
break;
default:
case SalReasonRequestTimeout:
call->log->status=LinphoneCallMissed;
break;
default:
break;
}
linphone_call_set_terminated(call);
}
if (cstate == LinphoneCallConnected) {
break;
case LinphoneCallConnected:
call->log->status=LinphoneCallSuccess;
call->log->connected_date_time=time(NULL);
}
break;
case LinphoneCallStreamsRunning:
if (call->dtmfs_timer!=NULL){
/*cancelling DTMF sequence, if any*/
linphone_call_cancel_dtmfs(call);
}
break;
case LinphoneCallReleased:
#ifdef ANDROID
ms_message("Call [%p] releases wifi/multicast lock",call);
linphone_core_wifi_lock_release(call->core);
linphone_core_multicast_lock_release(call->core);
#endif
break;
default:
break;
}
linphone_core_notify_call_state_changed(lc,call,cstate,message);
linphone_reporting_call_state_updated(call);
/*cancelling DTMF sequence, if any*/
if (cstate!=LinphoneCallStreamsRunning && call->dtmfs_timer!=NULL){
linphone_call_cancel_dtmfs(call);
}
if (cstate==LinphoneCallReleased){
if (cstate==LinphoneCallReleased) {/*shall be performed after app notification*/
linphone_call_set_released(call);
}
linphone_core_soundcard_hint_check(lc);
@ -1364,11 +1381,6 @@ static void linphone_call_destroy(LinphoneCall *obj){
}
sal_error_info_reset(&obj->non_op_error);
#ifdef ANDROID
ms_message("Call [%p] releases wifi/multicast lock",obj);
linphone_core_wifi_lock_release(obj->core);
linphone_core_multicast_lock_release(obj->core);
#endif
}
/**

View file

@ -1639,6 +1639,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTy
return jCodecs;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) {
MSList *pts = NULL;
int codecsCount = env->GetArrayLength(jCodecs);
jlong *codecs = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++) {
PayloadType *pt = (PayloadType *)codecs[i];
ms_list_append(pts, pt);
}
linphone_core_set_video_codecs((LinphoneCore *)lc, pts);
env->ReleaseLongArrayElements(jCodecs, codecs, 0);
}
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes(JNIEnv* env
,jobject thiz
,jlong lc) {
@ -1657,6 +1669,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTy
return jCodecs;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) {
MSList *pts = NULL;
int codecsCount = env->GetArrayLength(jCodecs);
jlong *codecs = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++) {
PayloadType *pt = (PayloadType *)codecs[i];
pts = ms_list_append(pts, pt);
}
linphone_core_set_audio_codecs((LinphoneCore *)lc, pts);
env->ReleaseLongArrayElements(jCodecs, codecs, 0);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env
,jobject thiz
,jlong lc
@ -5861,4 +5885,10 @@ extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_videoMultica
return linphone_core_video_multicast_enabled((LinphoneCore*)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableDnsSrv(JNIEnv *env, jobject thiz, jlong lc, jboolean yesno) {
linphone_core_enable_dns_srv((LinphoneCore *)lc, yesno);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_dnsSrvEnabled(JNIEnv *env, jobject thiz, jlong lc) {
return linphone_core_dns_srv_enabled((LinphoneCore *)lc);
}

View file

@ -1127,11 +1127,21 @@ public interface LinphoneCore {
* @return
*/
PayloadType[] getAudioCodecs();
/**
* Set the list of audio codecs.
* @param codecs List of PayloadType objects
*/
void setAudioCodecs(PayloadType[] codecs);
/**
* Returns the currently supported video codecs, as PayloadType elements
* @return
*/
PayloadType[] getVideoCodecs();
/**
* Set the list of video codecs.
* @param codecs List of PayloadType objects
*/
void setVideoCodecs(PayloadType[] codecs);
/**
* enable signaling keep alive. small udp packet sent periodically to keep udp NAT association
*/
@ -2000,7 +2010,17 @@ public interface LinphoneCore {
* @return true if subsequent calls will propose multicast ip set by {@link linphone_core_set_video_multicast_addr}
**/
public boolean videoMulticastEnabled();
/**
* Enable or disable DNS SRV resolution.
* @param yesno true to enable DNS SRV resolution, false to disable it.
*/
public void enableDnsSrv(boolean yesno);
/**
* Tells whether DNS SRV resolution is enabled.
* @return true if DNS SRV resolution is enabled, false if disabled.
*/
public boolean dnsSrvEnabled();
}

View file

@ -114,12 +114,14 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void setRing(long nativePtr, String path);
private native String getRing(long nativePtr);
private native void setRootCA(long nativePtr, String path);
private native void setRingback(long nativePtr, String path);
private native void setRingback(long nativePtr, String path);
private native long[] listVideoPayloadTypes(long nativePtr);
private native void setVideoCodecs(long nativePtr, long[] codecs);
private native LinphoneProxyConfig[] getProxyConfigList(long nativePtr);
private native long[] getAuthInfosList(long nativePtr);
private native long findAuthInfos(long nativePtr, String username, String realm, String domain);
private native long[] listAudioPayloadTypes(long nativePtr);
private native void setAudioCodecs(long nativePtr, long[] codecs);
private native void enableKeepAlive(long nativePtr,boolean enable);
private native boolean isKeepAliveEnabled(long nativePtr);
private native int startEchoCalibration(long nativePtr,Object data);
@ -560,6 +562,13 @@ class LinphoneCoreImpl implements LinphoneCore {
return codecs;
}
public synchronized void setVideoCodecs(PayloadType[] codecs) {
long[] typesPtr = new long[codecs.length];
for (int i=0; i < codecs.length; i++) {
typesPtr[i] = ((PayloadTypeImpl)codecs[i]).nativePtr;
}
setVideoCodecs(nativePtr, typesPtr);
}
public synchronized PayloadType[] getAudioCodecs() {
long[] typesPtr = listAudioPayloadTypes(nativePtr);
if (typesPtr == null) return null;
@ -572,6 +581,13 @@ class LinphoneCoreImpl implements LinphoneCore {
return codecs;
}
public synchronized void setAudioCodecs(PayloadType[] codecs) {
long[] typesPtr = new long[codecs.length];
for (int i=0; i < codecs.length; i++) {
typesPtr[i] = ((PayloadTypeImpl)codecs[i]).nativePtr;
}
setAudioCodecs(nativePtr, typesPtr);
}
public synchronized boolean isNetworkReachable() {
return isNetworkStateReachable(nativePtr);
}
@ -1446,4 +1462,15 @@ class LinphoneCoreImpl implements LinphoneCore {
public boolean videoMulticastEnabled() {
return videoMulticastEnabled(nativePtr);
}
private native void enableDnsSrv(long ptr, boolean yesno);
@Override
public void enableDnsSrv(boolean yesno) {
enableDnsSrv(nativePtr, yesno);
}
private native boolean dnsSrvEnabled(long ptr);
@Override
public boolean dnsSrvEnabled() {
return dnsSrvEnabled(nativePtr);
}
}

View file

@ -21,7 +21,7 @@ package org.linphone.core;
class PayloadTypeImpl implements PayloadType {
protected final long nativePtr;
public final long nativePtr;
private native String toString(long ptr);
private native String getMime(long ptr);

@ -1 +1 @@
Subproject commit 938c6e4cade5c09e6cfa5a5e9189007f8323f3d0
Subproject commit 3e04d797963618ea8db5226f0519b2f8074dbc70

View file

@ -250,6 +250,7 @@ typedef struct _LinphoneCoreManager {
LinphoneAddress* identity;
LinphoneEvent *lev;
bool_t decline_subscribe;
int number_of_cunit_error_at_creation;
} LinphoneCoreManager;
typedef struct _LinphoneCallTestParams {

View file

@ -257,7 +257,7 @@ LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_f
LinphoneProxyConfig* proxy;
char *rc_path = NULL;
int proxy_count;
mgr->number_of_cunit_error_at_creation = CU_get_number_of_failures();
mgr->v_table.registration_state_changed=registration_state_changed;
mgr->v_table.auth_info_requested=auth_info_requested;
mgr->v_table.call_state_changed=call_state_changed;
@ -340,7 +340,7 @@ void linphone_core_manager_destroy(LinphoneCoreManager* mgr) {
if (mgr->lc){
const char *record_file=linphone_core_get_record_file(mgr->lc);
if (record_file){
if (CU_get_number_of_failures()>0) {
if ((CU_get_number_of_failures()-mgr->number_of_cunit_error_at_creation)>0) {
ms_message ("Test has failed, keeping recorded file [%s]",record_file);
} else {
unlink(record_file);