Handle media direction when creating the local media description according to the call params.

This commit is contained in:
Ghislain MARY 2015-02-06 19:04:11 +01:00
parent c9376cc2dd
commit 0d94ad277f
4 changed files with 28 additions and 2 deletions

View file

@ -33,6 +33,28 @@ SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params) {
return SalProtoRtpAvp;
}
static SalStreamDir sal_dir_from_call_params_dir(LinphoneCallParamsMediaDirection cpdir) {
switch (cpdir) {
default:
case LinphoneCallParamsMediaDirectionInactive:
return SalStreamInactive;
case LinphoneCallParamsMediaDirectionSendOnly:
return SalStreamSendOnly;
case LinphoneCallParamsMediaDirectionRecvOnly:
return SalStreamRecvOnly;
case LinphoneCallParamsMediaDirectionSendRecv:
return SalStreamSendRecv;
}
}
SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params) {
return sal_dir_from_call_params_dir(linphone_call_params_get_audio_direction(params));
}
SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params) {
return sal_dir_from_call_params_dir(linphone_call_params_get_video_direction(params));
}
/*******************************************************************************
* Public functions *

View file

@ -280,14 +280,14 @@ LINPHONE_PUBLIC LinphoneCallParamsMediaDirection linphone_call_params_get_video
* @param[in] cl LinphoneCallParams object
* @param[in] The audio stream direction associated with this call params.
**/
/*LINPHONE_PUBLIC void linphone_call_params_set_audio_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir);*/
LINPHONE_PUBLIC void linphone_call_params_set_audio_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir);
/**
* Set the video stream direction. Only relevant for multicast
* @param[in] cl LinphoneCallParams object
* @param[in] The video stream direction associated with this call params.
**/
/*LINPHONE_PUBLIC void linphone_call_params_set_video_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir);*/
LINPHONE_PUBLIC void linphone_call_params_set_video_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir);
/*******************************************************************************

View file

@ -612,6 +612,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
md->streams[0].rtp_port=call->media_ports[0].rtp_port;
md->streams[0].rtcp_port=call->media_ports[0].rtcp_port;
md->streams[0].proto=get_proto_from_call_params(call->params);
md->streams[0].dir=get_audio_dir_from_call_params(call->params);
md->streams[0].type=SalAudio;
if (call->params->down_ptime)
md->streams[0].ptime=call->params->down_ptime;
@ -640,6 +641,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
md->streams[1].rtp_port=call->media_ports[1].rtp_port;
md->streams[1].rtcp_port=call->media_ports[1].rtcp_port;
md->streams[1].proto=md->streams[0].proto;
md->streams[1].dir=get_video_dir_from_call_params(call->params);
md->streams[1].type=SalVideo;
codec_hints.bandwidth_limit=0;
codec_hints.max_codecs=-1;

View file

@ -298,6 +298,8 @@ LinphonePlayer *linphone_call_build_player(LinphoneCall*call);
LinphoneCallParams * linphone_call_params_new(void);
SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params);
SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params);
SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params);
void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos);