Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profile-level-id parsed as hex but serialized as decimal #226

Closed
kcking opened this issue Aug 1, 2020 · 4 comments · Fixed by #227
Closed

profile-level-id parsed as hex but serialized as decimal #226

kcking opened this issue Aug 1, 2020 · 4 comments · Fixed by #227

Comments

@kcking
Copy link

kcking commented Aug 1, 2020

adding check_parse_and_serialize to the firefox video test shows this failure:

diff --git a/tests/unit_tests.rs b/tests/unit_tests.rs
index 5437432..207761b 100644
--- a/tests/unit_tests.rs
+++ b/tests/unit_tests.rs
@@ -354,6 +354,8 @@ a=ssrc:2709871439 cname:{735484ea-4f6c-f74a-bd66-7425f8476c2e}";
     assert!(msection
         .get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Ssrc)
         .is_some());
+
+    check_parse_and_serialize(sdp_str);
 }
 #[test]
 fn parse_firefox_datachannel_offer() {
cargo test 2>&1 | rg profile
  left: `"v=0\r\no=mozilla...THIS_IS_SDPARTA-52.0a1 506705521068071134 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 CD:34:D1:62:16:95:7B:B7:EB:74:E2:39:27:97:EB:0B:23:73:AC:BC:BF:2F:E3:91:CB:57:A9:9D:4A:A2:0B:40\r\na=group:BUNDLE sdparta_2\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=video 9 UDP/TLS/RTP/SAVPF 126 120 97\r\nc=IN IP4 0.0.0.0\r\na=recvonly\r\na=fmtp:126 packetization-mode=1;level-asymmetry-allowed=1;profile-level-id=4382751\r\na=fmtp:120 max-fs=12288;max-fr=60\r\na=fmtp:97 level-asymmetry-allowed=1;profile-level-id=4382751\r\na=ice-pwd:e3baa26dd2fa5030d881d385f1e36cce\r\na=ice-ufrag:58b99ead\r\na=mid:sdparta_2\r\na=rtcp-fb:126 nack\r\na=rtcp-fb:126 nack pli\r\na=rtcp-fb:126 ccm fir\r\na=rtcp-fb:126 goog-remb\r\na=rtcp-fb:120 nack\r\na=rtcp-fb:120 nack pli\r\na=rtcp-fb:120 ccm fir\r\na=rtcp-fb:120 goog-remb\r\na=rtcp-fb:97 nack\r\na=rtcp-fb:97 nack pli\r\na=rtcp-fb:97 ccm fir\r\na=rtcp-fb:97 goog-remb\r\na=rtcp-mux\r\na=rtpmap:126 H264/90000\r\na=rtpmap:120 VP8/90000\r\na=rtpmap:97 H264/90000\r\na=setup:actpass\r\na=ssrc:2709871439 cname:{735484ea-4f6c-f74a-bd66-7425f8476c2e}\r\n"`,
 right: `"v=0\r\no=mozilla...THIS_IS_SDPARTA-52.0a1 506705521068071134 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 CD:34:D1:62:16:95:7B:B7:EB:74:E2:39:27:97:EB:0B:23:73:AC:BC:BF:2F:E3:91:CB:57:A9:9D:4A:A2:0B:40\r\na=group:BUNDLE sdparta_2\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=video 9 UDP/TLS/RTP/SAVPF 126 120 97\r\nc=IN IP4 0.0.0.0\r\na=recvonly\r\na=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1\r\na=fmtp:120 max-fs=12288;max-fr=60\r\na=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1\r\na=ice-pwd:e3baa26dd2fa5030d881d385f1e36cce\r\na=ice-ufrag:58b99ead\r\na=mid:sdparta_2\r\na=rtcp-fb:126 nack\r\na=rtcp-fb:126 nack pli\r\na=rtcp-fb:126 ccm fir\r\na=rtcp-fb:126 goog-remb\r\na=rtcp-fb:120 nack\r\na=rtcp-fb:120 nack pli\r\na=rtcp-fb:120 ccm fir\r\na=rtcp-fb:120 goog-remb\r\na=rtcp-fb:97 nack\r\na=rtcp-fb:97 nack pli\r\na=rtcp-fb:97 ccm fir\r\na=rtcp-fb:97 goog-remb\r\na=rtcp-mux\r\na=rtpmap:126 H264/90000\r\na=rtpmap:120 VP8/90000\r\na=rtpmap:97 H264/90000\r\na=setup:actpass\r\na=ssrc:2709871439 cname:{735484ea-4f6c-f74a-bd66-7425f8476c2e}"`', tests/unit_tests.rs:12:5

also it looks like profile-level-id has to be 3 octects according to this RFC https://tools.ietf.org/html/rfc6184#section-8.1

@nils-ohlmeier
Copy link
Collaborator

Thanks a lot for the bug report. Indeed that is a bug which has slipped through the tests. Looks like an easy fix.

@kcking
Copy link
Author

kcking commented Aug 2, 2020

Awesome thank you for the quick fix! It looks like the only difference now is removal of the trailing \r\n. When I remove that from the test data and rebase off your branch, the test passes :)

@nils-ohlmeier
Copy link
Collaborator

Awesome thank you for the quick fix! It looks like the only difference now is removal of the trailing \r\n. When I remove that from the test data and rebase off your branch, the test passes :)

Yaeh I ran into the issue of thee \r\n as well. But then decided that for now it is easier to fix this issue just with a new unit test. I don't think that check_parse_and_serialize was ever written with the intention of it being used outside of the unit test.

It might be worth considering to look into using check_parse_and_serialize in the bigger tests as well. I'm only concerned that it might result in a whole set of new issues :-)

@nils-ohlmeier
Copy link
Collaborator

FYI I created issue #228 for looking into using check_parse_and_serialize() more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants