Alexander,

I too had reason to do this.  Here's how I transformed the SDP during the 
negotiation of the connection on the server side.  My service is written in 
node.js, but I'm sure you could adapt this to other languages.  Other useful 
links:

https://webrtchacks.com/sdp-anatomy/ (from: 
https://webrtchacks.com/anatomy-webrtc-sdp/)
http://webrtc.github.io/samples/src/content/peerconnection/munge-sdp/ (from: 
https://bloggeek.me/webrtc-github-repo/)

There was another site, a demo site that included a JavaScript function 
(removeVP8()) that also accomplished this in a more string-based manner but I 
can't find the link off hand.

best of luck,

-greg



var transform = require('sdp-transform');

// Eliminate all RTP/Media elements that are not H264 and add H264 if not 
present.
var h264ify = function(sdp) {
    return sdp;
    var h264 = false;
    sdp.media.forEach(function(media) {
    if (media.type === 'video') {
        var removed = [];
        media.rtp = media.rtp.filter(function(rtp, index, array) {
        if (rtp.codec === 'H264') {
            h264 === true;
        }
        if (rtp.codec === 'VP8') {
            removed.push(rtp);
            return false;
        }
        return true;
        });
        removed.forEach(function(item) {
        media.fmtp = media.fmtp.filter(function(fmtp, index, array) {
            if (fmtp.payload === item.payload) {
            return false;
            }
            return true;
        });
        media.rtcpFb = media.rtcpFb.filter(function(rtcpFb, index, array) {
            if (rtcpFb.payload === item.payload) {
            return false;
            }
            return true;
        });
        //console.log("BEFORE: " + media.payloads);
        media.payloads = media.payloads.replace(new RegExp(item.payload), 
'').trim();
        //console.log("AFTER: " + media.payloads);
        });
    }
    });
    return sdp;
}

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
dev-media mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-media

Reply via email to