| 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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 } | 1388 } |
| 1389 std::string message = webrtc::SdpSerialize(jdesc_no_candidates, false); | 1389 std::string message = webrtc::SdpSerialize(jdesc_no_candidates, false); |
| 1390 EXPECT_EQ(new_sdp, message); | 1390 EXPECT_EQ(new_sdp, message); |
| 1391 return true; | 1391 return true; |
| 1392 } | 1392 } |
| 1393 | 1393 |
| 1394 void AddSctpDataChannel() { | 1394 void AddSctpDataChannel() { |
| 1395 std::unique_ptr<DataContentDescription> data(new DataContentDescription()); | 1395 std::unique_ptr<DataContentDescription> data(new DataContentDescription()); |
| 1396 data_desc_ = data.get(); | 1396 data_desc_ = data.get(); |
| 1397 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); | 1397 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); |
| 1398 DataCodec codec(cricket::kGoogleSctpDataCodecId, | 1398 DataCodec codec(cricket::kGoogleSctpDataCodecPlType, |
| 1399 cricket::kGoogleSctpDataCodecName); | 1399 cricket::kGoogleSctpDataCodecName); |
| 1400 codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort); | 1400 codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort); |
| 1401 data_desc_->AddCodec(codec); | 1401 data_desc_->AddCodec(codec); |
| 1402 desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release()); | 1402 desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release()); |
| 1403 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | 1403 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
| 1404 kDataContentName, TransportDescription(kUfragData, kPwdData)))); | 1404 kDataContentName, TransportDescription(kUfragData, kPwdData)))); |
| 1405 } | 1405 } |
| 1406 | 1406 |
| 1407 void AddRtpDataChannel() { | 1407 void AddRtpDataChannel() { |
| 1408 std::unique_ptr<DataContentDescription> data(new DataContentDescription()); | 1408 std::unique_ptr<DataContentDescription> data(new DataContentDescription()); |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 | 1983 |
| 1984 TEST_F(WebRtcSdpTest, SerializeWithSctpDataChannelAndNewPort) { | 1984 TEST_F(WebRtcSdpTest, SerializeWithSctpDataChannelAndNewPort) { |
| 1985 AddSctpDataChannel(); | 1985 AddSctpDataChannel(); |
| 1986 JsepSessionDescription jsep_desc(kDummyString); | 1986 JsepSessionDescription jsep_desc(kDummyString); |
| 1987 | 1987 |
| 1988 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | 1988 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); |
| 1989 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( | 1989 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( |
| 1990 jsep_desc.description()->GetContentDescriptionByName(kDataContentName)); | 1990 jsep_desc.description()->GetContentDescriptionByName(kDataContentName)); |
| 1991 | 1991 |
| 1992 const int kNewPort = 1234; | 1992 const int kNewPort = 1234; |
| 1993 cricket::DataCodec codec(cricket::kGoogleSctpDataCodecId, | 1993 cricket::DataCodec codec(cricket::kGoogleSctpDataCodecPlType, |
| 1994 cricket::kGoogleSctpDataCodecName); | 1994 cricket::kGoogleSctpDataCodecName); |
| 1995 codec.SetParam(cricket::kCodecParamPort, kNewPort); | 1995 codec.SetParam(cricket::kCodecParamPort, kNewPort); |
| 1996 dcdesc->AddOrReplaceCodec(codec); | 1996 dcdesc->AddOrReplaceCodec(codec); |
| 1997 | 1997 |
| 1998 std::string message = webrtc::SdpSerialize(jsep_desc, false); | 1998 std::string message = webrtc::SdpSerialize(jsep_desc, false); |
| 1999 | 1999 |
| 2000 std::string expected_sdp = kSdpString; | 2000 std::string expected_sdp = kSdpString; |
| 2001 expected_sdp.append(kSdpSctpDataChannelString); | 2001 expected_sdp.append(kSdpSctpDataChannelString); |
| 2002 | 2002 |
| 2003 char default_portstr[16]; | 2003 char default_portstr[16]; |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2598 kUnusualSctpPort); | 2598 kUnusualSctpPort); |
| 2599 | 2599 |
| 2600 // First setup the expected JsepSessionDescription. | 2600 // First setup the expected JsepSessionDescription. |
| 2601 JsepSessionDescription jdesc(kDummyString); | 2601 JsepSessionDescription jdesc(kDummyString); |
| 2602 // take our pre-built session description and change the SCTP port. | 2602 // take our pre-built session description and change the SCTP port. |
| 2603 cricket::SessionDescription* mutant = desc_.Copy(); | 2603 cricket::SessionDescription* mutant = desc_.Copy(); |
| 2604 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( | 2604 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( |
| 2605 mutant->GetContentDescriptionByName(kDataContentName)); | 2605 mutant->GetContentDescriptionByName(kDataContentName)); |
| 2606 std::vector<cricket::DataCodec> codecs(dcdesc->codecs()); | 2606 std::vector<cricket::DataCodec> codecs(dcdesc->codecs()); |
| 2607 EXPECT_EQ(1U, codecs.size()); | 2607 EXPECT_EQ(1U, codecs.size()); |
| 2608 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, codecs[0].id); | 2608 EXPECT_EQ(cricket::kGoogleSctpDataCodecPlType, codecs[0].id); |
| 2609 codecs[0].SetParam(cricket::kCodecParamPort, kUnusualSctpPort); | 2609 codecs[0].SetParam(cricket::kCodecParamPort, kUnusualSctpPort); |
| 2610 dcdesc->set_codecs(codecs); | 2610 dcdesc->set_codecs(codecs); |
| 2611 | 2611 |
| 2612 // note: mutant's owned by jdesc now. | 2612 // note: mutant's owned by jdesc now. |
| 2613 ASSERT_TRUE(jdesc.Initialize(mutant, kSessionId, kSessionVersion)); | 2613 ASSERT_TRUE(jdesc.Initialize(mutant, kSessionId, kSessionVersion)); |
| 2614 mutant = NULL; | 2614 mutant = NULL; |
| 2615 | 2615 |
| 2616 // Then get the deserialized JsepSessionDescription. | 2616 // Then get the deserialized JsepSessionDescription. |
| 2617 std::string sdp_with_data = kSdpString; | 2617 std::string sdp_with_data = kSdpString; |
| 2618 sdp_with_data.append(kSdpSctpDataChannelString); | 2618 sdp_with_data.append(kSdpSctpDataChannelString); |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3196 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" | 3196 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" |
| 3197 "s=-\r\n" | 3197 "s=-\r\n" |
| 3198 "t=0 0\r\n" | 3198 "t=0 0\r\n" |
| 3199 "m=video 9 UDP/DTLS/SCTP 120\r\n" | 3199 "m=video 9 UDP/DTLS/SCTP 120\r\n" |
| 3200 "a=sctp-port 5000\r\n" | 3200 "a=sctp-port 5000\r\n" |
| 3201 "a=fmtp:108 foo=10\r\n"; | 3201 "a=fmtp:108 foo=10\r\n"; |
| 3202 | 3202 |
| 3203 ExpectParseFailure(std::string(kSdpWithSctpPortInVideoDescription), | 3203 ExpectParseFailure(std::string(kSdpWithSctpPortInVideoDescription), |
| 3204 "sctp-port"); | 3204 "sctp-port"); |
| 3205 } | 3205 } |
| OLD | NEW |