Search in sources :

Example 1 with SDPScheme

use of im.actor.runtime.webrtc.sdp.SDPScheme in project actor-platform by actorapp.

the class SDPOptimizer method optimize.

public static WebRTCSessionDescription optimize(WebRTCSessionDescription src) {
    SDPScheme sdpScheme = SDP.parse(src.getSdp());
    // Prefer ISAC over other audio codecs
    for (SDPMedia media : sdpScheme.getMediaLevel()) {
        SDPCodec isacCodec = null;
        for (SDPCodec codec : media.getCodecs()) {
            if (codec.getName().toLowerCase().equals("isac")) {
                isacCodec = codec;
                break;
            }
        }
        if (isacCodec != null) {
            media.getCodecs().remove(isacCodec);
            media.getCodecs().add(0, isacCodec);
        }
    }
    return new WebRTCSessionDescription(src.getType(), sdpScheme.toSDP());
}
Also used : SDPCodec(im.actor.runtime.webrtc.sdp.entities.SDPCodec) SDPScheme(im.actor.runtime.webrtc.sdp.SDPScheme) SDPMedia(im.actor.runtime.webrtc.sdp.entities.SDPMedia) WebRTCSessionDescription(im.actor.runtime.webrtc.WebRTCSessionDescription)

Aggregations

WebRTCSessionDescription (im.actor.runtime.webrtc.WebRTCSessionDescription)1 SDPScheme (im.actor.runtime.webrtc.sdp.SDPScheme)1 SDPCodec (im.actor.runtime.webrtc.sdp.entities.SDPCodec)1 SDPMedia (im.actor.runtime.webrtc.sdp.entities.SDPMedia)1