OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 static const char kDummyMid[] = "dummy_mid"; | 762 static const char kDummyMid[] = "dummy_mid"; |
763 static const int kDummyIndex = 123; | 763 static const int kDummyIndex = 123; |
764 | 764 |
765 // Misc | 765 // Misc |
766 static const char kDummyString[] = "dummy"; | 766 static const char kDummyString[] = "dummy"; |
767 | 767 |
768 // Helper functions | 768 // Helper functions |
769 | 769 |
770 static bool SdpDeserialize(const std::string& message, | 770 static bool SdpDeserialize(const std::string& message, |
771 JsepSessionDescription* jdesc) { | 771 JsepSessionDescription* jdesc) { |
772 return webrtc::SdpDeserialize(message, jdesc, NULL); | 772 return webrtc::SdpDeserialize(message, jdesc, nullptr); |
773 } | 773 } |
774 | 774 |
775 static bool SdpDeserializeCandidate(const std::string& message, | 775 static bool SdpDeserializeCandidate(const std::string& message, |
776 JsepIceCandidate* candidate) { | 776 JsepIceCandidate* candidate) { |
777 return webrtc::SdpDeserializeCandidate(message, candidate, NULL); | 777 return webrtc::SdpDeserializeCandidate(message, candidate, nullptr); |
778 } | 778 } |
779 | 779 |
780 // Add some extra |newlines| to the |message| after |line|. | 780 // Add some extra |newlines| to the |message| after |line|. |
781 static void InjectAfter(const std::string& line, | 781 static void InjectAfter(const std::string& line, |
782 const std::string& newlines, | 782 const std::string& newlines, |
783 std::string* message) { | 783 std::string* message) { |
784 const std::string tmp = line + newlines; | 784 const std::string tmp = line + newlines; |
785 rtc::replace_substrs(line.c_str(), line.length(), | 785 rtc::replace_substrs(line.c_str(), line.length(), |
786 tmp.c_str(), tmp.length(), message); | 786 tmp.c_str(), tmp.length(), message); |
787 } | 787 } |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 const_cast<Candidate&>(cc->at(j)->candidate()).set_password( | 1378 const_cast<Candidate&>(cc->at(j)->candidate()).set_password( |
1379 pwd); | 1379 pwd); |
1380 } | 1380 } |
1381 } | 1381 } |
1382 } | 1382 } |
1383 return true; | 1383 return true; |
1384 } | 1384 } |
1385 | 1385 |
1386 void AddIceOptions(const std::string& content_name, | 1386 void AddIceOptions(const std::string& content_name, |
1387 const std::vector<std::string>& transport_options) { | 1387 const std::vector<std::string>& transport_options) { |
1388 ASSERT_TRUE(desc_.GetTransportInfoByName(content_name) != NULL); | 1388 ASSERT_TRUE(desc_.GetTransportInfoByName(content_name) != nullptr); |
1389 cricket::TransportInfo transport_info = | 1389 cricket::TransportInfo transport_info = |
1390 *(desc_.GetTransportInfoByName(content_name)); | 1390 *(desc_.GetTransportInfoByName(content_name)); |
1391 desc_.RemoveTransportInfoByName(content_name); | 1391 desc_.RemoveTransportInfoByName(content_name); |
1392 transport_info.description.transport_options = transport_options; | 1392 transport_info.description.transport_options = transport_options; |
1393 desc_.AddTransportInfo(transport_info); | 1393 desc_.AddTransportInfo(transport_info); |
1394 } | 1394 } |
1395 | 1395 |
1396 void SetIceUfragPwd(const std::string& content_name, | 1396 void SetIceUfragPwd(const std::string& content_name, |
1397 const std::string& ice_ufrag, | 1397 const std::string& ice_ufrag, |
1398 const std::string& ice_pwd) { | 1398 const std::string& ice_pwd) { |
1399 ASSERT_TRUE(desc_.GetTransportInfoByName(content_name) != NULL); | 1399 ASSERT_TRUE(desc_.GetTransportInfoByName(content_name) != nullptr); |
1400 cricket::TransportInfo transport_info = | 1400 cricket::TransportInfo transport_info = |
1401 *(desc_.GetTransportInfoByName(content_name)); | 1401 *(desc_.GetTransportInfoByName(content_name)); |
1402 desc_.RemoveTransportInfoByName(content_name); | 1402 desc_.RemoveTransportInfoByName(content_name); |
1403 transport_info.description.ice_ufrag = ice_ufrag; | 1403 transport_info.description.ice_ufrag = ice_ufrag; |
1404 transport_info.description.ice_pwd = ice_pwd; | 1404 transport_info.description.ice_pwd = ice_pwd; |
1405 desc_.AddTransportInfo(transport_info); | 1405 desc_.AddTransportInfo(transport_info); |
1406 } | 1406 } |
1407 | 1407 |
1408 void AddFingerprint() { | 1408 void AddFingerprint() { |
1409 desc_.RemoveTransportInfoByName(kAudioContentName); | 1409 desc_.RemoveTransportInfoByName(kAudioContentName); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 << "a=rtpmap:99 VP8/90000\r\n" | 1640 << "a=rtpmap:99 VP8/90000\r\n" |
1641 << "a=rtpmap:95 RTX/90000\r\n" | 1641 << "a=rtpmap:95 RTX/90000\r\n" |
1642 << "a=fmtp:95 apt=99;\r\n"; | 1642 << "a=fmtp:95 apt=99;\r\n"; |
1643 sdp += os.str(); | 1643 sdp += os.str(); |
1644 | 1644 |
1645 // Deserialize | 1645 // Deserialize |
1646 SdpParseError error; | 1646 SdpParseError error; |
1647 EXPECT_TRUE(webrtc::SdpDeserialize(sdp, jdesc_output, &error)); | 1647 EXPECT_TRUE(webrtc::SdpDeserialize(sdp, jdesc_output, &error)); |
1648 | 1648 |
1649 const ContentInfo* ac = GetFirstAudioContent(jdesc_output->description()); | 1649 const ContentInfo* ac = GetFirstAudioContent(jdesc_output->description()); |
1650 ASSERT_TRUE(ac != NULL); | 1650 ASSERT_TRUE(ac != nullptr); |
1651 const AudioContentDescription* acd = | 1651 const AudioContentDescription* acd = |
1652 static_cast<const AudioContentDescription*>(ac->description); | 1652 static_cast<const AudioContentDescription*>(ac->description); |
1653 ASSERT_FALSE(acd->codecs().empty()); | 1653 ASSERT_FALSE(acd->codecs().empty()); |
1654 cricket::AudioCodec opus = acd->codecs()[0]; | 1654 cricket::AudioCodec opus = acd->codecs()[0]; |
1655 EXPECT_EQ("opus", opus.name); | 1655 EXPECT_EQ("opus", opus.name); |
1656 EXPECT_EQ(111, opus.id); | 1656 EXPECT_EQ(111, opus.id); |
1657 VerifyCodecParameter(opus.params, "minptime", params.min_ptime); | 1657 VerifyCodecParameter(opus.params, "minptime", params.min_ptime); |
1658 VerifyCodecParameter(opus.params, "stereo", params.stereo); | 1658 VerifyCodecParameter(opus.params, "stereo", params.stereo); |
1659 VerifyCodecParameter(opus.params, "sprop-stereo", params.sprop_stereo); | 1659 VerifyCodecParameter(opus.params, "sprop-stereo", params.sprop_stereo); |
1660 VerifyCodecParameter(opus.params, "useinbandfec", params.useinband); | 1660 VerifyCodecParameter(opus.params, "useinbandfec", params.useinband); |
1661 VerifyCodecParameter(opus.params, "maxaveragebitrate", | 1661 VerifyCodecParameter(opus.params, "maxaveragebitrate", |
1662 params.maxaveragebitrate); | 1662 params.maxaveragebitrate); |
1663 for (size_t i = 0; i < acd->codecs().size(); ++i) { | 1663 for (size_t i = 0; i < acd->codecs().size(); ++i) { |
1664 cricket::AudioCodec codec = acd->codecs()[i]; | 1664 cricket::AudioCodec codec = acd->codecs()[i]; |
1665 VerifyCodecParameter(codec.params, "ptime", params.ptime); | 1665 VerifyCodecParameter(codec.params, "ptime", params.ptime); |
1666 VerifyCodecParameter(codec.params, "maxptime", params.max_ptime); | 1666 VerifyCodecParameter(codec.params, "maxptime", params.max_ptime); |
1667 } | 1667 } |
1668 | 1668 |
1669 const ContentInfo* vc = GetFirstVideoContent(jdesc_output->description()); | 1669 const ContentInfo* vc = GetFirstVideoContent(jdesc_output->description()); |
1670 ASSERT_TRUE(vc != NULL); | 1670 ASSERT_TRUE(vc != nullptr); |
1671 const VideoContentDescription* vcd = | 1671 const VideoContentDescription* vcd = |
1672 static_cast<const VideoContentDescription*>(vc->description); | 1672 static_cast<const VideoContentDescription*>(vc->description); |
1673 ASSERT_FALSE(vcd->codecs().empty()); | 1673 ASSERT_FALSE(vcd->codecs().empty()); |
1674 cricket::VideoCodec vp8 = vcd->codecs()[0]; | 1674 cricket::VideoCodec vp8 = vcd->codecs()[0]; |
1675 EXPECT_EQ("VP8", vp8.name); | 1675 EXPECT_EQ("VP8", vp8.name); |
1676 EXPECT_EQ(99, vp8.id); | 1676 EXPECT_EQ(99, vp8.id); |
1677 cricket::VideoCodec rtx = vcd->codecs()[1]; | 1677 cricket::VideoCodec rtx = vcd->codecs()[1]; |
1678 EXPECT_EQ("RTX", rtx.name); | 1678 EXPECT_EQ("RTX", rtx.name); |
1679 EXPECT_EQ(95, rtx.id); | 1679 EXPECT_EQ(95, rtx.id); |
1680 VerifyCodecParameter(rtx.params, "apt", vp8.id); | 1680 VerifyCodecParameter(rtx.params, "apt", vp8.id); |
(...skipping 21 matching lines...) Expand all Loading... |
1702 std::ostringstream os; | 1702 std::ostringstream os; |
1703 os << sdp_session_and_audio; | 1703 os << sdp_session_and_audio; |
1704 os << "a=rtcp-fb:" << (use_wildcard ? "*" : "111") << " nack\r\n"; | 1704 os << "a=rtcp-fb:" << (use_wildcard ? "*" : "111") << " nack\r\n"; |
1705 os << sdp_video; | 1705 os << sdp_video; |
1706 os << "a=rtcp-fb:" << (use_wildcard ? "*" : "101") << " ccm fir\r\n"; | 1706 os << "a=rtcp-fb:" << (use_wildcard ? "*" : "101") << " ccm fir\r\n"; |
1707 std::string sdp = os.str(); | 1707 std::string sdp = os.str(); |
1708 // Deserialize | 1708 // Deserialize |
1709 SdpParseError error; | 1709 SdpParseError error; |
1710 EXPECT_TRUE(webrtc::SdpDeserialize(sdp, jdesc_output, &error)); | 1710 EXPECT_TRUE(webrtc::SdpDeserialize(sdp, jdesc_output, &error)); |
1711 const ContentInfo* ac = GetFirstAudioContent(jdesc_output->description()); | 1711 const ContentInfo* ac = GetFirstAudioContent(jdesc_output->description()); |
1712 ASSERT_TRUE(ac != NULL); | 1712 ASSERT_TRUE(ac != nullptr); |
1713 const AudioContentDescription* acd = | 1713 const AudioContentDescription* acd = |
1714 static_cast<const AudioContentDescription*>(ac->description); | 1714 static_cast<const AudioContentDescription*>(ac->description); |
1715 ASSERT_FALSE(acd->codecs().empty()); | 1715 ASSERT_FALSE(acd->codecs().empty()); |
1716 cricket::AudioCodec opus = acd->codecs()[0]; | 1716 cricket::AudioCodec opus = acd->codecs()[0]; |
1717 EXPECT_EQ(111, opus.id); | 1717 EXPECT_EQ(111, opus.id); |
1718 EXPECT_TRUE(opus.HasFeedbackParam( | 1718 EXPECT_TRUE(opus.HasFeedbackParam( |
1719 cricket::FeedbackParam(cricket::kRtcpFbParamNack, | 1719 cricket::FeedbackParam(cricket::kRtcpFbParamNack, |
1720 cricket::kParamValueEmpty))); | 1720 cricket::kParamValueEmpty))); |
1721 | 1721 |
1722 const ContentInfo* vc = GetFirstVideoContent(jdesc_output->description()); | 1722 const ContentInfo* vc = GetFirstVideoContent(jdesc_output->description()); |
1723 ASSERT_TRUE(vc != NULL); | 1723 ASSERT_TRUE(vc != nullptr); |
1724 const VideoContentDescription* vcd = | 1724 const VideoContentDescription* vcd = |
1725 static_cast<const VideoContentDescription*>(vc->description); | 1725 static_cast<const VideoContentDescription*>(vc->description); |
1726 ASSERT_FALSE(vcd->codecs().empty()); | 1726 ASSERT_FALSE(vcd->codecs().empty()); |
1727 cricket::VideoCodec vp8 = vcd->codecs()[0]; | 1727 cricket::VideoCodec vp8 = vcd->codecs()[0]; |
1728 EXPECT_STREQ(webrtc::JsepSessionDescription::kDefaultVideoCodecName, | 1728 EXPECT_STREQ(webrtc::JsepSessionDescription::kDefaultVideoCodecName, |
1729 vp8.name.c_str()); | 1729 vp8.name.c_str()); |
1730 EXPECT_EQ(101, vp8.id); | 1730 EXPECT_EQ(101, vp8.id); |
1731 EXPECT_TRUE(vp8.HasFeedbackParam( | 1731 EXPECT_TRUE(vp8.HasFeedbackParam( |
1732 cricket::FeedbackParam(cricket::kRtcpFbParamNack, | 1732 cricket::FeedbackParam(cricket::kRtcpFbParamNack, |
1733 cricket::kParamValueEmpty))); | 1733 cricket::kParamValueEmpty))); |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( | 2693 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( |
2694 mutant->GetContentDescriptionByName(kDataContentName)); | 2694 mutant->GetContentDescriptionByName(kDataContentName)); |
2695 std::vector<cricket::DataCodec> codecs(dcdesc->codecs()); | 2695 std::vector<cricket::DataCodec> codecs(dcdesc->codecs()); |
2696 EXPECT_EQ(1U, codecs.size()); | 2696 EXPECT_EQ(1U, codecs.size()); |
2697 EXPECT_EQ(cricket::kGoogleSctpDataCodecPlType, codecs[0].id); | 2697 EXPECT_EQ(cricket::kGoogleSctpDataCodecPlType, codecs[0].id); |
2698 codecs[0].SetParam(cricket::kCodecParamPort, kUnusualSctpPort); | 2698 codecs[0].SetParam(cricket::kCodecParamPort, kUnusualSctpPort); |
2699 dcdesc->set_codecs(codecs); | 2699 dcdesc->set_codecs(codecs); |
2700 | 2700 |
2701 // note: mutant's owned by jdesc now. | 2701 // note: mutant's owned by jdesc now. |
2702 ASSERT_TRUE(jdesc.Initialize(mutant, kSessionId, kSessionVersion)); | 2702 ASSERT_TRUE(jdesc.Initialize(mutant, kSessionId, kSessionVersion)); |
2703 mutant = NULL; | 2703 mutant = nullptr; |
2704 | 2704 |
2705 // Then get the deserialized JsepSessionDescription. | 2705 // Then get the deserialized JsepSessionDescription. |
2706 std::string sdp_with_data = kSdpString; | 2706 std::string sdp_with_data = kSdpString; |
2707 sdp_with_data.append(kSdpSctpDataChannelString); | 2707 sdp_with_data.append(kSdpSctpDataChannelString); |
2708 rtc::replace_substrs(default_portstr, strlen(default_portstr), | 2708 rtc::replace_substrs(default_portstr, strlen(default_portstr), |
2709 unusual_portstr, strlen(unusual_portstr), | 2709 unusual_portstr, strlen(unusual_portstr), |
2710 &sdp_with_data); | 2710 &sdp_with_data); |
2711 JsepSessionDescription jdesc_output(kDummyString); | 2711 JsepSessionDescription jdesc_output(kDummyString); |
2712 | 2712 |
2713 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); | 2713 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2926 "m=audio 9 RTP/SAVPF 104 103\r\n" // Pl type 104 preferred. | 2926 "m=audio 9 RTP/SAVPF 104 103\r\n" // Pl type 104 preferred. |
2927 "a=rtpmap:111 opus/48000/2\r\n" // Pltype 111 listed before 103 and 104 | 2927 "a=rtpmap:111 opus/48000/2\r\n" // Pltype 111 listed before 103 and 104 |
2928 // in the map. | 2928 // in the map. |
2929 "a=rtpmap:103 ISAC/16000\r\n" // Pltype 103 listed before 104 in the map. | 2929 "a=rtpmap:103 ISAC/16000\r\n" // Pltype 103 listed before 104 in the map. |
2930 "a=rtpmap:104 ISAC/32000\r\n"; | 2930 "a=rtpmap:104 ISAC/32000\r\n"; |
2931 | 2931 |
2932 // Deserialize | 2932 // Deserialize |
2933 EXPECT_TRUE(SdpDeserialize(kSdpWithReorderedPlTypesString, &jdesc_output)); | 2933 EXPECT_TRUE(SdpDeserialize(kSdpWithReorderedPlTypesString, &jdesc_output)); |
2934 | 2934 |
2935 const ContentInfo* ac = GetFirstAudioContent(jdesc_output.description()); | 2935 const ContentInfo* ac = GetFirstAudioContent(jdesc_output.description()); |
2936 ASSERT_TRUE(ac != NULL); | 2936 ASSERT_TRUE(ac != nullptr); |
2937 const AudioContentDescription* acd = | 2937 const AudioContentDescription* acd = |
2938 static_cast<const AudioContentDescription*>(ac->description); | 2938 static_cast<const AudioContentDescription*>(ac->description); |
2939 ASSERT_FALSE(acd->codecs().empty()); | 2939 ASSERT_FALSE(acd->codecs().empty()); |
2940 EXPECT_EQ("ISAC", acd->codecs()[0].name); | 2940 EXPECT_EQ("ISAC", acd->codecs()[0].name); |
2941 EXPECT_EQ(32000, acd->codecs()[0].clockrate); | 2941 EXPECT_EQ(32000, acd->codecs()[0].clockrate); |
2942 EXPECT_EQ(104, acd->codecs()[0].id); | 2942 EXPECT_EQ(104, acd->codecs()[0].id); |
2943 } | 2943 } |
2944 | 2944 |
2945 TEST_F(WebRtcSdpTest, DeserializeSerializeCodecParams) { | 2945 TEST_F(WebRtcSdpTest, DeserializeSerializeCodecParams) { |
2946 JsepSessionDescription jdesc_output(kDummyString); | 2946 JsepSessionDescription jdesc_output(kDummyString); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2981 "m=video 3457 RTP/SAVPF 120\r\n" | 2981 "m=video 3457 RTP/SAVPF 120\r\n" |
2982 "a=rtpmap:120 VP8/90000\r\n" | 2982 "a=rtpmap:120 VP8/90000\r\n" |
2983 "a=fmtp:120 x-google-min-bitrate=10;x-google-max-quantization=40\r\n"; | 2983 "a=fmtp:120 x-google-min-bitrate=10;x-google-max-quantization=40\r\n"; |
2984 | 2984 |
2985 // Deserialize | 2985 // Deserialize |
2986 SdpParseError error; | 2986 SdpParseError error; |
2987 EXPECT_TRUE( | 2987 EXPECT_TRUE( |
2988 webrtc::SdpDeserialize(kSdpWithFmtpString, &jdesc_output, &error)); | 2988 webrtc::SdpDeserialize(kSdpWithFmtpString, &jdesc_output, &error)); |
2989 | 2989 |
2990 const ContentInfo* vc = GetFirstVideoContent(jdesc_output.description()); | 2990 const ContentInfo* vc = GetFirstVideoContent(jdesc_output.description()); |
2991 ASSERT_TRUE(vc != NULL); | 2991 ASSERT_TRUE(vc != nullptr); |
2992 const VideoContentDescription* vcd = | 2992 const VideoContentDescription* vcd = |
2993 static_cast<const VideoContentDescription*>(vc->description); | 2993 static_cast<const VideoContentDescription*>(vc->description); |
2994 ASSERT_FALSE(vcd->codecs().empty()); | 2994 ASSERT_FALSE(vcd->codecs().empty()); |
2995 cricket::VideoCodec vp8 = vcd->codecs()[0]; | 2995 cricket::VideoCodec vp8 = vcd->codecs()[0]; |
2996 EXPECT_EQ("VP8", vp8.name); | 2996 EXPECT_EQ("VP8", vp8.name); |
2997 EXPECT_EQ(120, vp8.id); | 2997 EXPECT_EQ(120, vp8.id); |
2998 cricket::CodecParameterMap::iterator found = | 2998 cricket::CodecParameterMap::iterator found = |
2999 vp8.params.find("x-google-min-bitrate"); | 2999 vp8.params.find("x-google-min-bitrate"); |
3000 ASSERT_TRUE(found != vp8.params.end()); | 3000 ASSERT_TRUE(found != vp8.params.end()); |
3001 EXPECT_EQ(found->second, "10"); | 3001 EXPECT_EQ(found->second, "10"); |
(...skipping 14 matching lines...) Expand all Loading... |
3016 "a=rtpmap:98 H264/90000\r\n" | 3016 "a=rtpmap:98 H264/90000\r\n" |
3017 "a=fmtp:98 profile-level-id=42A01E; " | 3017 "a=fmtp:98 profile-level-id=42A01E; " |
3018 "sprop-parameter-sets=Z0IACpZTBYmI,aMljiA==\r\n"; | 3018 "sprop-parameter-sets=Z0IACpZTBYmI,aMljiA==\r\n"; |
3019 | 3019 |
3020 // Deserialize. | 3020 // Deserialize. |
3021 SdpParseError error; | 3021 SdpParseError error; |
3022 EXPECT_TRUE( | 3022 EXPECT_TRUE( |
3023 webrtc::SdpDeserialize(kSdpWithFmtpString, &jdesc_output, &error)); | 3023 webrtc::SdpDeserialize(kSdpWithFmtpString, &jdesc_output, &error)); |
3024 | 3024 |
3025 const ContentInfo* vc = GetFirstVideoContent(jdesc_output.description()); | 3025 const ContentInfo* vc = GetFirstVideoContent(jdesc_output.description()); |
3026 ASSERT_TRUE(vc != NULL); | 3026 ASSERT_TRUE(vc != nullptr); |
3027 const VideoContentDescription* vcd = | 3027 const VideoContentDescription* vcd = |
3028 static_cast<const VideoContentDescription*>(vc->description); | 3028 static_cast<const VideoContentDescription*>(vc->description); |
3029 ASSERT_TRUE(vcd != NULL); | 3029 ASSERT_TRUE(vcd != nullptr); |
3030 ASSERT_FALSE(vcd->codecs().empty()); | 3030 ASSERT_FALSE(vcd->codecs().empty()); |
3031 cricket::VideoCodec h264 = vcd->codecs()[0]; | 3031 cricket::VideoCodec h264 = vcd->codecs()[0]; |
3032 EXPECT_EQ("H264", h264.name); | 3032 EXPECT_EQ("H264", h264.name); |
3033 EXPECT_EQ(98, h264.id); | 3033 EXPECT_EQ(98, h264.id); |
3034 cricket::CodecParameterMap::const_iterator found = | 3034 cricket::CodecParameterMap::const_iterator found = |
3035 h264.params.find("profile-level-id"); | 3035 h264.params.find("profile-level-id"); |
3036 ASSERT_TRUE(found != h264.params.end()); | 3036 ASSERT_TRUE(found != h264.params.end()); |
3037 EXPECT_EQ(found->second, "42A01E"); | 3037 EXPECT_EQ(found->second, "42A01E"); |
3038 found = h264.params.find("sprop-parameter-sets"); | 3038 found = h264.params.find("sprop-parameter-sets"); |
3039 ASSERT_TRUE(found != h264.params.end()); | 3039 ASSERT_TRUE(found != h264.params.end()); |
(...skipping 11 matching lines...) Expand all Loading... |
3051 "m=video 3457 RTP/SAVPF 120\r\n" | 3051 "m=video 3457 RTP/SAVPF 120\r\n" |
3052 "a=rtpmap:120 VP8/90000\r\n" | 3052 "a=rtpmap:120 VP8/90000\r\n" |
3053 "a=fmtp:120 x-google-min-bitrate=10; x-google-max-quantization=40\r\n"; | 3053 "a=fmtp:120 x-google-min-bitrate=10; x-google-max-quantization=40\r\n"; |
3054 | 3054 |
3055 // Deserialize | 3055 // Deserialize |
3056 SdpParseError error; | 3056 SdpParseError error; |
3057 EXPECT_TRUE(webrtc::SdpDeserialize(kSdpWithFmtpString, &jdesc_output, | 3057 EXPECT_TRUE(webrtc::SdpDeserialize(kSdpWithFmtpString, &jdesc_output, |
3058 &error)); | 3058 &error)); |
3059 | 3059 |
3060 const ContentInfo* vc = GetFirstVideoContent(jdesc_output.description()); | 3060 const ContentInfo* vc = GetFirstVideoContent(jdesc_output.description()); |
3061 ASSERT_TRUE(vc != NULL); | 3061 ASSERT_TRUE(vc != nullptr); |
3062 const VideoContentDescription* vcd = | 3062 const VideoContentDescription* vcd = |
3063 static_cast<const VideoContentDescription*>(vc->description); | 3063 static_cast<const VideoContentDescription*>(vc->description); |
3064 ASSERT_FALSE(vcd->codecs().empty()); | 3064 ASSERT_FALSE(vcd->codecs().empty()); |
3065 cricket::VideoCodec vp8 = vcd->codecs()[0]; | 3065 cricket::VideoCodec vp8 = vcd->codecs()[0]; |
3066 EXPECT_EQ("VP8", vp8.name); | 3066 EXPECT_EQ("VP8", vp8.name); |
3067 EXPECT_EQ(120, vp8.id); | 3067 EXPECT_EQ(120, vp8.id); |
3068 cricket::CodecParameterMap::iterator found = | 3068 cricket::CodecParameterMap::iterator found = |
3069 vp8.params.find("x-google-min-bitrate"); | 3069 vp8.params.find("x-google-min-bitrate"); |
3070 ASSERT_TRUE(found != vp8.params.end()); | 3070 ASSERT_TRUE(found != vp8.params.end()); |
3071 EXPECT_EQ(found->second, "10"); | 3071 EXPECT_EQ(found->second, "10"); |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3472 "s=-\r\n" | 3472 "s=-\r\n" |
3473 "t=0 0\r\n" | 3473 "t=0 0\r\n" |
3474 "m=audio 9 RTP/SAVPF 111\r\n" | 3474 "m=audio 9 RTP/SAVPF 111\r\n" |
3475 "c=IN IP4 0.0.0.0\r\n" | 3475 "c=IN IP4 0.0.0.0\r\n" |
3476 "a=rtpmap:111 opus/48000/2\r\n" | 3476 "a=rtpmap:111 opus/48000/2\r\n" |
3477 "a=msid: track_id\r\n"; | 3477 "a=msid: track_id\r\n"; |
3478 | 3478 |
3479 JsepSessionDescription jdesc_output(kDummyString); | 3479 JsepSessionDescription jdesc_output(kDummyString); |
3480 EXPECT_FALSE(SdpDeserialize(kSdpWithMissingStreamId, &jdesc_output)); | 3480 EXPECT_FALSE(SdpDeserialize(kSdpWithMissingStreamId, &jdesc_output)); |
3481 } | 3481 } |
OLD | NEW |