mozilla / webrtc-sdp

Rust SDP parser for WebRTC
Mozilla Public License 2.0
155 stars 30 forks source link

SdpAttributeFmtpParameters with unknown tokens does not include delimiter when writing to string #243

Closed thutchmoto closed 3 years ago

thutchmoto commented 3 years ago

Given this source line:

a=fmtp:102 packetization-mode=1;profile-level-id=42c015;sprop-parameter-sets=Z0LAFYyNQKD5APCIRqA=,aM48gA==

If the sdp is parsed, and then written back out to a string, the previous line is emitted as:

a=fmtp:102 profile-level-id=42c015;packetization-mode=1sprop-parameter-sets=Z0LAFYyNQKD5APCIRqA=,aM48gA==

Notice that the packetization-mode is not delimited from the sprop-parameters

thutchmoto commented 3 years ago

This is easily reproducible:

fn main() {
    let att = webrtc_sdp::attribute_type::SdpAttributeFmtpParameters {
        packetization_mode: 1,
        level_asymmetry_allowed: false,
        profile_level_id: 0x42c015,

        max_fs: 0,
        max_cpb: 0,
        max_dpb: 0,
        max_br: 0,
        max_mbps: 0,
        max_fr: 0,
        maxplaybackrate: 48000,
        usedtx: false,
        stereo: false,
        useinbandfec: false,
        cbr: false,
        encodings: Vec::new(),
        dtmf_tones: "".to_string(),
        unknown_tokens: vec!["sprop-parameter-sets=Z0LAFYyNQKD5APCIRqA=,aM48gA==".to_string()],
    };
    println!("as_string: {}", att);
}

Output:

as_string: packetization-mode=1;profile-level-id=4374549sprop-parameter-sets=Z0LAFYyNQKD5APCIRqA=,aM48gA==
na-g commented 3 years ago

@thutchmoto Thanks for the bug report!