bugfixes again for bandwidth management

This commit is contained in:
Simon Morlat 2010-12-13 14:36:11 +01:00
parent e5e5c3637b
commit 53be75eda6
3 changed files with 8 additions and 3 deletions

View file

@ -738,13 +738,13 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
/*case where b=AS is given globally, not per stream*/
remote_bw=md->bandwidth;
if (desc->type==SalVideo){
remote_bw-=call->audio_bw+10;
remote_bw=get_video_bandwidth(remote_bw,call->audio_bw);
}
}
if (desc->type==SalAudio){
bw=get_min_bandwidth(call->audio_bw,remote_bw);
}else bw=get_min_bandwidth(linphone_core_get_upload_bandwidth (lc)-call->audio_bw,remote_bw);
}else bw=get_min_bandwidth(get_video_bandwidth(linphone_core_get_upload_bandwidth (lc),call->audio_bw),remote_bw);
if (bw>0) pt->normal_bitrate=bw*1000;
else if (desc->type==SalAudio){
pt->normal_bitrate=-1;

View file

@ -298,7 +298,7 @@ bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType
allowed_bw=-1;
video_bw=1500; /*around 1.5 Mbit/s*/
}else
video_bw=allowed_bw-lc->audio_bw-10;
video_bw=get_video_bandwidth(allowed_bw,lc->audio_bw);
switch (pt->type){
case PAYLOAD_AUDIO_CONTINUOUS:

View file

@ -148,6 +148,11 @@ static inline bool_t bandwidth_is_greater(int bw1, int bw2){
else return bw1>=bw2;
}
static inline int get_video_bandwidth(int total, int audio){
if (total<=0) return 0;
return total-audio-10;
}
static inline void set_string(char **dest, const char *src){
if (*dest){
ms_free(*dest);