webrtc-sdp icon indicating copy to clipboard operation
webrtc-sdp copied to clipboard

Sessions with Multiple Media yield embedded, redundant \r\n

Open thutchmoto opened this issue 5 years ago • 1 comments

Adding multiple media to a manually constructed SdpSession results in successive \r\n:

v=0
o=- 1000 1001 IN IP4 127.0.0.1
s=Test A/V Session
m=audio 10000 RTP/AVP 0

m=video 11000 RTP/AVP 96

Such output will trip up many other SDP parsers.

Code to produce the issue:

let origin = SdpOrigin {
    username: "-".to_string(),
    session_id: 1_000,
    session_version: 1_001,
    unicast_addr: ExplicitlyTypedAddress::from(Ipv4Addr::new(127, 0, 0, 1))
};
let mut session = SdpSession::new(0, origin, "Test A/V Session".to_string());

let audio = SdpMedia::new(SdpMediaLine {
    media: SdpMediaValue::Audio,
    port: 10_000,
    port_count: 0,
    proto: SdpProtocolValue::RtpAvp,
    formats: SdpFormatList::Integers(vec![0])
});
session.media.push(audio);

let video = SdpMedia::new(SdpMediaLine {
    media: SdpMediaValue::Video,
    port: 11_000,
    port_count: 0,
    proto: SdpProtocolValue::RtpAvp,
    formats: SdpFormatList::Integers(vec![96])
});
session.media.push(video);

let as_str = format!("{}", session);
println!("{}", as_str);

Only an issue when generating sdp payloads: #207

thutchmoto avatar Mar 09 '20 20:03 thutchmoto

Thanks for the report!

na-g avatar Mar 09 '20 22:03 na-g