function extractSSRCMap(desc) {
    if (typeof desc !== 'object' || desc === null ||
        typeof desc.sdp !== 'string') {
        console.warn('An empty description was passed as an argument.');
        return desc;
    }

    var ssrcList = {};
    var ssrcGroups = {};
    var session = transform.parse(desc.sdp);
    if (!Array.isArray(session.media))
    {
        return;
    }

    session.media.forEach(function (bLine) {
        if (!Array.isArray(bLine.ssrcs))
        {
            return;
        }

        if (typeof bLine.ssrcGroups !== 'undefined' &&
            Array.isArray(bLine.ssrcGroups)) {
            bLine.ssrcGroups.forEach(function (group) {
                if (typeof group.semantics !== 'undefined' &&
                    typeof group.ssrcs !== 'undefined') {
                    var primarySSRC = Number(group.ssrcs.split(' ')[0]);
                    ssrcGroups[primarySSRC] = ssrcGroups[primarySSRC] || [];
                    ssrcGroups[primarySSRC].push(group);
                }
            });
        }
        bLine.ssrcs.forEach(function (ssrc) {
            if(ssrc.attribute !== 'msid')
                return;
            ssrcList[ssrc.value] = ssrcList[ssrc.value] ||
                {groups: [], ssrcs: []};
            ssrcList[ssrc.value].ssrcs.push(ssrc.id);
            if(ssrcGroups[ssrc.id]){
                ssrcGroups[ssrc.id].forEach(function (group) {
                    ssrcList[ssrc.value].groups.push(
                        {primarySSRC: ssrc.id, group: group});
                });
            }
        });
    });

    return ssrcList;
}
/**
 * Returns map with keys msid and values ssrc.
 * @param desc the SDP that will be modified.
 */
Returns map with keys msid and values ssrc.
@param desc the SDP that will be modified.
Returns map with keys msid and values ssrc . @param desc the SDP that will be modified .
function extractSSRCMap(desc) {
    if (typeof desc !== 'object' || desc === null ||
        typeof desc.sdp !== 'string') {
        console.warn('An empty description was passed as an argument.');
        return desc;
    }
    var ssrcList = {};
    var ssrcGroups = {};
    var session = transform.parse(desc.sdp);
    if (!Array.isArray(session.media))
    {
        return;
    }
    session.media.forEach(function (bLine) {
        if (!Array.isArray(bLine.ssrcs))
        {
            return;
        }
        if (typeof bLine.ssrcGroups !== 'undefined' &&
            Array.isArray(bLine.ssrcGroups)) {
            bLine.ssrcGroups.forEach(function (group) {
                if (typeof group.semantics !== 'undefined' &&
                    typeof group.ssrcs !== 'undefined') {
                    var primarySSRC = Number(group.ssrcs.split(' ')[0]);
                    ssrcGroups[primarySSRC] = ssrcGroups[primarySSRC] || [];
                    ssrcGroups[primarySSRC].push(group);
                }
            });
        }
        bLine.ssrcs.forEach(function (ssrc) {
            if(ssrc.attribute !== 'msid')
                return;
            ssrcList[ssrc.value] = ssrcList[ssrc.value] ||
                {groups: [], ssrcs: []};
            ssrcList[ssrc.value].ssrcs.push(ssrc.id);
            if(ssrcGroups[ssrc.id]){
                ssrcGroups[ssrc.id].forEach(function (group) {
                    ssrcList[ssrc.value].groups.push(
                        {primarySSRC: ssrc.id, group: group});
                });
            }
        });
    });
    return ssrcList;
}
function extractSSRCMap ( desc ) { if ( typeof desc !== 'object' || desc === null || typeof desc . sdp !== 'string' ) { console . warn ( 'An empty description was passed as an argument.' ) ; return desc ; } var ssrcList = { } ; var ssrcGroups = { } ; var session = transform . parse ( desc . sdp ) ; if ( ! Array . isArray ( session . media ) ) { return ; } session . media . forEach ( function ( bLine ) { if ( ! Array . isArray ( bLine . ssrcs ) ) { return ; } if ( typeof bLine . ssrcGroups !== 'undefined' && Array . isArray ( bLine . ssrcGroups ) ) { bLine . ssrcGroups . forEach ( function ( group ) { if ( typeof group . semantics !== 'undefined' && typeof group . ssrcs !== 'undefined' ) { var primarySSRC = Number ( group . ssrcs . split ( ' ' ) [ 0 ] ) ; ssrcGroups [ primarySSRC ] = ssrcGroups [ primarySSRC ] || [ ] ; ssrcGroups [ primarySSRC ] . push ( group ) ; } } ) ; } bLine . ssrcs . forEach ( function ( ssrc ) { if ( ssrc . attribute !== 'msid' ) return ; ssrcList [ ssrc . value ] = ssrcList [ ssrc . value ] || { groups : [ ] , ssrcs : [ ] } ; ssrcList [ ssrc . value ] . ssrcs . push ( ssrc . id ) ; if ( ssrcGroups [ ssrc . id ] ) { ssrcGroups [ ssrc . id ] . forEach ( function ( group ) { ssrcList [ ssrc . value ] . groups . push ( { primarySSRC : ssrc . id , group : group } ) ; } ) ; } } ) ; } ) ; return ssrcList ; }
Returns map with keys msid and values ssrc.
Returns map with keys msid and values ssrc .