]> sjero.net Git - linphone/commitdiff
Simplified ORTP-ZRTP API. Fix SAS bubbling. Old ARMs
authorGuillaume Beraudo <guillaume.beraudo@linphone.org>
Mon, 1 Aug 2011 09:48:26 +0000 (11:48 +0200)
committerGuillaume Beraudo <guillaume.beraudo@linphone.org>
Mon, 1 Aug 2011 09:48:26 +0000 (11:48 +0200)
build/android/Android.mk
coreapi/linphonecall.c
coreapi/linphonecore_jni.cc
mediastreamer2
oRTP

index 817ed9155c18978d8c366b0a00c083248509f78a..dcc9c9fa68367388b655356ae1a7c8b9425a7423 100755 (executable)
@@ -127,22 +127,26 @@ LOCAL_C_INCLUDES += $(LIBLINPHONE_EXTENDED_C_INCLUDES)
 endif
 
 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
-       LOCAL_SHARED_LIBRARIES += \
-               liblinssl liblincrypto
+       LOCAL_SHARED_LIBRARIES += liblinssl liblincrypto
        ifeq ($(BUILD_GPLV3_ZRTP),1)
-       LOCAL_SHARED_LIBRARIES += \
-               libzrtpcpp
+       LOCAL_SHARED_LIBRARIES += libzrtpcpp
        endif
 
        ifeq ($(BUILD_SRTP),1)
-       LOCAL_SHARED_LIBRARIES += \
-               libsrtp
+       LOCAL_SHARED_LIBRARIES += libsrtp
        endif
 else
        LOCAL_LDLIBS += -lz
        #LOCAL_STATIC_LIBRARIES += libz libdl
        LOCAL_STATIC_LIBRARIES += \
                libssl-static libcrypto-static
+       ifeq ($(BUILD_GPLV3_ZRTP),1)
+               LOCAL_STATIC_LIBRARIES += libzrtpcpp-static
+       endif
+
+       ifeq ($(BUILD_SRTP),1)
+               LOCAL_STATIC_LIBRARIES += libsrtp-static
+       endif
 endif
 
 LOCAL_MODULE := liblinphone
index 7f9c12c20a314f976e6c205d6038373527bbfb2a..f405c139a60774c283ff7269356c34ae2567163c 100644 (file)
@@ -79,7 +79,7 @@ bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call) {
        return TRUE;
 }
 
-static void propagate_encryption_changed(LinphoneCall *call){
+void propagate_encryption_changed(LinphoneCall *call){
        if (call->core->vtable.call_encryption_changed == NULL) return;
 
        if (!linphone_call_are_all_streams_encrypted(call)) {
@@ -115,10 +115,6 @@ static void linphone_call_audiostream_encryption_changed(void *data, bool_t encr
                OrtpZrtpParams params;
                params.zid=get_zrtp_identifier(call->core);
                params.zid_file=NULL; //unused
-               OrtpZrtpUiCb cbs={0};
-               cbs.data=call;
-               cbs.encryption_changed=linphone_call_videostream_encryption_changed;
-               params.ui_cbs=&cbs;
                video_stream_enable_zrtp(call->videostream,call->audiostream,&params);
        }
 #endif
@@ -1117,11 +1113,6 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
                OrtpZrtpParams params;
                params.zid=get_zrtp_identifier(lc);
                params.zid_file=lc->zrtp_secrets_cache;
-               OrtpZrtpUiCb cbs={0};
-               cbs.data=call;
-               cbs.encryption_changed=linphone_call_audiostream_encryption_changed;
-               cbs.sas_ready=linphone_call_audiostream_auth_token_ready;
-               params.ui_cbs=&cbs;
                audio_stream_enable_zrtp(call->audiostream,&params);
        }
 
@@ -1333,11 +1324,38 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
                ms_message("Thread processing load: audio=%f\tvideo=%f",audio_load,video_load);
        }
 #ifdef VIDEO_ENABLED
-       if (call->videostream!=NULL)
+       if (call->videostream!=NULL) {
+               if (call->videostream->evq){
+                       OrtpEvent *ev=ortp_ev_queue_get(call->videostream->evq);
+                       if (ev!=NULL){
+                               OrtpEventType evt=ortp_event_get_type(ev);
+                               if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){
+                                       OrtpEventData *evd=ortp_event_get_data(ev);
+                                       linphone_call_videostream_encryption_changed(call, evd->info.zrtp_stream_encrypted);
+                               }
+                               ortp_event_destroy(ev);
+                       }
+               }
                video_stream_iterate(call->videostream);
+       }
 #endif
-       if (call->audiostream!=NULL)
+       if (call->audiostream!=NULL) {
+               if (call->audiostream->evq){
+                       OrtpEvent *ev=ortp_ev_queue_get(call->audiostream->evq);
+                       if (ev!=NULL){
+                               OrtpEventType evt=ortp_event_get_type(ev);
+                               if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){
+                                       OrtpEventData *evd=ortp_event_get_data(ev);
+                                       linphone_call_audiostream_encryption_changed(call, evd->info.zrtp_stream_encrypted);
+                               } else if (evt == ORTP_EVENT_ZRTP_SAS_READY) {
+                                       OrtpEventData *evd=ortp_event_get_data(ev);
+                                       linphone_call_audiostream_auth_token_ready(call, evd->info.zrtp_sas.sas, evd->info.zrtp_sas.verified);
+                               }
+                               ortp_event_destroy(ev);
+                       }
+               }
                audio_stream_iterate(call->audiostream);
+       }
        if (one_second_elapsed && call->audiostream!=NULL && disconnect_timeout>0 )
                disconnected=!audio_stream_alive(call->audiostream,disconnect_timeout);
        if (disconnected)
index 823e5e44f86c73bcb89b8f66f7932e3f73fdac8e..35cade5221144bfc9f4bf87ec05f4b093f344391 100644 (file)
@@ -90,47 +90,47 @@ public:
                vTable.global_state_changed = globalStateChange;
                vTable.registration_state_changed = registrationStateChange;
                vTable.call_state_changed = callStateChange;
-               //vTable.call_encryption_changed = callEncryptionChange;
+               vTable.call_encryption_changed = callEncryptionChange;
                vTable.text_received = text_received;
                vTable.new_subscription_request = new_subscription_request;
                vTable.notify_presence_recv = notify_presence_recv;
 
-               listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
+               listenerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
 
                /*displayStatus(LinphoneCore lc,String message);*/
-               displayStatusId = env->GetMethodID(listernerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V");
+               displayStatusId = env->GetMethodID(listenerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V");
 
                /*void generalState(LinphoneCore lc,int state); */
-               globalStateId = env->GetMethodID(listernerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V");
+               globalStateId = env->GetMethodID(listenerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V");
                globalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GlobalState"));
                globalStateFromIntId = env->GetStaticMethodID(globalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GlobalState;");
 
                /*registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);*/
-               registrationStateId = env->GetMethodID(listernerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V");
+               registrationStateId = env->GetMethodID(listenerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V");
                registrationStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RegistrationState"));
                registrationStateFromIntId = env->GetStaticMethodID(registrationStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RegistrationState;");
 
                /*callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message);*/
-               callStateId = env->GetMethodID(listernerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V");
+               callStateId = env->GetMethodID(listenerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V");
                callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State"));
                callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;");
 
                /*callEncryption(LinphoneCore lc, LinphoneCall call, boolean encrypted,String auth_token);*/
-               callEncryptionChangedId=env->GetMethodID(listernerClass,"callEncryptionChanged","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;ZLjava/lang/String;)V");
+               callEncryptionChangedId=env->GetMethodID(listenerClass,"callEncryptionChanged","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;ZLjava/lang/String;)V");
 
                /*void ecCalibrationStatus(LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data);*/
-               ecCalibrationStatusId = env->GetMethodID(listernerClass,"ecCalibrationStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;ILjava/lang/Object;)V");
+               ecCalibrationStatusId = env->GetMethodID(listenerClass,"ecCalibrationStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;ILjava/lang/Object;)V");
                ecCalibratorStatusClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$EcCalibratorStatus"));
                ecCalibratorStatusFromIntId = env->GetStaticMethodID(ecCalibratorStatusClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;");
 
                /*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/
-               newSubscriptionRequestId = env->GetMethodID(listernerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V");
+               newSubscriptionRequestId = env->GetMethodID(listenerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V");
 
                /*void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);*/
-               notifyPresenceReceivedId = env->GetMethodID(listernerClass,"notifyPresenceReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;)V");
+               notifyPresenceReceivedId = env->GetMethodID(listenerClass,"notifyPresenceReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;)V");
 
                /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/
-               textReceivedId = env->GetMethodID(listernerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V");
+               textReceivedId = env->GetMethodID(listenerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V");
 
                proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
                proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
@@ -155,7 +155,7 @@ public:
                env->DeleteGlobalRef(core);
                env->DeleteGlobalRef(listener);
                if (userdata) env->DeleteGlobalRef(userdata);
-               env->DeleteGlobalRef(listernerClass);
+               env->DeleteGlobalRef(listenerClass);
                env->DeleteGlobalRef(globalStateClass);
                env->DeleteGlobalRef(registrationStateClass);
                env->DeleteGlobalRef(callStateClass);
@@ -169,7 +169,7 @@ public:
        jobject listener;
        jobject userdata;
 
-       jclass listernerClass;
+       jclass listenerClass;
        jmethodID displayStatusId;
        jmethodID newSubscriptionRequestId;
        jmethodID notifyPresenceReceivedId;
index 9091250591e54e6533cea8ba8c203f6f4f47550d..97b4a85bba7b0c75040137b6ba1a3543fda9c63c 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9091250591e54e6533cea8ba8c203f6f4f47550d
+Subproject commit 97b4a85bba7b0c75040137b6ba1a3543fda9c63c
diff --git a/oRTP b/oRTP
index 9cdfa6c826b2a2701122a50ed3c78afa8ef17ec6..e3e56ecd6179085ffeaf70482da4571415e3e5ff 160000 (submodule)
--- a/oRTP
+++ b/oRTP
@@ -1 +1 @@
-Subproject commit 9cdfa6c826b2a2701122a50ed3c78afa8ef17ec6
+Subproject commit e3e56ecd6179085ffeaf70482da4571415e3e5ff