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 15 matching lines...) Expand all Loading... |
26 */ | 26 */ |
27 | 27 |
28 #include "talk/media/base/fakemediaengine.h" | 28 #include "talk/media/base/fakemediaengine.h" |
29 #include "talk/media/base/fakertp.h" | 29 #include "talk/media/base/fakertp.h" |
30 #include "talk/media/base/fakescreencapturerfactory.h" | 30 #include "talk/media/base/fakescreencapturerfactory.h" |
31 #include "talk/media/base/fakevideocapturer.h" | 31 #include "talk/media/base/fakevideocapturer.h" |
32 #include "talk/media/base/mediachannel.h" | 32 #include "talk/media/base/mediachannel.h" |
33 #include "talk/media/base/rtpdump.h" | 33 #include "talk/media/base/rtpdump.h" |
34 #include "talk/media/base/screencastid.h" | 34 #include "talk/media/base/screencastid.h" |
35 #include "talk/media/base/testutils.h" | 35 #include "talk/media/base/testutils.h" |
36 #include "webrtc/p2p/base/faketransportcontroller.h" | 36 #include "talk/media/webrtc/fakewebrtccall.h" |
| 37 #include "talk/app/webrtc/mediacontroller.h" |
37 #include "talk/session/media/channel.h" | 38 #include "talk/session/media/channel.h" |
38 #include "webrtc/base/fileutils.h" | 39 #include "webrtc/base/fileutils.h" |
39 #include "webrtc/base/gunit.h" | 40 #include "webrtc/base/gunit.h" |
40 #include "webrtc/base/helpers.h" | 41 #include "webrtc/base/helpers.h" |
41 #include "webrtc/base/logging.h" | 42 #include "webrtc/base/logging.h" |
42 #include "webrtc/base/pathutils.h" | 43 #include "webrtc/base/pathutils.h" |
43 #include "webrtc/base/signalthread.h" | 44 #include "webrtc/base/signalthread.h" |
44 #include "webrtc/base/ssladapter.h" | 45 #include "webrtc/base/ssladapter.h" |
45 #include "webrtc/base/sslidentity.h" | 46 #include "webrtc/base/sslidentity.h" |
46 #include "webrtc/base/window.h" | 47 #include "webrtc/base/window.h" |
| 48 #include "webrtc/p2p/base/faketransportcontroller.h" |
47 | 49 |
48 #define MAYBE_SKIP_TEST(feature) \ | 50 #define MAYBE_SKIP_TEST(feature) \ |
49 if (!(rtc::SSLStreamAdapter::feature())) { \ | 51 if (!(rtc::SSLStreamAdapter::feature())) { \ |
50 LOG(LS_INFO) << "Feature disabled... skipping"; \ | 52 LOG(LS_INFO) << "Feature disabled... skipping"; \ |
51 return; \ | 53 return; \ |
52 } | 54 } |
53 | 55 |
54 using cricket::CA_OFFER; | 56 using cricket::CA_OFFER; |
55 using cricket::CA_PRANSWER; | 57 using cricket::CA_PRANSWER; |
56 using cricket::CA_ANSWER; | 58 using cricket::CA_ANSWER; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 cricket::DataContentDescription, | 114 cricket::DataContentDescription, |
113 cricket::DataCodec, | 115 cricket::DataCodec, |
114 cricket::DataMediaInfo, | 116 cricket::DataMediaInfo, |
115 cricket::DataOptions> {}; | 117 cricket::DataOptions> {}; |
116 | 118 |
117 rtc::StreamInterface* Open(const std::string& path) { | 119 rtc::StreamInterface* Open(const std::string& path) { |
118 return rtc::Filesystem::OpenFile( | 120 return rtc::Filesystem::OpenFile( |
119 rtc::Pathname(path), "wb"); | 121 rtc::Pathname(path), "wb"); |
120 } | 122 } |
121 | 123 |
| 124 class FakeCallFactory : public webrtc::CallFactory { |
| 125 public: |
| 126 webrtc::Call* CreateCall(const webrtc::Call::Config& config) override { |
| 127 return new cricket::FakeCall(config); |
| 128 } |
| 129 }; |
| 130 |
122 // Base class for Voice/VideoChannel tests | 131 // Base class for Voice/VideoChannel tests |
123 template<class T> | 132 template<class T> |
124 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 133 class ChannelTest : public testing::Test, public sigslot::has_slots<> { |
125 public: | 134 public: |
126 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 135 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, |
127 DTLS = 0x10 }; | 136 DTLS = 0x10 }; |
128 | 137 |
129 ChannelTest(bool verify_playout, | 138 ChannelTest(bool verify_playout, |
130 const uint8_t* rtp_data, | 139 const uint8_t* rtp_data, |
131 int rtp_len, | 140 int rtp_len, |
132 const uint8_t* rtcp_data, | 141 const uint8_t* rtcp_data, |
133 int rtcp_len) | 142 int rtcp_len) |
134 : verify_playout_(verify_playout), | 143 : verify_playout_(verify_playout), |
135 transport_controller1_(cricket::ICEROLE_CONTROLLING), | 144 transport_controller1_(cricket::ICEROLE_CONTROLLING), |
136 transport_controller2_(cricket::ICEROLE_CONTROLLED), | 145 transport_controller2_(cricket::ICEROLE_CONTROLLED), |
| 146 media_controller_( |
| 147 webrtc::MediaControllerInterface::Create(new FakeCallFactory(), |
| 148 rtc::Thread::Current(), |
| 149 nullptr)), |
137 media_channel1_(NULL), | 150 media_channel1_(NULL), |
138 media_channel2_(NULL), | 151 media_channel2_(NULL), |
139 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), | 152 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), |
140 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), | 153 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), |
141 media_info_callbacks1_(), | 154 media_info_callbacks1_(), |
142 media_info_callbacks2_() {} | 155 media_info_callbacks2_() {} |
143 | 156 |
144 void CreateChannels(int flags1, int flags2) { | 157 void CreateChannels(int flags1, int flags2) { |
145 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), | 158 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), |
146 new typename T::MediaChannel(NULL, typename T::Options()), | 159 new typename T::MediaChannel(NULL, typename T::Options()), |
147 flags1, flags2, rtc::Thread::Current()); | 160 flags1, flags2, rtc::Thread::Current()); |
148 } | 161 } |
149 void CreateChannels( | 162 void CreateChannels( |
150 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, | 163 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, |
151 int flags1, int flags2, rtc::Thread* thread) { | 164 int flags1, int flags2, rtc::Thread* thread) { |
152 media_channel1_ = ch1; | 165 media_channel1_ = ch1; |
153 media_channel2_ = ch2; | 166 media_channel2_ = ch2; |
154 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, | 167 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, |
155 &transport_controller1_, | 168 &transport_controller1_, |
156 (flags1 & RTCP) != 0)); | 169 (flags1 & RTCP) != 0)); |
157 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, | 170 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, |
158 &transport_controller2_, | 171 &transport_controller2_, |
159 (flags2 & RTCP) != 0)); | 172 (flags2 & RTCP) != 0)); |
| 173 media_controller_->ConnectToSignalSentPacket_w( |
| 174 channel1_->transport_channel()); |
| 175 media_controller_->ConnectToSignalSentPacket_w( |
| 176 channel2_->transport_channel()); |
160 channel1_->SignalMediaMonitor.connect( | 177 channel1_->SignalMediaMonitor.connect( |
161 this, &ChannelTest<T>::OnMediaMonitor); | 178 this, &ChannelTest<T>::OnMediaMonitor); |
162 channel2_->SignalMediaMonitor.connect( | 179 channel2_->SignalMediaMonitor.connect( |
163 this, &ChannelTest<T>::OnMediaMonitor); | 180 this, &ChannelTest<T>::OnMediaMonitor); |
164 if ((flags1 & DTLS) && (flags2 & DTLS)) { | 181 if ((flags1 & DTLS) && (flags2 & DTLS)) { |
165 flags1 = (flags1 & ~SECURE); | 182 flags1 = (flags1 & ~SECURE); |
166 flags2 = (flags2 & ~SECURE); | 183 flags2 = (flags2 & ~SECURE); |
167 } | 184 } |
168 CreateContent(flags1, kPcmuCodec, kH264Codec, | 185 CreateContent(flags1, kPcmuCodec, kH264Codec, |
169 &local_media_content1_); | 186 &local_media_content1_); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Calling "_w" method here is ok since we only use one thread for this test | 304 // Calling "_w" method here is ok since we only use one thread for this test |
288 cricket::FakeTransport* GetTransport1() { | 305 cricket::FakeTransport* GetTransport1() { |
289 return transport_controller1_.GetTransport_w(channel1_->content_name()); | 306 return transport_controller1_.GetTransport_w(channel1_->content_name()); |
290 } | 307 } |
291 cricket::FakeTransport* GetTransport2() { | 308 cricket::FakeTransport* GetTransport2() { |
292 return transport_controller2_.GetTransport_w(channel2_->content_name()); | 309 return transport_controller2_.GetTransport_w(channel2_->content_name()); |
293 } | 310 } |
294 | 311 |
295 bool SendRtp1() { | 312 bool SendRtp1() { |
296 return media_channel1_->SendRtp(rtp_packet_.c_str(), | 313 return media_channel1_->SendRtp(rtp_packet_.c_str(), |
297 static_cast<int>(rtp_packet_.size())); | 314 static_cast<int>(rtp_packet_.size()), |
| 315 rtc::PacketOptions()); |
| 316 } |
| 317 bool SendRtpWithOptions1(const rtc::PacketOptions& options) { |
| 318 return media_channel1_->SendRtp( |
| 319 rtp_packet_.c_str(), static_cast<int>(rtp_packet_.size()), options); |
298 } | 320 } |
299 bool SendRtp2() { | 321 bool SendRtp2() { |
300 return media_channel2_->SendRtp(rtp_packet_.c_str(), | 322 return media_channel2_->SendRtp(rtp_packet_.c_str(), |
301 static_cast<int>(rtp_packet_.size())); | 323 static_cast<int>(rtp_packet_.size()), |
| 324 rtc::PacketOptions()); |
| 325 } |
| 326 bool SendRtpWithOptions2(const rtc::PacketOptions& options) { |
| 327 return media_channel2_->SendRtp( |
| 328 rtp_packet_.c_str(), static_cast<int>(rtp_packet_.size()), options); |
302 } | 329 } |
303 bool SendRtcp1() { | 330 bool SendRtcp1() { |
304 return media_channel1_->SendRtcp(rtcp_packet_.c_str(), | 331 return media_channel1_->SendRtcp(rtcp_packet_.c_str(), |
305 static_cast<int>(rtcp_packet_.size())); | 332 static_cast<int>(rtcp_packet_.size())); |
306 } | 333 } |
307 bool SendRtcp2() { | 334 bool SendRtcp2() { |
308 return media_channel2_->SendRtcp(rtcp_packet_.c_str(), | 335 return media_channel2_->SendRtcp(rtcp_packet_.c_str(), |
309 static_cast<int>(rtcp_packet_.size())); | 336 static_cast<int>(rtcp_packet_.size())); |
310 } | 337 } |
311 // Methods to send custom data. | 338 // Methods to send custom data. |
312 bool SendCustomRtp1(uint32_t ssrc, int sequence_number, int pl_type = -1) { | 339 bool SendCustomRtp1(uint32_t ssrc, int sequence_number, int pl_type = -1) { |
313 std::string data(CreateRtpData(ssrc, sequence_number, pl_type)); | 340 std::string data(CreateRtpData(ssrc, sequence_number, pl_type)); |
314 return media_channel1_->SendRtp(data.c_str(), | 341 return media_channel1_->SendRtp(data.c_str(), static_cast<int>(data.size()), |
315 static_cast<int>(data.size())); | 342 rtc::PacketOptions()); |
316 } | 343 } |
317 bool SendCustomRtp2(uint32_t ssrc, int sequence_number, int pl_type = -1) { | 344 bool SendCustomRtp2(uint32_t ssrc, int sequence_number, int pl_type = -1) { |
318 std::string data(CreateRtpData(ssrc, sequence_number, pl_type)); | 345 std::string data(CreateRtpData(ssrc, sequence_number, pl_type)); |
319 return media_channel2_->SendRtp(data.c_str(), | 346 return media_channel2_->SendRtp(data.c_str(), static_cast<int>(data.size()), |
320 static_cast<int>(data.size())); | 347 rtc::PacketOptions()); |
321 } | 348 } |
322 bool SendCustomRtcp1(uint32_t ssrc) { | 349 bool SendCustomRtcp1(uint32_t ssrc) { |
323 std::string data(CreateRtcpData(ssrc)); | 350 std::string data(CreateRtcpData(ssrc)); |
324 return media_channel1_->SendRtcp(data.c_str(), | 351 return media_channel1_->SendRtcp(data.c_str(), |
325 static_cast<int>(data.size())); | 352 static_cast<int>(data.size())); |
326 } | 353 } |
327 bool SendCustomRtcp2(uint32_t ssrc) { | 354 bool SendCustomRtcp2(uint32_t ssrc) { |
328 std::string data(CreateRtcpData(ssrc)); | 355 std::string data(CreateRtcpData(ssrc)); |
329 return media_channel2_->SendRtcp(data.c_str(), | 356 return media_channel2_->SendRtcp(data.c_str(), |
330 static_cast<int>(data.size())); | 357 static_cast<int>(data.size())); |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 | 977 |
951 // Test that we don't crash if packets are sent during call teardown | 978 // Test that we don't crash if packets are sent during call teardown |
952 // when RTCP mux is enabled. This is a regression test against a specific | 979 // when RTCP mux is enabled. This is a regression test against a specific |
953 // race condition that would only occur when a RTCP packet was sent during | 980 // race condition that would only occur when a RTCP packet was sent during |
954 // teardown of a channel on which RTCP mux was enabled. | 981 // teardown of a channel on which RTCP mux was enabled. |
955 void TestCallTeardownRtcpMux() { | 982 void TestCallTeardownRtcpMux() { |
956 class LastWordMediaChannel : public T::MediaChannel { | 983 class LastWordMediaChannel : public T::MediaChannel { |
957 public: | 984 public: |
958 LastWordMediaChannel() : T::MediaChannel(NULL, typename T::Options()) {} | 985 LastWordMediaChannel() : T::MediaChannel(NULL, typename T::Options()) {} |
959 ~LastWordMediaChannel() { | 986 ~LastWordMediaChannel() { |
960 T::MediaChannel::SendRtp(kPcmuFrame, sizeof(kPcmuFrame)); | 987 T::MediaChannel::SendRtp(kPcmuFrame, sizeof(kPcmuFrame), |
| 988 rtc::PacketOptions()); |
961 T::MediaChannel::SendRtcp(kRtcpReport, sizeof(kRtcpReport)); | 989 T::MediaChannel::SendRtcp(kRtcpReport, sizeof(kRtcpReport)); |
962 } | 990 } |
963 }; | 991 }; |
964 CreateChannels(new LastWordMediaChannel(), new LastWordMediaChannel(), | 992 CreateChannels(new LastWordMediaChannel(), new LastWordMediaChannel(), |
965 RTCP | RTCP_MUX, RTCP | RTCP_MUX, | 993 RTCP | RTCP_MUX, RTCP | RTCP_MUX, |
966 rtc::Thread::Current()); | 994 rtc::Thread::Current()); |
967 EXPECT_TRUE(SendInitiate()); | 995 EXPECT_TRUE(SendInitiate()); |
968 EXPECT_TRUE(SendAccept()); | 996 EXPECT_TRUE(SendAccept()); |
969 EXPECT_TRUE(SendTerminate()); | 997 EXPECT_TRUE(SendTerminate()); |
970 } | 998 } |
971 | 999 |
972 // Send voice RTP data to the other side and ensure it gets there. | 1000 // Send voice RTP data to the other side and ensure it gets there. |
973 void SendRtpToRtp() { | 1001 void SendRtpToRtp() { |
974 CreateChannels(0, 0); | 1002 CreateChannels(0, 0); |
975 EXPECT_TRUE(SendInitiate()); | 1003 EXPECT_TRUE(SendInitiate()); |
976 EXPECT_TRUE(SendAccept()); | 1004 EXPECT_TRUE(SendAccept()); |
977 ASSERT_TRUE(GetTransport1()); | 1005 ASSERT_TRUE(GetTransport1()); |
978 ASSERT_TRUE(GetTransport2()); | 1006 ASSERT_TRUE(GetTransport2()); |
979 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1007 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
980 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1008 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
981 EXPECT_TRUE(SendRtp1()); | 1009 EXPECT_TRUE(SendRtp1()); |
982 EXPECT_TRUE(SendRtp2()); | 1010 EXPECT_TRUE(SendRtp2()); |
983 EXPECT_TRUE(CheckRtp1()); | 1011 EXPECT_TRUE(CheckRtp1()); |
984 EXPECT_TRUE(CheckRtp2()); | 1012 EXPECT_TRUE(CheckRtp2()); |
985 EXPECT_TRUE(CheckNoRtp1()); | 1013 EXPECT_TRUE(CheckNoRtp1()); |
986 EXPECT_TRUE(CheckNoRtp2()); | 1014 EXPECT_TRUE(CheckNoRtp2()); |
987 } | 1015 } |
988 | 1016 |
| 1017 // Send voice RTP data (with packet options) to the other side and ensure it |
| 1018 // gets there. |
| 1019 void SendRtpToRtpWithPacketIds() { |
| 1020 CreateChannels(0, 0); |
| 1021 EXPECT_TRUE(SendInitiate()); |
| 1022 EXPECT_TRUE(SendAccept()); |
| 1023 ASSERT_TRUE(GetTransport1()); |
| 1024 ASSERT_TRUE(GetTransport2()); |
| 1025 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
| 1026 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
| 1027 rtc::PacketOptions options1; |
| 1028 options1.packet_id = 10; |
| 1029 rtc::PacketOptions options2; |
| 1030 options2.packet_id = 30; |
| 1031 EXPECT_TRUE(SendRtpWithOptions1(options1)); |
| 1032 cricket::FakeCall* call = |
| 1033 static_cast<cricket::FakeCall*>(media_controller_->call_w()); |
| 1034 EXPECT_EQ(options1.packet_id, call->last_sent_packet().packet_id); |
| 1035 EXPECT_TRUE(SendRtpWithOptions2(options2)); |
| 1036 EXPECT_EQ(options2.packet_id, call->last_sent_packet().packet_id); |
| 1037 EXPECT_TRUE(CheckRtp1()); |
| 1038 EXPECT_TRUE(CheckRtp2()); |
| 1039 EXPECT_TRUE(CheckNoRtp1()); |
| 1040 EXPECT_TRUE(CheckNoRtp2()); |
| 1041 } |
| 1042 |
989 // Check that RTCP is not transmitted if both sides don't support RTCP. | 1043 // Check that RTCP is not transmitted if both sides don't support RTCP. |
990 void SendNoRtcpToNoRtcp() { | 1044 void SendNoRtcpToNoRtcp() { |
991 CreateChannels(0, 0); | 1045 CreateChannels(0, 0); |
992 EXPECT_TRUE(SendInitiate()); | 1046 EXPECT_TRUE(SendInitiate()); |
993 EXPECT_TRUE(SendAccept()); | 1047 EXPECT_TRUE(SendAccept()); |
994 ASSERT_TRUE(GetTransport1()); | 1048 ASSERT_TRUE(GetTransport1()); |
995 ASSERT_TRUE(GetTransport2()); | 1049 ASSERT_TRUE(GetTransport2()); |
996 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1050 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
997 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1051 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
998 EXPECT_FALSE(SendRtcp1()); | 1052 EXPECT_FALSE(SendRtcp1()); |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 EXPECT_FALSE(channel2_->secure()); | 1756 EXPECT_FALSE(channel2_->secure()); |
1703 EXPECT_TRUE(SendInitiate()); | 1757 EXPECT_TRUE(SendInitiate()); |
1704 EXPECT_TRUE(SendAccept()); | 1758 EXPECT_TRUE(SendAccept()); |
1705 EXPECT_TRUE(channel1_->secure()); | 1759 EXPECT_TRUE(channel1_->secure()); |
1706 EXPECT_TRUE(channel2_->secure()); | 1760 EXPECT_TRUE(channel2_->secure()); |
1707 channel2_->srtp_filter()->set_signal_silent_time(250); | 1761 channel2_->srtp_filter()->set_signal_silent_time(250); |
1708 channel2_->srtp_filter()->SignalSrtpError.connect( | 1762 channel2_->srtp_filter()->SignalSrtpError.connect( |
1709 &error_handler, &SrtpErrorHandler::OnSrtpError); | 1763 &error_handler, &SrtpErrorHandler::OnSrtpError); |
1710 | 1764 |
1711 // Testing failures in sending packets. | 1765 // Testing failures in sending packets. |
1712 EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket))); | 1766 EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket), |
| 1767 rtc::PacketOptions())); |
1713 // The first failure will trigger an error. | 1768 // The first failure will trigger an error. |
1714 EXPECT_EQ_WAIT(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_, 500); | 1769 EXPECT_EQ_WAIT(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_, 500); |
1715 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); | 1770 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); |
1716 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; | 1771 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; |
1717 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; | 1772 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; |
1718 // The next 250 ms failures will not trigger an error. | 1773 // The next 250 ms failures will not trigger an error. |
1719 EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket))); | 1774 EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket), |
| 1775 rtc::PacketOptions())); |
1720 // Wait for a while to ensure no message comes in. | 1776 // Wait for a while to ensure no message comes in. |
1721 rtc::Thread::Current()->ProcessMessages(200); | 1777 rtc::Thread::Current()->ProcessMessages(200); |
1722 EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_handler.error_); | 1778 EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_handler.error_); |
1723 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); | 1779 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); |
1724 // Wait for a little more - the error will be triggered again. | 1780 // Wait for a little more - the error will be triggered again. |
1725 rtc::Thread::Current()->ProcessMessages(200); | 1781 rtc::Thread::Current()->ProcessMessages(200); |
1726 EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket))); | 1782 EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket), |
| 1783 rtc::PacketOptions())); |
1727 EXPECT_EQ_WAIT(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_, 500); | 1784 EXPECT_EQ_WAIT(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_, 500); |
1728 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); | 1785 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); |
1729 | 1786 |
1730 // Testing failures in receiving packets. | 1787 // Testing failures in receiving packets. |
1731 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; | 1788 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; |
1732 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; | 1789 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; |
1733 | 1790 |
1734 cricket::TransportChannel* transport_channel = | 1791 cricket::TransportChannel* transport_channel = |
1735 channel2_->transport_channel(); | 1792 channel2_->transport_channel(); |
1736 transport_channel->SignalReadPacket( | 1793 transport_channel->SignalReadPacket( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1841 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1785 } | 1842 } |
1786 | 1843 |
1787 protected: | 1844 protected: |
1788 // TODO(pbos): Remove playout from all media channels and let renderers mute | 1845 // TODO(pbos): Remove playout from all media channels and let renderers mute |
1789 // themselves. | 1846 // themselves. |
1790 const bool verify_playout_; | 1847 const bool verify_playout_; |
1791 cricket::FakeTransportController transport_controller1_; | 1848 cricket::FakeTransportController transport_controller1_; |
1792 cricket::FakeTransportController transport_controller2_; | 1849 cricket::FakeTransportController transport_controller2_; |
1793 cricket::FakeMediaEngine media_engine_; | 1850 cricket::FakeMediaEngine media_engine_; |
| 1851 rtc::scoped_ptr<webrtc::MediaControllerInterface> media_controller_; |
1794 // The media channels are owned by the voice channel objects below. | 1852 // The media channels are owned by the voice channel objects below. |
1795 typename T::MediaChannel* media_channel1_; | 1853 typename T::MediaChannel* media_channel1_; |
1796 typename T::MediaChannel* media_channel2_; | 1854 typename T::MediaChannel* media_channel2_; |
1797 rtc::scoped_ptr<typename T::Channel> channel1_; | 1855 rtc::scoped_ptr<typename T::Channel> channel1_; |
1798 rtc::scoped_ptr<typename T::Channel> channel2_; | 1856 rtc::scoped_ptr<typename T::Channel> channel2_; |
1799 typename T::Content local_media_content1_; | 1857 typename T::Content local_media_content1_; |
1800 typename T::Content local_media_content2_; | 1858 typename T::Content local_media_content2_; |
1801 typename T::Content remote_media_content1_; | 1859 typename T::Content remote_media_content1_; |
1802 typename T::Content remote_media_content2_; | 1860 typename T::Content remote_media_content2_; |
1803 // The RTP and RTCP packets to send in the tests. | 1861 // The RTP and RTCP packets to send in the tests. |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2529 } | 2587 } |
2530 | 2588 |
2531 TEST_F(VideoChannelTest, TestOnReadyToSend) { | 2589 TEST_F(VideoChannelTest, TestOnReadyToSend) { |
2532 Base::TestOnReadyToSend(); | 2590 Base::TestOnReadyToSend(); |
2533 } | 2591 } |
2534 | 2592 |
2535 TEST_F(VideoChannelTest, TestOnReadyToSendWithRtcpMux) { | 2593 TEST_F(VideoChannelTest, TestOnReadyToSendWithRtcpMux) { |
2536 Base::TestOnReadyToSendWithRtcpMux(); | 2594 Base::TestOnReadyToSendWithRtcpMux(); |
2537 } | 2595 } |
2538 | 2596 |
| 2597 TEST_F(VideoChannelTest, OnSentPacketIsCalled) { |
| 2598 Base::SendRtpToRtpWithPacketIds(); |
| 2599 } |
| 2600 |
2539 TEST_F(VideoChannelTest, TestApplyViewRequest) { | 2601 TEST_F(VideoChannelTest, TestApplyViewRequest) { |
2540 CreateChannels(0, 0); | 2602 CreateChannels(0, 0); |
2541 cricket::StreamParams stream2; | 2603 cricket::StreamParams stream2; |
2542 stream2.id = "stream2"; | 2604 stream2.id = "stream2"; |
2543 stream2.ssrcs.push_back(2222); | 2605 stream2.ssrcs.push_back(2222); |
2544 local_media_content1_.AddStream(stream2); | 2606 local_media_content1_.AddStream(stream2); |
2545 | 2607 |
2546 EXPECT_TRUE(SendInitiate()); | 2608 EXPECT_TRUE(SendInitiate()); |
2547 EXPECT_TRUE(SendAccept()); | 2609 EXPECT_TRUE(SendAccept()); |
2548 | 2610 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2802 }; | 2864 }; |
2803 rtc::Buffer payload(data, 3); | 2865 rtc::Buffer payload(data, 3); |
2804 cricket::SendDataResult result; | 2866 cricket::SendDataResult result; |
2805 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2867 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
2806 EXPECT_EQ(params.ssrc, | 2868 EXPECT_EQ(params.ssrc, |
2807 media_channel1_->last_sent_data_params().ssrc); | 2869 media_channel1_->last_sent_data_params().ssrc); |
2808 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2870 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
2809 } | 2871 } |
2810 | 2872 |
2811 // TODO(pthatcher): TestSetReceiver? | 2873 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |