OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2009 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 |
| 11 #include <memory> |
| 12 |
11 #include "webrtc/base/arraysize.h" | 13 #include "webrtc/base/arraysize.h" |
12 #include "webrtc/base/fileutils.h" | 14 #include "webrtc/base/fileutils.h" |
13 #include "webrtc/base/gunit.h" | 15 #include "webrtc/base/gunit.h" |
14 #include "webrtc/base/helpers.h" | 16 #include "webrtc/base/helpers.h" |
15 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
16 #include "webrtc/base/pathutils.h" | 18 #include "webrtc/base/pathutils.h" |
17 #include "webrtc/base/signalthread.h" | 19 #include "webrtc/base/signalthread.h" |
18 #include "webrtc/base/ssladapter.h" | 20 #include "webrtc/base/ssladapter.h" |
19 #include "webrtc/base/sslidentity.h" | 21 #include "webrtc/base/sslidentity.h" |
20 #include "webrtc/base/window.h" | 22 #include "webrtc/base/window.h" |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 &sdesc, cricket::CA_OFFER, &err)); | 1528 &sdesc, cricket::CA_OFFER, &err)); |
1527 media_channel1_->set_fail_set_send_codecs(true); | 1529 media_channel1_->set_fail_set_send_codecs(true); |
1528 EXPECT_FALSE(channel1_->PushdownRemoteDescription( | 1530 EXPECT_FALSE(channel1_->PushdownRemoteDescription( |
1529 &sdesc, cricket::CA_ANSWER, &err)); | 1531 &sdesc, cricket::CA_ANSWER, &err)); |
1530 } | 1532 } |
1531 | 1533 |
1532 void TestSendTwoOffers() { | 1534 void TestSendTwoOffers() { |
1533 CreateChannels(0, 0); | 1535 CreateChannels(0, 0); |
1534 | 1536 |
1535 std::string err; | 1537 std::string err; |
1536 rtc::scoped_ptr<cricket::SessionDescription> sdesc1( | 1538 std::unique_ptr<cricket::SessionDescription> sdesc1( |
1537 CreateSessionDescriptionWithStream(1)); | 1539 CreateSessionDescriptionWithStream(1)); |
1538 EXPECT_TRUE(channel1_->PushdownLocalDescription( | 1540 EXPECT_TRUE(channel1_->PushdownLocalDescription( |
1539 sdesc1.get(), cricket::CA_OFFER, &err)); | 1541 sdesc1.get(), cricket::CA_OFFER, &err)); |
1540 EXPECT_TRUE(media_channel1_->HasSendStream(1)); | 1542 EXPECT_TRUE(media_channel1_->HasSendStream(1)); |
1541 | 1543 |
1542 rtc::scoped_ptr<cricket::SessionDescription> sdesc2( | 1544 std::unique_ptr<cricket::SessionDescription> sdesc2( |
1543 CreateSessionDescriptionWithStream(2)); | 1545 CreateSessionDescriptionWithStream(2)); |
1544 EXPECT_TRUE(channel1_->PushdownLocalDescription( | 1546 EXPECT_TRUE(channel1_->PushdownLocalDescription( |
1545 sdesc2.get(), cricket::CA_OFFER, &err)); | 1547 sdesc2.get(), cricket::CA_OFFER, &err)); |
1546 EXPECT_FALSE(media_channel1_->HasSendStream(1)); | 1548 EXPECT_FALSE(media_channel1_->HasSendStream(1)); |
1547 EXPECT_TRUE(media_channel1_->HasSendStream(2)); | 1549 EXPECT_TRUE(media_channel1_->HasSendStream(2)); |
1548 } | 1550 } |
1549 | 1551 |
1550 void TestReceiveTwoOffers() { | 1552 void TestReceiveTwoOffers() { |
1551 CreateChannels(0, 0); | 1553 CreateChannels(0, 0); |
1552 | 1554 |
1553 std::string err; | 1555 std::string err; |
1554 rtc::scoped_ptr<cricket::SessionDescription> sdesc1( | 1556 std::unique_ptr<cricket::SessionDescription> sdesc1( |
1555 CreateSessionDescriptionWithStream(1)); | 1557 CreateSessionDescriptionWithStream(1)); |
1556 EXPECT_TRUE(channel1_->PushdownRemoteDescription( | 1558 EXPECT_TRUE(channel1_->PushdownRemoteDescription( |
1557 sdesc1.get(), cricket::CA_OFFER, &err)); | 1559 sdesc1.get(), cricket::CA_OFFER, &err)); |
1558 EXPECT_TRUE(media_channel1_->HasRecvStream(1)); | 1560 EXPECT_TRUE(media_channel1_->HasRecvStream(1)); |
1559 | 1561 |
1560 rtc::scoped_ptr<cricket::SessionDescription> sdesc2( | 1562 std::unique_ptr<cricket::SessionDescription> sdesc2( |
1561 CreateSessionDescriptionWithStream(2)); | 1563 CreateSessionDescriptionWithStream(2)); |
1562 EXPECT_TRUE(channel1_->PushdownRemoteDescription( | 1564 EXPECT_TRUE(channel1_->PushdownRemoteDescription( |
1563 sdesc2.get(), cricket::CA_OFFER, &err)); | 1565 sdesc2.get(), cricket::CA_OFFER, &err)); |
1564 EXPECT_FALSE(media_channel1_->HasRecvStream(1)); | 1566 EXPECT_FALSE(media_channel1_->HasRecvStream(1)); |
1565 EXPECT_TRUE(media_channel1_->HasRecvStream(2)); | 1567 EXPECT_TRUE(media_channel1_->HasRecvStream(2)); |
1566 } | 1568 } |
1567 | 1569 |
1568 void TestSendPrAnswer() { | 1570 void TestSendPrAnswer() { |
1569 CreateChannels(0, 0); | 1571 CreateChannels(0, 0); |
1570 | 1572 |
1571 std::string err; | 1573 std::string err; |
1572 // Receive offer | 1574 // Receive offer |
1573 rtc::scoped_ptr<cricket::SessionDescription> sdesc1( | 1575 std::unique_ptr<cricket::SessionDescription> sdesc1( |
1574 CreateSessionDescriptionWithStream(1)); | 1576 CreateSessionDescriptionWithStream(1)); |
1575 EXPECT_TRUE(channel1_->PushdownRemoteDescription( | 1577 EXPECT_TRUE(channel1_->PushdownRemoteDescription( |
1576 sdesc1.get(), cricket::CA_OFFER, &err)); | 1578 sdesc1.get(), cricket::CA_OFFER, &err)); |
1577 EXPECT_TRUE(media_channel1_->HasRecvStream(1)); | 1579 EXPECT_TRUE(media_channel1_->HasRecvStream(1)); |
1578 | 1580 |
1579 // Send PR answer | 1581 // Send PR answer |
1580 rtc::scoped_ptr<cricket::SessionDescription> sdesc2( | 1582 std::unique_ptr<cricket::SessionDescription> sdesc2( |
1581 CreateSessionDescriptionWithStream(2)); | 1583 CreateSessionDescriptionWithStream(2)); |
1582 EXPECT_TRUE(channel1_->PushdownLocalDescription( | 1584 EXPECT_TRUE(channel1_->PushdownLocalDescription( |
1583 sdesc2.get(), cricket::CA_PRANSWER, &err)); | 1585 sdesc2.get(), cricket::CA_PRANSWER, &err)); |
1584 EXPECT_TRUE(media_channel1_->HasRecvStream(1)); | 1586 EXPECT_TRUE(media_channel1_->HasRecvStream(1)); |
1585 EXPECT_TRUE(media_channel1_->HasSendStream(2)); | 1587 EXPECT_TRUE(media_channel1_->HasSendStream(2)); |
1586 | 1588 |
1587 // Send answer | 1589 // Send answer |
1588 rtc::scoped_ptr<cricket::SessionDescription> sdesc3( | 1590 std::unique_ptr<cricket::SessionDescription> sdesc3( |
1589 CreateSessionDescriptionWithStream(3)); | 1591 CreateSessionDescriptionWithStream(3)); |
1590 EXPECT_TRUE(channel1_->PushdownLocalDescription( | 1592 EXPECT_TRUE(channel1_->PushdownLocalDescription( |
1591 sdesc3.get(), cricket::CA_ANSWER, &err)); | 1593 sdesc3.get(), cricket::CA_ANSWER, &err)); |
1592 EXPECT_TRUE(media_channel1_->HasRecvStream(1)); | 1594 EXPECT_TRUE(media_channel1_->HasRecvStream(1)); |
1593 EXPECT_FALSE(media_channel1_->HasSendStream(2)); | 1595 EXPECT_FALSE(media_channel1_->HasSendStream(2)); |
1594 EXPECT_TRUE(media_channel1_->HasSendStream(3)); | 1596 EXPECT_TRUE(media_channel1_->HasSendStream(3)); |
1595 } | 1597 } |
1596 | 1598 |
1597 void TestReceivePrAnswer() { | 1599 void TestReceivePrAnswer() { |
1598 CreateChannels(0, 0); | 1600 CreateChannels(0, 0); |
1599 | 1601 |
1600 std::string err; | 1602 std::string err; |
1601 // Send offer | 1603 // Send offer |
1602 rtc::scoped_ptr<cricket::SessionDescription> sdesc1( | 1604 std::unique_ptr<cricket::SessionDescription> sdesc1( |
1603 CreateSessionDescriptionWithStream(1)); | 1605 CreateSessionDescriptionWithStream(1)); |
1604 EXPECT_TRUE(channel1_->PushdownLocalDescription( | 1606 EXPECT_TRUE(channel1_->PushdownLocalDescription( |
1605 sdesc1.get(), cricket::CA_OFFER, &err)); | 1607 sdesc1.get(), cricket::CA_OFFER, &err)); |
1606 EXPECT_TRUE(media_channel1_->HasSendStream(1)); | 1608 EXPECT_TRUE(media_channel1_->HasSendStream(1)); |
1607 | 1609 |
1608 // Receive PR answer | 1610 // Receive PR answer |
1609 rtc::scoped_ptr<cricket::SessionDescription> sdesc2( | 1611 std::unique_ptr<cricket::SessionDescription> sdesc2( |
1610 CreateSessionDescriptionWithStream(2)); | 1612 CreateSessionDescriptionWithStream(2)); |
1611 EXPECT_TRUE(channel1_->PushdownRemoteDescription( | 1613 EXPECT_TRUE(channel1_->PushdownRemoteDescription( |
1612 sdesc2.get(), cricket::CA_PRANSWER, &err)); | 1614 sdesc2.get(), cricket::CA_PRANSWER, &err)); |
1613 EXPECT_TRUE(media_channel1_->HasSendStream(1)); | 1615 EXPECT_TRUE(media_channel1_->HasSendStream(1)); |
1614 EXPECT_TRUE(media_channel1_->HasRecvStream(2)); | 1616 EXPECT_TRUE(media_channel1_->HasRecvStream(2)); |
1615 | 1617 |
1616 // Receive answer | 1618 // Receive answer |
1617 rtc::scoped_ptr<cricket::SessionDescription> sdesc3( | 1619 std::unique_ptr<cricket::SessionDescription> sdesc3( |
1618 CreateSessionDescriptionWithStream(3)); | 1620 CreateSessionDescriptionWithStream(3)); |
1619 EXPECT_TRUE(channel1_->PushdownRemoteDescription( | 1621 EXPECT_TRUE(channel1_->PushdownRemoteDescription( |
1620 sdesc3.get(), cricket::CA_ANSWER, &err)); | 1622 sdesc3.get(), cricket::CA_ANSWER, &err)); |
1621 EXPECT_TRUE(media_channel1_->HasSendStream(1)); | 1623 EXPECT_TRUE(media_channel1_->HasSendStream(1)); |
1622 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); | 1624 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); |
1623 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); | 1625 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); |
1624 } | 1626 } |
1625 | 1627 |
1626 void TestFlushRtcp() { | 1628 void TestFlushRtcp() { |
1627 bool send_rtcp1; | 1629 bool send_rtcp1; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 protected: | 1772 protected: |
1771 // TODO(pbos): Remove playout from all media channels and let renderers mute | 1773 // TODO(pbos): Remove playout from all media channels and let renderers mute |
1772 // themselves. | 1774 // themselves. |
1773 const bool verify_playout_; | 1775 const bool verify_playout_; |
1774 cricket::FakeTransportController transport_controller1_; | 1776 cricket::FakeTransportController transport_controller1_; |
1775 cricket::FakeTransportController transport_controller2_; | 1777 cricket::FakeTransportController transport_controller2_; |
1776 cricket::FakeMediaEngine media_engine_; | 1778 cricket::FakeMediaEngine media_engine_; |
1777 // The media channels are owned by the voice channel objects below. | 1779 // The media channels are owned by the voice channel objects below. |
1778 typename T::MediaChannel* media_channel1_; | 1780 typename T::MediaChannel* media_channel1_; |
1779 typename T::MediaChannel* media_channel2_; | 1781 typename T::MediaChannel* media_channel2_; |
1780 rtc::scoped_ptr<typename T::Channel> channel1_; | 1782 std::unique_ptr<typename T::Channel> channel1_; |
1781 rtc::scoped_ptr<typename T::Channel> channel2_; | 1783 std::unique_ptr<typename T::Channel> channel2_; |
1782 typename T::Content local_media_content1_; | 1784 typename T::Content local_media_content1_; |
1783 typename T::Content local_media_content2_; | 1785 typename T::Content local_media_content2_; |
1784 typename T::Content remote_media_content1_; | 1786 typename T::Content remote_media_content1_; |
1785 typename T::Content remote_media_content2_; | 1787 typename T::Content remote_media_content2_; |
1786 // The RTP and RTCP packets to send in the tests. | 1788 // The RTP and RTCP packets to send in the tests. |
1787 std::string rtp_packet_; | 1789 std::string rtp_packet_; |
1788 std::string rtcp_packet_; | 1790 std::string rtcp_packet_; |
1789 int media_info_callbacks1_; | 1791 int media_info_callbacks1_; |
1790 int media_info_callbacks2_; | 1792 int media_info_callbacks2_; |
1791 }; | 1793 }; |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 }; | 2662 }; |
2661 rtc::Buffer payload(data, 3); | 2663 rtc::Buffer payload(data, 3); |
2662 cricket::SendDataResult result; | 2664 cricket::SendDataResult result; |
2663 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2665 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
2664 EXPECT_EQ(params.ssrc, | 2666 EXPECT_EQ(params.ssrc, |
2665 media_channel1_->last_sent_data_params().ssrc); | 2667 media_channel1_->last_sent_data_params().ssrc); |
2666 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2668 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
2667 } | 2669 } |
2668 | 2670 |
2669 // TODO(pthatcher): TestSetReceiver? | 2671 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |