#include "sipsetup.h"
#include "lpconfig.h"
#include "private.h"
+#include <ortp/event.h>
#include "mediastreamer2/mediastream.h"
}
const char* linphone_call_get_authentication_token(LinphoneCall *call){
- return call->audiostream->auth_token;
+ return call->auth_token;
}
bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call){
- return call->audiostream->auth_token_verified;
+ return call->auth_token_verified;
}
bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call) {
// Check ZRTP encryption in audiostream
- if (!call->audiostream->encrypted) {
+ if (!call->audiostream_encrypted) {
return FALSE;
}
#ifdef VIDEO_ENABLED
// If video enabled, check ZRTP encryption in videostream
const LinphoneCallParams *params=linphone_call_get_current_params(call);
- if (params->has_video && !call->videostream->encrypted) {
+ if (params->has_video && !call->videostream_encrypted) {
return FALSE;
}
#endif
if (call->core->vtable.call_encryption_changed == NULL) return;
if (!linphone_call_are_all_streams_encrypted(call)) {
- call->core->vtable.call_encryption_changed(call->core, call, FALSE, NULL);
+ ms_message("Some streams are not encrypted");
+ call->core->vtable.call_encryption_changed(call->core, call, FALSE, call->auth_token);
} else {
- call->core->vtable.call_encryption_changed(call->core, call, TRUE, call->audiostream->auth_token);
+ ms_message("All streams are encrypted");
+ call->core->vtable.call_encryption_changed(call->core, call, TRUE, call->auth_token);
}
}
ms_message("Video stream is %s", encrypted ? "encrypted" : "not encrypted");
LinphoneCall *call = (LinphoneCall *)data;
- call->videostream->encrypted=encrypted;
+ call->videostream_encrypted=encrypted;
propagate_encryption_changed(call);
}
#endif
ms_message("Audio stream is %s ", encrypted ? "encrypted" : "not encrypted");
LinphoneCall *call = (LinphoneCall *)data;
- call->audiostream->encrypted=encrypted;
+ call->audiostream_encrypted=encrypted;
propagate_encryption_changed(call);
static void linphone_call_audiostream_auth_token_ready(void *data, const char* auth_token, bool_t verified) {
LinphoneCall *call=(LinphoneCall *)data;
- if (call->audiostream->auth_token != NULL)
- ms_free(call->audiostream->auth_token);
+ if (call->auth_token != NULL)
+ ms_free(call->auth_token);
- call->audiostream->auth_token=ms_strdup(auth_token);
- call->audiostream->auth_token_verified=verified;
+ call->auth_token=ms_strdup(auth_token);
+ call->auth_token_verified=verified;
ms_message("Authentication token is %s (%s)", auth_token, verified?"verified":"unverified");
}
}
if (obj->owns_call_log)
linphone_call_log_destroy(obj->log);
+ if (obj->auth_token) {
+ ms_free(obj->auth_token);
+ }
+
ms_free(obj);
}
if (lc->a_rtp)
rtp_session_set_transports(audiostream->session,lc->a_rtp,lc->a_rtcp);
+ call->audiostream_app_evq = ortp_ev_queue_new();
+ rtp_session_register_event_queue(audiostream->session,call->audiostream_app_evq);
+
#ifdef VIDEO_ENABLED
if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){
video_stream_set_event_callback(call->videostream,video_stream_event_cb, call);
if (lc->v_rtp)
rtp_session_set_transports(call->videostream->session,lc->v_rtp,lc->v_rtcp);
+ call->videostream_app_evq = ortp_ev_queue_new();
+ rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq);
#ifdef TEST_EXT_RENDERER
video_stream_set_render_callback(call->videostream,rendercb,NULL);
#endif
void linphone_call_stop_media_streams(LinphoneCall *call){
if (call->audiostream!=NULL) {
+ rtp_session_unregister_event_queue(call->audiostream->session,call->audiostream_app_evq);
+ ortp_ev_queue_flush(call->audiostream_app_evq);
+ ortp_ev_queue_destroy(call->audiostream_app_evq);
+
if (call->audiostream->ec){
const char *state_str=NULL;
ms_filter_call_method(call->audiostream->ec,MS_ECHO_CANCELLER_GET_STATE_STRING,&state_str);
audio_stream_stop(call->audiostream);
call->audiostream=NULL;
}
+
+
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL){
+ rtp_session_unregister_event_queue(call->videostream->session,call->videostream_app_evq);
+ ortp_ev_queue_flush(call->videostream_app_evq);
+ ortp_ev_queue_destroy(call->videostream_app_evq);
video_stream_stop(call->videostream);
call->videostream=NULL;
}
}
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL) {
- if (call->videostream->evq){
- OrtpEvent *ev=ortp_ev_queue_get(call->videostream->evq);
- if (ev!=NULL){
+ // Beware that the application queue should not depend on treatments fron the
+ // mediastreamer queue.
+ video_stream_iterate(call->videostream);
+
+ if (call->videostream_app_evq){
+ OrtpEvent *ev;
+ while (NULL != (ev=ortp_ev_queue_get(call->videostream_app_evq))){
OrtpEventType evt=ortp_event_get_type(ev);
if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){
OrtpEventData *evd=ortp_event_get_data(ev);
ortp_event_destroy(ev);
}
}
- video_stream_iterate(call->videostream);
}
#endif
if (call->audiostream!=NULL) {
+ // Beware that the application queue should not depend on treatments fron the
+ // mediastreamer queue.
+ audio_stream_iterate(call->audiostream);
+
if (call->audiostream->evq){
- OrtpEvent *ev=ortp_ev_queue_get(call->audiostream->evq);
- if (ev!=NULL){
+ OrtpEvent *ev;
+ while (NULL != (ev=ortp_ev_queue_get(call->audiostream_app_evq))){
OrtpEventType evt=ortp_event_get_type(ev);
if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){
OrtpEventData *evd=ortp_event_get_data(ev);
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);