Commit f6d63524 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix declared number of channels in SDP for opus codec, to follow opus-rtp draft.

add ugly hack to allow older versions of linphone to call new versions with opus.
parent c987f1a0
......@@ -117,7 +117,7 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session
mime_param= belle_sdp_mime_parameter_create ( pt->mime_type
, payload_type_get_number ( pt )
, pt->clock_rate
,stream->type==SalAudio?1:-1 );
, pt->channels>0 ? pt->channels : -1 );
belle_sdp_mime_parameter_set_parameters ( mime_param,pt->recv_fmtp );
if ( stream->ptime>0 ) {
belle_sdp_mime_parameter_set_ptime ( mime_param,stream->ptime );
......
......@@ -1377,7 +1377,7 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
linphone_core_assign_payload_type(lc,&payload_type_g729,18,"annexb=no");
linphone_core_assign_payload_type(lc,&payload_type_aaceld_22k,-1,"config=F8EE2000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5");
linphone_core_assign_payload_type(lc,&payload_type_aaceld_44k,-1,"config=F8E82000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5");
linphone_core_assign_payload_type(lc,&payload_type_opus,-1,"useinbandfec=1; usedtx=0; cbr=1");
linphone_core_assign_payload_type(lc,&payload_type_opus,-1,"useinbandfec=1; stereo=0; sprop-stereo=0");
linphone_core_assign_payload_type(lc,&payload_type_isac,-1,NULL);
linphone_core_handle_static_payloads(lc);
......
......@@ -168,12 +168,6 @@ bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, Payl
case PAYLOAD_AUDIO_PACKETIZED:
codec_band=get_audio_payload_bandwidth(lc,pt);
ret=bandwidth_is_greater(bandwidth_limit*1000,codec_band);
/*hack to avoid using uwb codecs when having low bitrate and video*/
if (bandwidth_is_greater(199,bandwidth_limit)){
if (linphone_core_video_enabled(lc) && pt->clock_rate>16000){
ret=FALSE;
}
}
//ms_message("Payload %s: %g",pt->mime_type,codec_band);
break;
case PAYLOAD_VIDEO:
......
......@@ -39,11 +39,20 @@ static PayloadType * find_payload_type_best_match(const MSList *l, const Payload
for (elem=l;elem!=NULL;elem=elem->next){
pt=(PayloadType*)elem->data;
/*workaround a bug in earlier versions of linphone where opus/48000/1 is offered, which is uncompliant with opus rtp draft*/
if (refpt->mime_type && strcasecmp(refpt->mime_type,"opus")==0 && refpt->channels==1
&& strcasecmp(pt->mime_type,refpt->mime_type)==0){
pt->channels=1; /*so that we respond with same number of channels */
candidate=pt;
break;
}
/* the compare between G729 and G729A is for some stupid uncompliant phone*/
if ( pt->mime_type && refpt->mime_type &&
(strcasecmp(pt->mime_type,refpt->mime_type)==0 ||
(strcasecmp(pt->mime_type, "G729") == 0 && strcasecmp(refpt->mime_type, "G729A") == 0 ))
&& pt->clock_rate==refpt->clock_rate){
&& pt->clock_rate==refpt->clock_rate && pt->channels==refpt->channels){
candidate=pt;
/*good candidate, check fmtp for H264 */
if (strcasecmp(pt->mime_type,"H264")==0){
......@@ -106,7 +115,9 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t
res=ms_list_append(res,newp);
}
}else{
ms_message("No match for %s/%i",p2->mime_type,p2->clock_rate);
if (p2->channels>0)
ms_message("No match for %s/%i/%i",p2->mime_type,p2->clock_rate,p2->channels);
else ms_message("No match for %s/%i",p2->mime_type,p2->clock_rate);
}
}
if (reading_response){
......
mediastreamer2 @ 7f97a5c7
Subproject commit f6c6813f0cdffaaa290d3933b7f6a92d586bae72
Subproject commit 7f97a5c7046589f4de0a742a686308ad5770348d
oRTP @ c329c3a4
Subproject commit c09e63ddba599a7f7da149edf6f7b290f4cfa787
Subproject commit c329c3a478011ed4c10ffca79b8624ec6b60450c
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