From 2130afe5f90108d9885af79c25c3ce506ce6f7b5 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 11 Jan 2016 16:51:06 +0100 Subject: [PATCH] Fixing bug in SDP RTP port when all audio codecs are disabled in a call. In this case, now the RTP port is set to 0 and the audio stream is inactive. --- coreapi/linphonecall.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a13c65237..1eff5f2da 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -708,6 +708,16 @@ void linphone_call_make_local_media_description(LinphoneCall *call) { md->custom_sdp_attributes = sal_custom_sdp_attribute_clone(params->custom_sdp_attributes); /*set audio capabilities */ + + codec_hints.bandwidth_limit=params->audio_bw; + codec_hints.max_codecs=-1; + codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL; + l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs); + + // in case where no audio codec was found for this stream, the audio is disabled + if (l == NULL) { + params->has_audio = FALSE; + } if (params->has_audio) { strncpy(md->streams[call->main_audio_stream_index].rtp_addr,linphone_call_get_public_ip_for_stream(call,call->main_audio_stream_index),sizeof(md->streams[call->main_audio_stream_index].rtp_addr)); strncpy(md->streams[call->main_audio_stream_index].rtcp_addr,linphone_call_get_public_ip_for_stream(call,call->main_audio_stream_index),sizeof(md->streams[call->main_audio_stream_index].rtcp_addr)); @@ -722,10 +732,6 @@ void linphone_call_make_local_media_description(LinphoneCall *call) { md->streams[call->main_audio_stream_index].ptime=params->down_ptime; else md->streams[call->main_audio_stream_index].ptime=linphone_core_get_download_ptime(lc); - codec_hints.bandwidth_limit=params->audio_bw; - codec_hints.max_codecs=-1; - codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL; - l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs); md->streams[call->main_audio_stream_index].max_rate=get_max_codec_sample_rate(l); md->streams[call->main_audio_stream_index].payloads=l; if (call->audiostream && call->audiostream->ms.sessions.rtp_session) {