Commit 1af00859 authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI
Browse files

NULL-checks for DTLS activation.

parent 695ad3d6
......@@ -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){
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment