OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2009 Google Inc. | 3 * Copyright 2009 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 rtc::Pathname(path), "wb"); | 119 rtc::Pathname(path), "wb"); |
120 } | 120 } |
121 | 121 |
122 // Base class for Voice/VideoChannel tests | 122 // Base class for Voice/VideoChannel tests |
123 template<class T> | 123 template<class T> |
124 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 124 class ChannelTest : public testing::Test, public sigslot::has_slots<> { |
125 public: | 125 public: |
126 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 126 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, |
127 DTLS = 0x10 }; | 127 DTLS = 0x10 }; |
128 | 128 |
129 ChannelTest(const uint8* rtp_data, | 129 ChannelTest(bool verify_playout, |
| 130 const uint8* rtp_data, |
130 int rtp_len, | 131 int rtp_len, |
131 const uint8* rtcp_data, | 132 const uint8* rtcp_data, |
132 int rtcp_len) | 133 int rtcp_len) |
133 : transport_controller1_(cricket::ICEROLE_CONTROLLING), | 134 : verify_playout_(verify_playout), |
| 135 transport_controller1_(cricket::ICEROLE_CONTROLLING), |
134 transport_controller2_(cricket::ICEROLE_CONTROLLED), | 136 transport_controller2_(cricket::ICEROLE_CONTROLLED), |
135 media_channel1_(NULL), | 137 media_channel1_(NULL), |
136 media_channel2_(NULL), | 138 media_channel2_(NULL), |
137 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), | 139 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), |
138 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), | 140 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), |
139 media_info_callbacks1_(), | 141 media_info_callbacks1_(), |
140 media_info_callbacks2_(), | 142 media_info_callbacks2_(), |
141 ssrc_(0), | 143 ssrc_(0), |
142 error_(T::MediaChannel::ERROR_NONE) {} | 144 error_(T::MediaChannel::ERROR_NONE) {} |
143 | 145 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // Base implementation. | 484 // Base implementation. |
483 } | 485 } |
484 | 486 |
485 // Tests that can be used by derived classes. | 487 // Tests that can be used by derived classes. |
486 | 488 |
487 // Basic sanity check. | 489 // Basic sanity check. |
488 void TestInit() { | 490 void TestInit() { |
489 CreateChannels(0, 0); | 491 CreateChannels(0, 0); |
490 EXPECT_FALSE(channel1_->secure()); | 492 EXPECT_FALSE(channel1_->secure()); |
491 EXPECT_FALSE(media_channel1_->sending()); | 493 EXPECT_FALSE(media_channel1_->sending()); |
492 EXPECT_FALSE(media_channel1_->playout()); | 494 if (verify_playout_) { |
| 495 EXPECT_FALSE(media_channel1_->playout()); |
| 496 } |
493 EXPECT_TRUE(media_channel1_->codecs().empty()); | 497 EXPECT_TRUE(media_channel1_->codecs().empty()); |
494 EXPECT_TRUE(media_channel1_->recv_streams().empty()); | 498 EXPECT_TRUE(media_channel1_->recv_streams().empty()); |
495 EXPECT_TRUE(media_channel1_->rtp_packets().empty()); | 499 EXPECT_TRUE(media_channel1_->rtp_packets().empty()); |
496 EXPECT_TRUE(media_channel1_->rtcp_packets().empty()); | 500 EXPECT_TRUE(media_channel1_->rtcp_packets().empty()); |
497 } | 501 } |
498 | 502 |
499 // Test that SetLocalContent and SetRemoteContent properly configure | 503 // Test that SetLocalContent and SetRemoteContent properly configure |
500 // the codecs. | 504 // the codecs. |
501 void TestSetContents() { | 505 void TestSetContents() { |
502 CreateChannels(0, 0); | 506 CreateChannels(0, 0); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 813 |
810 EXPECT_TRUE(channel1_->secure()); | 814 EXPECT_TRUE(channel1_->secure()); |
811 EXPECT_TRUE(channel2_->secure()); | 815 EXPECT_TRUE(channel2_->secure()); |
812 EXPECT_TRUE(SendCustomRtp2(kSsrc2, 0)); | 816 EXPECT_TRUE(SendCustomRtp2(kSsrc2, 0)); |
813 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, 0)); | 817 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, 0)); |
814 } | 818 } |
815 | 819 |
816 // Test that we only start playout and sending at the right times. | 820 // Test that we only start playout and sending at the right times. |
817 void TestPlayoutAndSendingStates() { | 821 void TestPlayoutAndSendingStates() { |
818 CreateChannels(0, 0); | 822 CreateChannels(0, 0); |
819 EXPECT_FALSE(media_channel1_->playout()); | 823 if (verify_playout_) { |
| 824 EXPECT_FALSE(media_channel1_->playout()); |
| 825 } |
820 EXPECT_FALSE(media_channel1_->sending()); | 826 EXPECT_FALSE(media_channel1_->sending()); |
821 EXPECT_FALSE(media_channel2_->playout()); | 827 if (verify_playout_) { |
| 828 EXPECT_FALSE(media_channel2_->playout()); |
| 829 } |
822 EXPECT_FALSE(media_channel2_->sending()); | 830 EXPECT_FALSE(media_channel2_->sending()); |
823 EXPECT_TRUE(channel1_->Enable(true)); | 831 EXPECT_TRUE(channel1_->Enable(true)); |
824 EXPECT_FALSE(media_channel1_->playout()); | 832 if (verify_playout_) { |
| 833 EXPECT_FALSE(media_channel1_->playout()); |
| 834 } |
825 EXPECT_FALSE(media_channel1_->sending()); | 835 EXPECT_FALSE(media_channel1_->sending()); |
826 EXPECT_TRUE(channel1_->SetLocalContent(&local_media_content1_, | 836 EXPECT_TRUE(channel1_->SetLocalContent(&local_media_content1_, |
827 CA_OFFER, NULL)); | 837 CA_OFFER, NULL)); |
828 EXPECT_TRUE(media_channel1_->playout()); | 838 if (verify_playout_) { |
| 839 EXPECT_TRUE(media_channel1_->playout()); |
| 840 } |
829 EXPECT_FALSE(media_channel1_->sending()); | 841 EXPECT_FALSE(media_channel1_->sending()); |
830 EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_, | 842 EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_, |
831 CA_OFFER, NULL)); | 843 CA_OFFER, NULL)); |
832 EXPECT_FALSE(media_channel2_->playout()); | 844 if (verify_playout_) { |
| 845 EXPECT_FALSE(media_channel2_->playout()); |
| 846 } |
833 EXPECT_FALSE(media_channel2_->sending()); | 847 EXPECT_FALSE(media_channel2_->sending()); |
834 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, | 848 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, |
835 CA_ANSWER, NULL)); | 849 CA_ANSWER, NULL)); |
836 EXPECT_FALSE(media_channel2_->playout()); | 850 if (verify_playout_) { |
| 851 EXPECT_FALSE(media_channel2_->playout()); |
| 852 } |
837 EXPECT_FALSE(media_channel2_->sending()); | 853 EXPECT_FALSE(media_channel2_->sending()); |
838 transport_controller1_.Connect(&transport_controller2_); | 854 transport_controller1_.Connect(&transport_controller2_); |
839 EXPECT_TRUE(media_channel1_->playout()); | 855 if (verify_playout_) { |
| 856 EXPECT_TRUE(media_channel1_->playout()); |
| 857 } |
840 EXPECT_FALSE(media_channel1_->sending()); | 858 EXPECT_FALSE(media_channel1_->sending()); |
841 EXPECT_FALSE(media_channel2_->playout()); | 859 if (verify_playout_) { |
| 860 EXPECT_FALSE(media_channel2_->playout()); |
| 861 } |
842 EXPECT_FALSE(media_channel2_->sending()); | 862 EXPECT_FALSE(media_channel2_->sending()); |
843 EXPECT_TRUE(channel2_->Enable(true)); | 863 EXPECT_TRUE(channel2_->Enable(true)); |
844 EXPECT_TRUE(media_channel2_->playout()); | 864 if (verify_playout_) { |
| 865 EXPECT_TRUE(media_channel2_->playout()); |
| 866 } |
845 EXPECT_TRUE(media_channel2_->sending()); | 867 EXPECT_TRUE(media_channel2_->sending()); |
846 EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_, | 868 EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_, |
847 CA_ANSWER, NULL)); | 869 CA_ANSWER, NULL)); |
848 EXPECT_TRUE(media_channel1_->playout()); | 870 if (verify_playout_) { |
| 871 EXPECT_TRUE(media_channel1_->playout()); |
| 872 } |
849 EXPECT_TRUE(media_channel1_->sending()); | 873 EXPECT_TRUE(media_channel1_->sending()); |
850 } | 874 } |
851 | 875 |
852 // Test that changing the MediaContentDirection in the local and remote | 876 // Test that changing the MediaContentDirection in the local and remote |
853 // session description start playout and sending at the right time. | 877 // session description start playout and sending at the right time. |
854 void TestMediaContentDirection() { | 878 void TestMediaContentDirection() { |
855 CreateChannels(0, 0); | 879 CreateChannels(0, 0); |
856 typename T::Content content1; | 880 typename T::Content content1; |
857 CreateContent(0, kPcmuCodec, kH264Codec, &content1); | 881 CreateContent(0, kPcmuCodec, kH264Codec, &content1); |
858 typename T::Content content2; | 882 typename T::Content content2; |
859 CreateContent(0, kPcmuCodec, kH264Codec, &content2); | 883 CreateContent(0, kPcmuCodec, kH264Codec, &content2); |
860 // Set |content2| to be InActive. | 884 // Set |content2| to be InActive. |
861 content2.set_direction(cricket::MD_INACTIVE); | 885 content2.set_direction(cricket::MD_INACTIVE); |
862 | 886 |
863 EXPECT_TRUE(channel1_->Enable(true)); | 887 EXPECT_TRUE(channel1_->Enable(true)); |
864 EXPECT_TRUE(channel2_->Enable(true)); | 888 EXPECT_TRUE(channel2_->Enable(true)); |
865 EXPECT_FALSE(media_channel1_->playout()); | 889 if (verify_playout_) { |
| 890 EXPECT_FALSE(media_channel1_->playout()); |
| 891 } |
866 EXPECT_FALSE(media_channel1_->sending()); | 892 EXPECT_FALSE(media_channel1_->sending()); |
867 EXPECT_FALSE(media_channel2_->playout()); | 893 if (verify_playout_) { |
| 894 EXPECT_FALSE(media_channel2_->playout()); |
| 895 } |
868 EXPECT_FALSE(media_channel2_->sending()); | 896 EXPECT_FALSE(media_channel2_->sending()); |
869 | 897 |
870 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); | 898 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); |
871 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); | 899 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); |
872 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); | 900 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); |
873 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); | 901 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); |
874 transport_controller1_.Connect(&transport_controller2_); | 902 transport_controller1_.Connect(&transport_controller2_); |
875 | 903 |
876 EXPECT_TRUE(media_channel1_->playout()); | 904 if (verify_playout_) { |
| 905 EXPECT_TRUE(media_channel1_->playout()); |
| 906 } |
877 EXPECT_FALSE(media_channel1_->sending()); // remote InActive | 907 EXPECT_FALSE(media_channel1_->sending()); // remote InActive |
878 EXPECT_FALSE(media_channel2_->playout()); // local InActive | 908 if (verify_playout_) { |
| 909 EXPECT_FALSE(media_channel2_->playout()); // local InActive |
| 910 } |
879 EXPECT_FALSE(media_channel2_->sending()); // local InActive | 911 EXPECT_FALSE(media_channel2_->sending()); // local InActive |
880 | 912 |
881 // Update |content2| to be RecvOnly. | 913 // Update |content2| to be RecvOnly. |
882 content2.set_direction(cricket::MD_RECVONLY); | 914 content2.set_direction(cricket::MD_RECVONLY); |
883 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); | 915 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); |
884 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); | 916 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); |
885 | 917 |
886 EXPECT_TRUE(media_channel1_->playout()); | 918 if (verify_playout_) { |
| 919 EXPECT_TRUE(media_channel1_->playout()); |
| 920 } |
887 EXPECT_TRUE(media_channel1_->sending()); | 921 EXPECT_TRUE(media_channel1_->sending()); |
888 EXPECT_TRUE(media_channel2_->playout()); // local RecvOnly | 922 if (verify_playout_) { |
| 923 EXPECT_TRUE(media_channel2_->playout()); // local RecvOnly |
| 924 } |
889 EXPECT_FALSE(media_channel2_->sending()); // local RecvOnly | 925 EXPECT_FALSE(media_channel2_->sending()); // local RecvOnly |
890 | 926 |
891 // Update |content2| to be SendRecv. | 927 // Update |content2| to be SendRecv. |
892 content2.set_direction(cricket::MD_SENDRECV); | 928 content2.set_direction(cricket::MD_SENDRECV); |
893 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); | 929 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); |
894 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); | 930 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); |
895 | 931 |
896 EXPECT_TRUE(media_channel1_->playout()); | 932 if (verify_playout_) { |
| 933 EXPECT_TRUE(media_channel1_->playout()); |
| 934 } |
897 EXPECT_TRUE(media_channel1_->sending()); | 935 EXPECT_TRUE(media_channel1_->sending()); |
898 EXPECT_TRUE(media_channel2_->playout()); | 936 if (verify_playout_) { |
| 937 EXPECT_TRUE(media_channel2_->playout()); |
| 938 } |
899 EXPECT_TRUE(media_channel2_->sending()); | 939 EXPECT_TRUE(media_channel2_->sending()); |
900 } | 940 } |
901 | 941 |
902 // Test setting up a call. | 942 // Test setting up a call. |
903 void TestCallSetup() { | 943 void TestCallSetup() { |
904 CreateChannels(0, 0); | 944 CreateChannels(0, 0); |
905 EXPECT_FALSE(channel1_->secure()); | 945 EXPECT_FALSE(channel1_->secure()); |
906 EXPECT_TRUE(SendInitiate()); | 946 EXPECT_TRUE(SendInitiate()); |
907 EXPECT_TRUE(media_channel1_->playout()); | 947 if (verify_playout_) { |
| 948 EXPECT_TRUE(media_channel1_->playout()); |
| 949 } |
908 EXPECT_FALSE(media_channel1_->sending()); | 950 EXPECT_FALSE(media_channel1_->sending()); |
909 EXPECT_TRUE(SendAccept()); | 951 EXPECT_TRUE(SendAccept()); |
910 EXPECT_FALSE(channel1_->secure()); | 952 EXPECT_FALSE(channel1_->secure()); |
911 EXPECT_TRUE(media_channel1_->sending()); | 953 EXPECT_TRUE(media_channel1_->sending()); |
912 EXPECT_EQ(1U, media_channel1_->codecs().size()); | 954 EXPECT_EQ(1U, media_channel1_->codecs().size()); |
913 EXPECT_TRUE(media_channel2_->playout()); | 955 if (verify_playout_) { |
| 956 EXPECT_TRUE(media_channel2_->playout()); |
| 957 } |
914 EXPECT_TRUE(media_channel2_->sending()); | 958 EXPECT_TRUE(media_channel2_->sending()); |
915 EXPECT_EQ(1U, media_channel2_->codecs().size()); | 959 EXPECT_EQ(1U, media_channel2_->codecs().size()); |
916 } | 960 } |
917 | 961 |
918 // Test that we don't crash if packets are sent during call teardown | 962 // Test that we don't crash if packets are sent during call teardown |
919 // when RTCP mux is enabled. This is a regression test against a specific | 963 // when RTCP mux is enabled. This is a regression test against a specific |
920 // race condition that would only occur when a RTCP packet was sent during | 964 // race condition that would only occur when a RTCP packet was sent during |
921 // teardown of a channel on which RTCP mux was enabled. | 965 // teardown of a channel on which RTCP mux was enabled. |
922 void TestCallTeardownRtcpMux() { | 966 void TestCallTeardownRtcpMux() { |
923 class LastWordMediaChannel : public T::MediaChannel { | 967 class LastWordMediaChannel : public T::MediaChannel { |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1775 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1732 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel | 1776 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel |
1733 // should trigger the MediaChannel's OnReadyToSend. | 1777 // should trigger the MediaChannel's OnReadyToSend. |
1734 rtp->SignalReadyToSend(rtp); | 1778 rtp->SignalReadyToSend(rtp); |
1735 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1779 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1736 channel1_->SetReadyToSend(false, false); | 1780 channel1_->SetReadyToSend(false, false); |
1737 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1781 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1738 } | 1782 } |
1739 | 1783 |
1740 protected: | 1784 protected: |
| 1785 // TODO(pbos): Remove playout from all media channels and let renderers mute |
| 1786 // themselves. |
| 1787 const bool verify_playout_; |
1741 cricket::FakeTransportController transport_controller1_; | 1788 cricket::FakeTransportController transport_controller1_; |
1742 cricket::FakeTransportController transport_controller2_; | 1789 cricket::FakeTransportController transport_controller2_; |
1743 cricket::FakeMediaEngine media_engine_; | 1790 cricket::FakeMediaEngine media_engine_; |
1744 // The media channels are owned by the voice channel objects below. | 1791 // The media channels are owned by the voice channel objects below. |
1745 typename T::MediaChannel* media_channel1_; | 1792 typename T::MediaChannel* media_channel1_; |
1746 typename T::MediaChannel* media_channel2_; | 1793 typename T::MediaChannel* media_channel2_; |
1747 rtc::scoped_ptr<typename T::Channel> channel1_; | 1794 rtc::scoped_ptr<typename T::Channel> channel1_; |
1748 rtc::scoped_ptr<typename T::Channel> channel2_; | 1795 rtc::scoped_ptr<typename T::Channel> channel2_; |
1749 typename T::Content local_media_content1_; | 1796 typename T::Content local_media_content1_; |
1750 typename T::Content local_media_content2_; | 1797 typename T::Content local_media_content2_; |
1751 typename T::Content remote_media_content1_; | 1798 typename T::Content remote_media_content1_; |
1752 typename T::Content remote_media_content2_; | 1799 typename T::Content remote_media_content2_; |
1753 // The RTP and RTCP packets to send in the tests. | 1800 // The RTP and RTCP packets to send in the tests. |
1754 std::string rtp_packet_; | 1801 std::string rtp_packet_; |
1755 std::string rtcp_packet_; | 1802 std::string rtcp_packet_; |
1756 int media_info_callbacks1_; | 1803 int media_info_callbacks1_; |
1757 int media_info_callbacks2_; | 1804 int media_info_callbacks2_; |
1758 | 1805 |
1759 uint32 ssrc_; | 1806 uint32 ssrc_; |
1760 typename T::MediaChannel::Error error_; | 1807 typename T::MediaChannel::Error error_; |
1761 }; | 1808 }; |
1762 | 1809 |
1763 | |
1764 template<> | 1810 template<> |
1765 void ChannelTest<VoiceTraits>::CreateContent( | 1811 void ChannelTest<VoiceTraits>::CreateContent( |
1766 int flags, | 1812 int flags, |
1767 const cricket::AudioCodec& audio_codec, | 1813 const cricket::AudioCodec& audio_codec, |
1768 const cricket::VideoCodec& video_codec, | 1814 const cricket::VideoCodec& video_codec, |
1769 cricket::AudioContentDescription* audio) { | 1815 cricket::AudioContentDescription* audio) { |
1770 audio->AddCodec(audio_codec); | 1816 audio->AddCodec(audio_codec); |
1771 audio->set_rtcp_mux((flags & RTCP_MUX) != 0); | 1817 audio->set_rtcp_mux((flags & RTCP_MUX) != 0); |
1772 if (flags & SECURE) { | 1818 if (flags & SECURE) { |
1773 audio->AddCrypto(cricket::CryptoParams( | 1819 audio->AddCrypto(cricket::CryptoParams( |
(...skipping 20 matching lines...) Expand all Loading... |
1794 void ChannelTest<VoiceTraits>::AddLegacyStreamInContent( | 1840 void ChannelTest<VoiceTraits>::AddLegacyStreamInContent( |
1795 uint32 ssrc, int flags, cricket::AudioContentDescription* audio) { | 1841 uint32 ssrc, int flags, cricket::AudioContentDescription* audio) { |
1796 audio->AddLegacyStream(ssrc); | 1842 audio->AddLegacyStream(ssrc); |
1797 } | 1843 } |
1798 | 1844 |
1799 class VoiceChannelTest | 1845 class VoiceChannelTest |
1800 : public ChannelTest<VoiceTraits> { | 1846 : public ChannelTest<VoiceTraits> { |
1801 public: | 1847 public: |
1802 typedef ChannelTest<VoiceTraits> Base; | 1848 typedef ChannelTest<VoiceTraits> Base; |
1803 VoiceChannelTest() | 1849 VoiceChannelTest() |
1804 : Base(kPcmuFrame, sizeof(kPcmuFrame), kRtcpReport, sizeof(kRtcpReport)) { | 1850 : Base(true, |
1805 } | 1851 kPcmuFrame, |
| 1852 sizeof(kPcmuFrame), |
| 1853 kRtcpReport, |
| 1854 sizeof(kRtcpReport)) {} |
1806 }; | 1855 }; |
1807 | 1856 |
1808 // override to add NULL parameter | 1857 // override to add NULL parameter |
1809 template <> | 1858 template <> |
1810 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 1859 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
1811 rtc::Thread* thread, | 1860 rtc::Thread* thread, |
1812 cricket::MediaEngineInterface* engine, | 1861 cricket::MediaEngineInterface* engine, |
1813 cricket::FakeVideoMediaChannel* ch, | 1862 cricket::FakeVideoMediaChannel* ch, |
1814 cricket::TransportController* transport_controller, | 1863 cricket::TransportController* transport_controller, |
1815 bool rtcp) { | 1864 bool rtcp) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 void ChannelTest<VideoTraits>::AddLegacyStreamInContent( | 1910 void ChannelTest<VideoTraits>::AddLegacyStreamInContent( |
1862 uint32 ssrc, int flags, cricket::VideoContentDescription* video) { | 1911 uint32 ssrc, int flags, cricket::VideoContentDescription* video) { |
1863 video->AddLegacyStream(ssrc); | 1912 video->AddLegacyStream(ssrc); |
1864 } | 1913 } |
1865 | 1914 |
1866 class VideoChannelTest | 1915 class VideoChannelTest |
1867 : public ChannelTest<VideoTraits> { | 1916 : public ChannelTest<VideoTraits> { |
1868 public: | 1917 public: |
1869 typedef ChannelTest<VideoTraits> Base; | 1918 typedef ChannelTest<VideoTraits> Base; |
1870 VideoChannelTest() | 1919 VideoChannelTest() |
1871 : Base(kH264Packet, | 1920 : Base(false, |
| 1921 kH264Packet, |
1872 sizeof(kH264Packet), | 1922 sizeof(kH264Packet), |
1873 kRtcpReport, | 1923 kRtcpReport, |
1874 sizeof(kRtcpReport)) {} | 1924 sizeof(kRtcpReport)) {} |
1875 }; | 1925 }; |
1876 | 1926 |
1877 | 1927 |
1878 // VoiceChannelTest | 1928 // VoiceChannelTest |
1879 | 1929 |
1880 TEST_F(VoiceChannelTest, TestInit) { | 1930 TEST_F(VoiceChannelTest, TestInit) { |
1881 Base::TestInit(); | 1931 Base::TestInit(); |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 } | 2599 } |
2550 | 2600 |
2551 | 2601 |
2552 // DataChannelTest | 2602 // DataChannelTest |
2553 | 2603 |
2554 class DataChannelTest | 2604 class DataChannelTest |
2555 : public ChannelTest<DataTraits> { | 2605 : public ChannelTest<DataTraits> { |
2556 public: | 2606 public: |
2557 typedef ChannelTest<DataTraits> | 2607 typedef ChannelTest<DataTraits> |
2558 Base; | 2608 Base; |
2559 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket), | 2609 DataChannelTest() |
2560 kRtcpReport, sizeof(kRtcpReport)) { | 2610 : Base(true, |
2561 } | 2611 kDataPacket, |
| 2612 sizeof(kDataPacket), |
| 2613 kRtcpReport, |
| 2614 sizeof(kRtcpReport)) {} |
2562 }; | 2615 }; |
2563 | 2616 |
2564 // Override to avoid engine channel parameter. | 2617 // Override to avoid engine channel parameter. |
2565 template <> | 2618 template <> |
2566 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( | 2619 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( |
2567 rtc::Thread* thread, | 2620 rtc::Thread* thread, |
2568 cricket::MediaEngineInterface* engine, | 2621 cricket::MediaEngineInterface* engine, |
2569 cricket::FakeDataMediaChannel* ch, | 2622 cricket::FakeDataMediaChannel* ch, |
2570 cricket::TransportController* transport_controller, | 2623 cricket::TransportController* transport_controller, |
2571 bool rtcp) { | 2624 bool rtcp) { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2749 }; | 2802 }; |
2750 rtc::Buffer payload(data, 3); | 2803 rtc::Buffer payload(data, 3); |
2751 cricket::SendDataResult result; | 2804 cricket::SendDataResult result; |
2752 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2805 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
2753 EXPECT_EQ(params.ssrc, | 2806 EXPECT_EQ(params.ssrc, |
2754 media_channel1_->last_sent_data_params().ssrc); | 2807 media_channel1_->last_sent_data_params().ssrc); |
2755 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2808 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
2756 } | 2809 } |
2757 | 2810 |
2758 // TODO(pthatcher): TestSetReceiver? | 2811 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |