Skip to content

Commit 4d96e5e

Browse files
authored
Support RFC 3890 (webrtc-rs#489)
* Support RFC 3890 Support RFC 3890 (TIAS) for unmarshaling bandwidth. * link reference
1 parent 7c148de commit 4d96e5e

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

sdp/src/description/description_test.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,15 @@ m=audio 54400 RTP/SAVPF 0 96\r\n\
402402
b=X-YZ:128\r\n\
403403
b=AS:12345\r\n";
404404

405+
const MEDIA_TRANSPORT_BANDWIDTH_SDP: &str = "v=0\r\n\
406+
o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5\r\n\
407+
s=SDP Seminar\r\n\
408+
t=2873397496 2873404696\r\n\
409+
m=video 51372 RTP/AVP 99\r\n\
410+
m=audio 54400 RTP/SAVPF 0 96\r\n\
411+
b=AS:12345\r\n\
412+
b=TIAS:12345\r\n";
413+
405414
const MEDIA_ENCRYPTION_KEY_SDP: &str = "v=0\r\n\
406415
o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5\r\n\
407416
s=SDP Seminar\r\n\
@@ -520,6 +529,11 @@ fn test_round_trip() -> Result<()> {
520529
Some(MEDIA_DESCRIPTION_OUT_OF_ORDER_SDPACTUAL),
521530
),
522531
("MediaBandwidth", MEDIA_BANDWIDTH_SDP, None),
532+
(
533+
"MediaTransportBandwidth",
534+
MEDIA_TRANSPORT_BANDWIDTH_SDP,
535+
None,
536+
),
523537
("MediaEncryptionKey", MEDIA_ENCRYPTION_KEY_SDP, None),
524538
(
525539
"MediaEncryptionKeyExtraCRLF",

sdp/src/description/session.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,9 @@ fn unmarshal_bandwidth(value: &str) -> Result<Bandwidth> {
10661066
parts[0] = parts[0].trim_start_matches("X-");
10671067
} else {
10681068
// Set according to currently registered with IANA
1069-
// https://tools.ietf.org/html/rfc4566#section-5.8
1070-
let i = index_of(parts[0], &["CT", "AS"]);
1069+
// https://tools.ietf.org/html/rfc4566#section-5.8 and
1070+
// https://datatracker.ietf.org/doc/html/rfc3890
1071+
let i = index_of(parts[0], &["CT", "AS", "TIAS"]);
10711072
if i == -1 {
10721073
return Err(Error::SdpInvalidValue(parts[0].to_owned()));
10731074
}

0 commit comments

Comments
 (0)