OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 | 771 |
772 // extmap | 772 // extmap |
773 ASSERT_EQ(cd1->rtp_header_extensions().size(), | 773 ASSERT_EQ(cd1->rtp_header_extensions().size(), |
774 cd2->rtp_header_extensions().size()); | 774 cd2->rtp_header_extensions().size()); |
775 for (size_t i = 0; i< cd1->rtp_header_extensions().size(); ++i) { | 775 for (size_t i = 0; i< cd1->rtp_header_extensions().size(); ++i) { |
776 const RtpHeaderExtension ext1 = cd1->rtp_header_extensions().at(i); | 776 const RtpHeaderExtension ext1 = cd1->rtp_header_extensions().at(i); |
777 const RtpHeaderExtension ext2 = cd2->rtp_header_extensions().at(i); | 777 const RtpHeaderExtension ext2 = cd2->rtp_header_extensions().at(i); |
778 EXPECT_EQ(ext1.uri, ext2.uri); | 778 EXPECT_EQ(ext1.uri, ext2.uri); |
779 EXPECT_EQ(ext1.id, ext2.id); | 779 EXPECT_EQ(ext1.id, ext2.id); |
780 } | 780 } |
781 | |
782 // buffered mode latency | |
783 EXPECT_EQ(cd1->buffered_mode_latency(), cd2->buffered_mode_latency()); | |
784 } | 781 } |
785 | 782 |
786 | 783 |
787 void CompareSessionDescription(const SessionDescription& desc1, | 784 void CompareSessionDescription(const SessionDescription& desc1, |
788 const SessionDescription& desc2) { | 785 const SessionDescription& desc2) { |
789 // Compare content descriptions. | 786 // Compare content descriptions. |
790 if (desc1.contents().size() != desc2.contents().size()) { | 787 if (desc1.contents().size() != desc2.contents().size()) { |
791 ADD_FAILURE(); | 788 ADD_FAILURE(); |
792 return; | 789 return; |
793 } | 790 } |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 | 1711 |
1715 std::string sdp_with_extmap = kSdpString; | 1712 std::string sdp_with_extmap = kSdpString; |
1716 InjectAfter("a=mid:audio_content_name\r\n", | 1713 InjectAfter("a=mid:audio_content_name\r\n", |
1717 kExtmap, &sdp_with_extmap); | 1714 kExtmap, &sdp_with_extmap); |
1718 InjectAfter("a=mid:video_content_name\r\n", | 1715 InjectAfter("a=mid:video_content_name\r\n", |
1719 kExtmap, &sdp_with_extmap); | 1716 kExtmap, &sdp_with_extmap); |
1720 | 1717 |
1721 EXPECT_EQ(sdp_with_extmap, message); | 1718 EXPECT_EQ(sdp_with_extmap, message); |
1722 } | 1719 } |
1723 | 1720 |
1724 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBufferLatency) { | |
1725 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( | |
1726 GetFirstVideoContent(&desc_)->description); | |
1727 vcd->set_buffered_mode_latency(128); | |
1728 | |
1729 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), | |
1730 jdesc_.session_id(), | |
1731 jdesc_.session_version())); | |
1732 std::string message = webrtc::SdpSerialize(jdesc_); | |
1733 std::string sdp_with_buffer_latency = kSdpFullString; | |
1734 InjectAfter("a=rtpmap:120 VP8/90000\r\n", | |
1735 "a=x-google-buffer-latency:128\r\n", | |
1736 &sdp_with_buffer_latency); | |
1737 EXPECT_EQ(sdp_with_buffer_latency, message); | |
1738 } | |
1739 | |
1740 TEST_F(WebRtcSdpTest, SerializeCandidates) { | 1721 TEST_F(WebRtcSdpTest, SerializeCandidates) { |
1741 std::string message = webrtc::SdpSerializeCandidate(*jcandidate_); | 1722 std::string message = webrtc::SdpSerializeCandidate(*jcandidate_); |
1742 EXPECT_EQ(std::string(kRawCandidate), message); | 1723 EXPECT_EQ(std::string(kRawCandidate), message); |
1743 } | 1724 } |
1744 | 1725 |
1745 // TODO(mallinath) : Enable this test once WebRTCSdp capable of parsing | 1726 // TODO(mallinath) : Enable this test once WebRTCSdp capable of parsing |
1746 // RFC 6544. | 1727 // RFC 6544. |
1747 TEST_F(WebRtcSdpTest, SerializeTcpCandidates) { | 1728 TEST_F(WebRtcSdpTest, SerializeTcpCandidates) { |
1748 Candidate candidate(ICE_CANDIDATE_COMPONENT_RTP, "tcp", | 1729 Candidate candidate(ICE_CANDIDATE_COMPONENT_RTP, "tcp", |
1749 rtc::SocketAddress("192.168.1.5", 9), kCandidatePriority, | 1730 rtc::SocketAddress("192.168.1.5", 9), kCandidatePriority, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 &sdp_with_ufrag_pwd); | 1936 &sdp_with_ufrag_pwd); |
1956 // Update the candidate ufrag and pwd to the expected ones. | 1937 // Update the candidate ufrag and pwd to the expected ones. |
1957 EXPECT_TRUE(UpdateCandidateUfragPwd(&jdesc_, 0, | 1938 EXPECT_TRUE(UpdateCandidateUfragPwd(&jdesc_, 0, |
1958 "media+level+iceufrag", "media+level+icepwd")); | 1939 "media+level+iceufrag", "media+level+icepwd")); |
1959 EXPECT_TRUE(UpdateCandidateUfragPwd(&jdesc_, 1, | 1940 EXPECT_TRUE(UpdateCandidateUfragPwd(&jdesc_, 1, |
1960 "session+level+iceufrag", "session+level+icepwd")); | 1941 "session+level+iceufrag", "session+level+icepwd")); |
1961 EXPECT_TRUE(SdpDeserialize(sdp_with_ufrag_pwd, &jdesc_with_ufrag_pwd)); | 1942 EXPECT_TRUE(SdpDeserialize(sdp_with_ufrag_pwd, &jdesc_with_ufrag_pwd)); |
1962 EXPECT_TRUE(CompareSessionDescription(jdesc_, jdesc_with_ufrag_pwd)); | 1943 EXPECT_TRUE(CompareSessionDescription(jdesc_, jdesc_with_ufrag_pwd)); |
1963 } | 1944 } |
1964 | 1945 |
1965 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithBufferLatency) { | |
1966 JsepSessionDescription jdesc_with_buffer_latency(kDummyString); | |
1967 std::string sdp_with_buffer_latency = kSdpFullString; | |
1968 InjectAfter("a=rtpmap:120 VP8/90000\r\n", | |
1969 "a=x-google-buffer-latency:128\r\n", | |
1970 &sdp_with_buffer_latency); | |
1971 | |
1972 EXPECT_TRUE( | |
1973 SdpDeserialize(sdp_with_buffer_latency, &jdesc_with_buffer_latency)); | |
1974 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( | |
1975 GetFirstVideoContent(&desc_)->description); | |
1976 vcd->set_buffered_mode_latency(128); | |
1977 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), | |
1978 jdesc_.session_id(), | |
1979 jdesc_.session_version())); | |
1980 EXPECT_TRUE(CompareSessionDescription(jdesc_, jdesc_with_buffer_latency)); | |
1981 } | |
1982 | |
1983 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithRecvOnlyContent) { | 1946 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithRecvOnlyContent) { |
1984 EXPECT_TRUE(TestDeserializeDirection(cricket::MD_RECVONLY)); | 1947 EXPECT_TRUE(TestDeserializeDirection(cricket::MD_RECVONLY)); |
1985 } | 1948 } |
1986 | 1949 |
1987 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithSendOnlyContent) { | 1950 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithSendOnlyContent) { |
1988 EXPECT_TRUE(TestDeserializeDirection(cricket::MD_SENDONLY)); | 1951 EXPECT_TRUE(TestDeserializeDirection(cricket::MD_SENDONLY)); |
1989 } | 1952 } |
1990 | 1953 |
1991 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithInactiveContent) { | 1954 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithInactiveContent) { |
1992 EXPECT_TRUE(TestDeserializeDirection(cricket::MD_INACTIVE)); | 1955 EXPECT_TRUE(TestDeserializeDirection(cricket::MD_INACTIVE)); |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2431 "b=AS:badvalue\r\n", | 2394 "b=AS:badvalue\r\n", |
2432 "b=AS:badvalue"); | 2395 "b=AS:badvalue"); |
2433 // rtcp-fb | 2396 // rtcp-fb |
2434 ExpectParseFailureWithNewLines("a=mid:video_content_name\r\n", | 2397 ExpectParseFailureWithNewLines("a=mid:video_content_name\r\n", |
2435 "a=rtcp-fb:badvalue nack\r\n", | 2398 "a=rtcp-fb:badvalue nack\r\n", |
2436 "a=rtcp-fb:badvalue nack"); | 2399 "a=rtcp-fb:badvalue nack"); |
2437 // extmap | 2400 // extmap |
2438 ExpectParseFailureWithNewLines("a=mid:video_content_name\r\n", | 2401 ExpectParseFailureWithNewLines("a=mid:video_content_name\r\n", |
2439 "a=extmap:badvalue http://example.com\r\n", | 2402 "a=extmap:badvalue http://example.com\r\n", |
2440 "a=extmap:badvalue http://example.com"); | 2403 "a=extmap:badvalue http://example.com"); |
2441 // x-google-buffer-latency | |
2442 ExpectParseFailureWithNewLines("a=mid:video_content_name\r\n", | |
2443 "a=x-google-buffer-latency:badvalue\r\n", | |
2444 "a=x-google-buffer-latency:badvalue"); | |
2445 } | 2404 } |
2446 | 2405 |
2447 TEST_F(WebRtcSdpTest, DeserializeSdpWithReorderedPltypes) { | 2406 TEST_F(WebRtcSdpTest, DeserializeSdpWithReorderedPltypes) { |
2448 JsepSessionDescription jdesc_output(kDummyString); | 2407 JsepSessionDescription jdesc_output(kDummyString); |
2449 | 2408 |
2450 const char kSdpWithReorderedPlTypesString[] = | 2409 const char kSdpWithReorderedPlTypesString[] = |
2451 "v=0\r\n" | 2410 "v=0\r\n" |
2452 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" | 2411 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" |
2453 "s=-\r\n" | 2412 "s=-\r\n" |
2454 "t=0 0\r\n" | 2413 "t=0 0\r\n" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2715 const cricket::MediaContentDescription* mdesc = | 2674 const cricket::MediaContentDescription* mdesc = |
2716 static_cast<const cricket::MediaContentDescription*>( | 2675 static_cast<const cricket::MediaContentDescription*>( |
2717 desc->contents()[i].description); | 2676 desc->contents()[i].description); |
2718 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); | 2677 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); |
2719 } | 2678 } |
2720 | 2679 |
2721 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); | 2680 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); |
2722 EXPECT_EQ(sdp_string, serialized_sdp); | 2681 EXPECT_EQ(sdp_string, serialized_sdp); |
2723 } | 2682 } |
2724 } | 2683 } |
OLD | NEW |