Commit 084e21cb authored by jehan's avatar jehan
Browse files

fix dtls sdp path when dtls attribute are in sdp session

parent f940c509
......@@ -674,8 +674,6 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md,
stream=&md->streams[md->nb_streams];
media=belle_sdp_media_description_get_media ( media_desc );
memset ( stream,0,sizeof ( *stream ) );
proto = belle_sdp_media_get_protocol ( media );
stream->proto=SalProtoOther;
if ( proto ) {
......@@ -748,8 +746,6 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md,
}
/* Read DTLS specific attributes : check is some are found in the stream description otherwise copy the session description one(which are at least set to Invalid) */
stream->dtls_role = SalDtlsRoleInvalid;
stream->dtls_fingerprint[0] = '\0';
if (((stream->proto == SalProtoUdpTlsRtpSavpf) || (stream->proto == SalProtoUdpTlsRtpSavp))) {
attribute=belle_sdp_media_description_get_attribute(media_desc,"setup");
if (attribute && (value=belle_sdp_attribute_get_value(attribute))!=NULL){
......@@ -760,10 +756,9 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md,
} else if (strncmp(value, "passive", 7) == 0) {
stream->dtls_role = SalDtlsRoleIsServer;
}
if (stream->dtls_role != SalDtlsRoleInvalid) {
attribute=belle_sdp_media_description_get_attribute(media_desc,"fingerprint");
strncpy(stream->dtls_fingerprint, belle_sdp_attribute_get_value(attribute),sizeof(stream->dtls_fingerprint));
}
}
if (stream->dtls_role != SalDtlsRoleInvalid && (attribute=belle_sdp_media_description_get_attribute(media_desc,"fingerprint"))) {
strncpy(stream->dtls_fingerprint, belle_sdp_attribute_get_value(attribute),sizeof(stream->dtls_fingerprint));
}
}
......@@ -796,6 +791,8 @@ int sdp_to_media_description ( belle_sdp_session_description_t *session_desc, S
belle_sdp_media_description_t* media_desc;
belle_sdp_session_name_t *sname;
const char* value;
SalDtlsRole session_role=SalDtlsRoleInvalid;
int i;
desc->nb_streams = 0;
desc->dir = SalStreamSendRecv;
......@@ -825,7 +822,6 @@ int sdp_to_media_description ( belle_sdp_session_description_t *session_desc, S
/*DTLS attributes can be defined at session level.*/
value=belle_sdp_session_description_get_attribute_value(session_desc,"setup");
if (value){
SalDtlsRole session_role=SalDtlsRoleInvalid;
if (strncmp(value, "actpass", 7) == 0) {
session_role = SalDtlsRoleUnset;
} else if (strncmp(value, "active", 6) == 0) {
......@@ -833,19 +829,14 @@ int sdp_to_media_description ( belle_sdp_session_description_t *session_desc, S
} else if (strncmp(value, "passive", 7) == 0) {
session_role = SalDtlsRoleIsServer;
}
value=belle_sdp_session_description_get_attribute_value(session_desc,"fingerprint");
if (value){
int i;
/*copy dtls attributes to every streams, might be overwritten stream by stream*/
for (i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;i++) {
strncpy(desc->streams[i].dtls_fingerprint, value, sizeof(desc->streams[i].dtls_fingerprint));
desc->streams[i].dtls_role=session_role;
}
}
}
value=belle_sdp_session_description_get_attribute_value(session_desc,"fingerprint");
/*copy dtls attributes to every streams, might be overwritten stream by stream*/
for (i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;i++) {
if (value)
strncpy(desc->streams[i].dtls_fingerprint, value, sizeof(desc->streams[i].dtls_fingerprint));
desc->streams[i].dtls_role=session_role; /*set or reset value*/
}
/* Get ICE remote ufrag and remote pwd, and ice_lite flag */
value=belle_sdp_session_description_get_attribute_value(session_desc,"ice-ufrag");
......
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