NULL-checks for DTLS activation.

This commit is contained in:
Guillaume BIENKOWSKI 2015-03-02 16:58:53 +01:00
parent 695ad3d6e8
commit 1af008598f
2 changed files with 14 additions and 1 deletions

View file

@ -147,8 +147,10 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
/* we already started media: check if we really need to restart it*/
if (oldmd){
int md_changed = media_parameters_changed(call, oldmd, new_md);
if ((md_changed & SAL_MEDIA_DESCRIPTION_CODEC_CHANGED) || call->playing_ringbacktone) {
if ((md_changed & SAL_MEDIA_DESCRIPTION_CODEC_CHANGED)){
ms_message("Media descriptions are different, need to restart the streams.");
} else if ( call->playing_ringbacktone) {
ms_message("Playing ringback tone, will restart the streams.");
} else {
if (md_changed == SAL_MEDIA_DESCRIPTION_UNCHANGED) {
if (call->all_muted){

View file

@ -2350,6 +2350,11 @@ void static start_dtls( MSMediaStreamSessions *sessions, const SalStreamDescrip
void static start_dtls_on_all_streams(LinphoneCall *call) {
SalMediaDescription *remote_desc = sal_call_get_remote_media_description(call->op);
SalMediaDescription *result_desc = sal_call_get_final_media_description(call->op);
if( remote_desc == NULL || result_desc == NULL ){
ms_warning("Invalid remote or result media description, disabling DTLS");
return;
}
if (call->audiostream && (media_stream_get_state((const MediaStream *)call->audiostream) == MSStreamStarted))/*dtls must start at the end of ice*/
start_dtls(&call->audiostream->ms.sessions
,sal_media_description_find_best_stream(result_desc,SalAudio)
@ -2379,6 +2384,12 @@ void static set_dtls_fingerprint( MSMediaStreamSessions *sessions, const SalStr
void static set_dtls_fingerprint_on_all_streams(LinphoneCall *call) {
SalMediaDescription *remote_desc = sal_call_get_remote_media_description(call->op);
SalMediaDescription *result_desc = sal_call_get_final_media_description(call->op);
if( remote_desc == NULL || result_desc == NULL ){
ms_warning("Invalid remote or final media desc, aborting DTLS fingerprinting");
return;
}
if (call->audiostream && (media_stream_get_state((const MediaStream *)call->audiostream) == MSStreamStarted))/*dtls must start at the end of ice*/
set_dtls_fingerprint(&call->audiostream->ms.sessions
,sal_media_description_find_best_stream(result_desc,SalAudio)