Commit 7bf89d43 authored by Ghislain MARY's avatar Ghislain MARY

Fix bug 0001282: ICE implementation assumes stream indexes audio=0 video=1.

The session now contains a table of check lists instead of a list and there can now be gaps between check lists.
parent ff45699c
......@@ -34,6 +34,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* The maximum number of check lists in an ICE session.
*/
#define ICE_SESSION_MAX_CHECK_LISTS 8
/**
* ICE agent role.
*
......@@ -90,11 +96,13 @@ typedef enum {
IS_Failed
} IceSessionState;
struct _IceCheckList;
/**
* Structure representing an ICE session.
*/
typedef struct _IceSession {
MSList *streams; /**< List of IceChecklist structures. Each element of the list represents a media stream */
struct _IceCheckList * streams[ICE_SESSION_MAX_CHECK_LISTS]; /**< Table of IceChecklist structure pointers. Each element represents a media stream */
char *local_ufrag; /**< Local username fragment for the session (assigned during the session creation) */
char *local_pwd; /**< Local password for the session (assigned during the session creation) */
char *remote_ufrag; /**< Remote username fragment for the session (provided via SDP by the peer) */
......@@ -408,8 +416,9 @@ MS2_PUBLIC bool_t ice_session_has_completed_check_list(const IceSession *session
*
* @param session The session that is assigned the check list
* @param cl The check list to assign to the session
* @param idx The index of the check list to add
*/
MS2_PUBLIC void ice_session_add_check_list(IceSession *session, IceCheckList *cl);
MS2_PUBLIC void ice_session_add_check_list(IceSession *session, IceCheckList *cl, unsigned int idx);
/**
* Remove an ICE check list from an ICE session.
......@@ -419,6 +428,14 @@ MS2_PUBLIC void ice_session_add_check_list(IceSession *session, IceCheckList *cl
*/
MS2_PUBLIC void ice_session_remove_check_list(IceSession *session, IceCheckList *cl);
/**
* Remove an ICE check list from an ICE session given its index.
*
* @param session The session from which to remove the check list
* @param idx The index of the check list in the ICE session
*/
MS2_PUBLIC void ice_session_remove_check_list_from_idx(IceSession *session, unsigned int idx);
/**
* Tell whether ICE local candidates have been gathered for an ICE session or not.
*
......
......@@ -242,7 +242,7 @@ static OrtpRtcpXrPlcStatus audio_stream_get_rtcp_xr_plc_status(unsigned long use
AudioStream *stream = (AudioStream *)userdata;
if ((stream->features & AUDIO_STREAM_FEATURE_PLC) != 0) {
int decoder_have_plc = 0;
if (ms_filter_has_method(stream->ms.decoder, MS_AUDIO_DECODER_HAVE_PLC)) {
if (stream->ms.decoder && ms_filter_has_method(stream->ms.decoder, MS_AUDIO_DECODER_HAVE_PLC)) {
ms_filter_call_method(stream->ms.decoder, MS_AUDIO_DECODER_HAVE_PLC, &decoder_have_plc);
}
if (decoder_have_plc == 0) {
......@@ -257,8 +257,9 @@ static OrtpRtcpXrPlcStatus audio_stream_get_rtcp_xr_plc_status(unsigned long use
static int audio_stream_get_rtcp_xr_signal_level(unsigned long userdata) {
AudioStream *stream = (AudioStream *)userdata;
if ((stream->features & AUDIO_STREAM_FEATURE_VOL_RCV) != 0) {
float volume;
ms_filter_call_method(stream->volrecv, MS_VOLUME_GET_MAX, &volume);
float volume = 0.f;
if (stream->volrecv)
ms_filter_call_method(stream->volrecv, MS_VOLUME_GET_MAX, &volume);
return (int)volume;
}
return ORTP_RTCP_XR_UNAVAILABLE_PARAMETER;
......@@ -267,8 +268,9 @@ static int audio_stream_get_rtcp_xr_signal_level(unsigned long userdata) {
static int audio_stream_get_rtcp_xr_noise_level(unsigned long userdata) {
AudioStream *stream = (AudioStream *)userdata;
if ((stream->features & AUDIO_STREAM_FEATURE_VOL_RCV) != 0) {
float volume;
ms_filter_call_method(stream->volrecv, MS_VOLUME_GET_MIN, &volume);
float volume = 0.f;
if (stream->volrecv)
ms_filter_call_method(stream->volrecv, MS_VOLUME_GET_MIN, &volume);
return (int)volume;
}
return ORTP_RTCP_XR_UNAVAILABLE_PARAMETER;
......
This diff is collapsed.
......@@ -676,7 +676,7 @@ void setup_media_streams(MediastreamDatas* args) {
if (args->ice_local_candidates_nb || args->ice_remote_candidates_nb) {
args->audio->ms.ice_check_list = ice_check_list_new();
rtp_session_set_pktinfo(args->audio->ms.sessions.rtp_session,TRUE);
ice_session_add_check_list(args->ice_session, args->audio->ms.ice_check_list);
ice_session_add_check_list(args->ice_session, args->audio->ms.ice_check_list, 0);
}
if (args->ice_local_candidates_nb) {
MediastreamIceCandidate *candidate;
......
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