Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: webrtc/pc/channel_unittest.cc

Issue 2626023005: Revert of Refactoring of RTCP options in BaseChannel. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/pc/channel.cc ('k') | webrtc/pc/channelmanager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 cricket::FakeDataMediaChannel, 88 cricket::FakeDataMediaChannel,
89 cricket::DataContentDescription, 89 cricket::DataContentDescription,
90 cricket::DataCodec, 90 cricket::DataCodec,
91 cricket::DataMediaInfo, 91 cricket::DataMediaInfo,
92 cricket::DataOptions> {}; 92 cricket::DataOptions> {};
93 93
94 // Base class for Voice/Video/RtpDataChannel tests 94 // Base class for Voice/Video/RtpDataChannel tests
95 template<class T> 95 template<class T>
96 class ChannelTest : public testing::Test, public sigslot::has_slots<> { 96 class ChannelTest : public testing::Test, public sigslot::has_slots<> {
97 public: 97 public:
98 enum Flags { 98 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8,
99 RTCP_MUX = 0x1, 99 DTLS = 0x10, GCM_CIPHER = 0x20 };
100 RTCP_MUX_REQUIRED = 0x2,
101 SECURE = 0x4,
102 SSRC_MUX = 0x8,
103 DTLS = 0x10,
104 GCM_CIPHER = 0x20
105 };
106 100
107 ChannelTest(bool verify_playout, 101 ChannelTest(bool verify_playout,
108 rtc::ArrayView<const uint8_t> rtp_data, 102 rtc::ArrayView<const uint8_t> rtp_data,
109 rtc::ArrayView<const uint8_t> rtcp_data, 103 rtc::ArrayView<const uint8_t> rtcp_data,
110 NetworkIsWorker network_is_worker) 104 NetworkIsWorker network_is_worker)
111 : verify_playout_(verify_playout), 105 : verify_playout_(verify_playout),
112 media_channel1_(NULL), 106 media_channel1_(NULL),
113 media_channel2_(NULL), 107 media_channel2_(NULL),
114 rtp_packet_(rtp_data.data(), rtp_data.size()), 108 rtp_packet_(rtp_data.data(), rtp_data.size()),
115 rtcp_packet_(rtcp_data.data(), rtcp_data.size()), 109 rtcp_packet_(rtcp_data.data(), rtcp_data.size()),
(...skipping 15 matching lines...) Expand all
131 125
132 void CreateChannels(int flags1, int flags2) { 126 void CreateChannels(int flags1, int flags2) {
133 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), 127 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()),
134 new typename T::MediaChannel(NULL, typename T::Options()), 128 new typename T::MediaChannel(NULL, typename T::Options()),
135 flags1, flags2); 129 flags1, flags2);
136 } 130 }
137 void CreateChannels(typename T::MediaChannel* ch1, 131 void CreateChannels(typename T::MediaChannel* ch1,
138 typename T::MediaChannel* ch2, 132 typename T::MediaChannel* ch2,
139 int flags1, 133 int flags1,
140 int flags2) { 134 int flags2) {
141 // Make sure RTCP_MUX_REQUIRED isn't set without RTCP_MUX.
142 ASSERT_NE(RTCP_MUX_REQUIRED, flags1 & (RTCP_MUX | RTCP_MUX_REQUIRED));
143 ASSERT_NE(RTCP_MUX_REQUIRED, flags2 & (RTCP_MUX | RTCP_MUX_REQUIRED));
144 rtc::Thread* worker_thread = rtc::Thread::Current(); 135 rtc::Thread* worker_thread = rtc::Thread::Current();
145 media_channel1_ = ch1; 136 media_channel1_ = ch1;
146 media_channel2_ = ch2; 137 media_channel2_ = ch2;
147 channel1_.reset( 138 channel1_.reset(
148 CreateChannel(worker_thread, network_thread_, &media_engine_, ch1, 139 CreateChannel(worker_thread, network_thread_, &media_engine_, ch1,
149 transport_controller1_.get(), flags1)); 140 transport_controller1_.get(), flags1));
150 channel2_.reset( 141 channel2_.reset(
151 CreateChannel(worker_thread, network_thread_, &media_engine_, ch2, 142 CreateChannel(worker_thread, network_thread_, &media_engine_, ch2,
152 transport_controller2_.get(), flags2)); 143 transport_controller2_.get(), flags2));
153 channel1_->SignalMediaMonitor.connect(this, 144 channel1_->SignalMediaMonitor.connect(this,
154 &ChannelTest<T>::OnMediaMonitor1); 145 &ChannelTest<T>::OnMediaMonitor1);
155 channel2_->SignalMediaMonitor.connect(this, 146 channel2_->SignalMediaMonitor.connect(this,
156 &ChannelTest<T>::OnMediaMonitor2); 147 &ChannelTest<T>::OnMediaMonitor2);
157 channel1_->SignalRtcpMuxFullyActive.connect( 148 channel1_->SignalDestroyRtcpTransport.connect(
158 transport_controller1_.get(), 149 transport_controller1_.get(),
159 &cricket::FakeTransportController::DestroyRtcpTransport); 150 &cricket::FakeTransportController::DestroyRtcpTransport);
160 channel2_->SignalRtcpMuxFullyActive.connect( 151 channel2_->SignalDestroyRtcpTransport.connect(
161 transport_controller2_.get(), 152 transport_controller2_.get(),
162 &cricket::FakeTransportController::DestroyRtcpTransport); 153 &cricket::FakeTransportController::DestroyRtcpTransport);
163 if ((flags1 & DTLS) && (flags2 & DTLS)) { 154 if ((flags1 & DTLS) && (flags2 & DTLS)) {
164 flags1 = (flags1 & ~SECURE); 155 flags1 = (flags1 & ~SECURE);
165 flags2 = (flags2 & ~SECURE); 156 flags2 = (flags2 & ~SECURE);
166 } 157 }
167 CreateContent(flags1, kPcmuCodec, kH264Codec, 158 CreateContent(flags1, kPcmuCodec, kH264Codec,
168 &local_media_content1_); 159 &local_media_content1_);
169 CreateContent(flags2, kPcmuCodec, kH264Codec, 160 CreateContent(flags2, kPcmuCodec, kH264Codec,
170 &local_media_content2_); 161 &local_media_content2_);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 rtc::Thread* network_thread, 194 rtc::Thread* network_thread,
204 cricket::MediaEngineInterface* engine, 195 cricket::MediaEngineInterface* engine,
205 typename T::MediaChannel* ch, 196 typename T::MediaChannel* ch,
206 cricket::TransportController* transport_controller, 197 cricket::TransportController* transport_controller,
207 int flags) { 198 int flags) {
208 rtc::Thread* signaling_thread = 199 rtc::Thread* signaling_thread =
209 transport_controller ? transport_controller->signaling_thread() 200 transport_controller ? transport_controller->signaling_thread()
210 : nullptr; 201 : nullptr;
211 typename T::Channel* channel = new typename T::Channel( 202 typename T::Channel* channel = new typename T::Channel(
212 worker_thread, network_thread, signaling_thread, engine, ch, 203 worker_thread, network_thread, signaling_thread, engine, ch,
213 cricket::CN_AUDIO, (flags & RTCP_MUX_REQUIRED) != 0, 204 cricket::CN_AUDIO, (flags & RTCP) != 0, (flags & SECURE) != 0);
214 (flags & SECURE) != 0);
215 rtc::CryptoOptions crypto_options; 205 rtc::CryptoOptions crypto_options;
216 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; 206 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0;
217 channel->SetCryptoOptions(crypto_options); 207 channel->SetCryptoOptions(crypto_options);
218 cricket::TransportChannel* rtp_transport = 208 cricket::TransportChannel* rtp_transport =
219 transport_controller->CreateTransportChannel( 209 transport_controller->CreateTransportChannel(
220 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); 210 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP);
221 cricket::TransportChannel* rtcp_transport = nullptr; 211 cricket::TransportChannel* rtcp_transport = nullptr;
222 if (channel->NeedsRtcpTransport()) { 212 if (channel->NeedsRtcpTransport()) {
223 rtcp_transport = transport_controller->CreateTransportChannel( 213 rtcp_transport = transport_controller->CreateTransportChannel(
224 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); 214 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 EXPECT_EQ(0U, media_channel1_->codecs().size()); 522 EXPECT_EQ(0U, media_channel1_->codecs().size());
533 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); 523 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL));
534 ASSERT_EQ(1U, media_channel1_->codecs().size()); 524 ASSERT_EQ(1U, media_channel1_->codecs().size());
535 EXPECT_TRUE(CodecMatches(content.codecs()[0], 525 EXPECT_TRUE(CodecMatches(content.codecs()[0],
536 media_channel1_->codecs()[0])); 526 media_channel1_->codecs()[0]));
537 } 527 }
538 528
539 // Test that SetLocalContent and SetRemoteContent properly set RTCP 529 // Test that SetLocalContent and SetRemoteContent properly set RTCP
540 // mux. 530 // mux.
541 void TestSetContentsRtcpMux() { 531 void TestSetContentsRtcpMux() {
542 CreateChannels(0, 0); 532 CreateChannels(RTCP, RTCP);
543 EXPECT_TRUE(channel1_->rtcp_transport() != NULL); 533 EXPECT_TRUE(channel1_->rtcp_transport() != NULL);
544 EXPECT_TRUE(channel2_->rtcp_transport() != NULL); 534 EXPECT_TRUE(channel2_->rtcp_transport() != NULL);
545 typename T::Content content; 535 typename T::Content content;
546 CreateContent(0, kPcmuCodec, kH264Codec, &content); 536 CreateContent(0, kPcmuCodec, kH264Codec, &content);
547 // Both sides agree on mux. Should no longer be a separate RTCP channel. 537 // Both sides agree on mux. Should no longer be a separate RTCP channel.
548 content.set_rtcp_mux(true); 538 content.set_rtcp_mux(true);
549 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); 539 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL));
550 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); 540 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL));
551 EXPECT_TRUE(channel1_->rtcp_transport() == NULL); 541 EXPECT_TRUE(channel1_->rtcp_transport() == NULL);
552 // Only initiator supports mux. Should still have a separate RTCP channel. 542 // Only initiator supports mux. Should still have a separate RTCP channel.
553 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); 543 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL));
554 content.set_rtcp_mux(false); 544 content.set_rtcp_mux(false);
555 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); 545 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL));
556 EXPECT_TRUE(channel2_->rtcp_transport() != NULL); 546 EXPECT_TRUE(channel2_->rtcp_transport() != NULL);
557 } 547 }
558 548
559 // Test that SetLocalContent and SetRemoteContent properly set RTCP 549 // Test that SetLocalContent and SetRemoteContent properly set RTCP
560 // mux when a provisional answer is received. 550 // mux when a provisional answer is received.
561 void TestSetContentsRtcpMuxWithPrAnswer() { 551 void TestSetContentsRtcpMuxWithPrAnswer() {
562 CreateChannels(0, 0); 552 CreateChannels(RTCP, RTCP);
563 EXPECT_TRUE(channel1_->rtcp_transport() != NULL); 553 EXPECT_TRUE(channel1_->rtcp_transport() != NULL);
564 EXPECT_TRUE(channel2_->rtcp_transport() != NULL); 554 EXPECT_TRUE(channel2_->rtcp_transport() != NULL);
565 typename T::Content content; 555 typename T::Content content;
566 CreateContent(0, kPcmuCodec, kH264Codec, &content); 556 CreateContent(0, kPcmuCodec, kH264Codec, &content);
567 content.set_rtcp_mux(true); 557 content.set_rtcp_mux(true);
568 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); 558 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL));
569 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_PRANSWER, NULL)); 559 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_PRANSWER, NULL));
570 EXPECT_TRUE(channel1_->rtcp_transport() != NULL); 560 EXPECT_TRUE(channel1_->rtcp_transport() != NULL);
571 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); 561 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL));
572 // Both sides agree on mux. Should no longer be a separate RTCP channel. 562 // Both sides agree on mux. Should no longer be a separate RTCP channel.
573 EXPECT_TRUE(channel1_->rtcp_transport() == NULL); 563 EXPECT_TRUE(channel1_->rtcp_transport() == NULL);
574 // Only initiator supports mux. Should still have a separate RTCP channel. 564 // Only initiator supports mux. Should still have a separate RTCP channel.
575 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); 565 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL));
576 content.set_rtcp_mux(false); 566 content.set_rtcp_mux(false);
577 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_PRANSWER, NULL)); 567 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_PRANSWER, NULL));
578 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); 568 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL));
579 EXPECT_TRUE(channel2_->rtcp_transport() != NULL); 569 EXPECT_TRUE(channel2_->rtcp_transport() != NULL);
580 } 570 }
581 571
582 // Test that SetRemoteContent properly deals with a content update. 572 // Test that SetRemoteContent properly deals with a content update.
583 void TestSetRemoteContentUpdate() { 573 void TestSetRemoteContentUpdate() {
584 CreateChannels(0, 0); 574 CreateChannels(0, 0);
585 typename T::Content content; 575 typename T::Content content;
586 CreateContent(RTCP_MUX | SECURE, kPcmuCodec, kH264Codec, &content); 576 CreateContent(RTCP | RTCP_MUX | SECURE,
577 kPcmuCodec, kH264Codec,
578 &content);
587 EXPECT_EQ(0U, media_channel1_->codecs().size()); 579 EXPECT_EQ(0U, media_channel1_->codecs().size());
588 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); 580 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL));
589 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); 581 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL));
590 ASSERT_EQ(1U, media_channel1_->codecs().size()); 582 ASSERT_EQ(1U, media_channel1_->codecs().size());
591 EXPECT_TRUE(CodecMatches(content.codecs()[0], 583 EXPECT_TRUE(CodecMatches(content.codecs()[0],
592 media_channel1_->codecs()[0])); 584 media_channel1_->codecs()[0]));
593 // Now update with other codecs. 585 // Now update with other codecs.
594 typename T::Content update_content; 586 typename T::Content update_content;
595 update_content.set_partial(true); 587 update_content.set_partial(true);
596 CreateContent(0, kIsacCodec, kH264SvcCodec, 588 CreateContent(0, kIsacCodec, kH264SvcCodec,
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 class LastWordMediaChannel : public T::MediaChannel { 1017 class LastWordMediaChannel : public T::MediaChannel {
1026 public: 1018 public:
1027 LastWordMediaChannel() : T::MediaChannel(NULL, typename T::Options()) {} 1019 LastWordMediaChannel() : T::MediaChannel(NULL, typename T::Options()) {}
1028 ~LastWordMediaChannel() { 1020 ~LastWordMediaChannel() {
1029 T::MediaChannel::SendRtp(kPcmuFrame, sizeof(kPcmuFrame), 1021 T::MediaChannel::SendRtp(kPcmuFrame, sizeof(kPcmuFrame),
1030 rtc::PacketOptions()); 1022 rtc::PacketOptions());
1031 T::MediaChannel::SendRtcp(kRtcpReport, sizeof(kRtcpReport)); 1023 T::MediaChannel::SendRtcp(kRtcpReport, sizeof(kRtcpReport));
1032 } 1024 }
1033 }; 1025 };
1034 CreateChannels(new LastWordMediaChannel(), new LastWordMediaChannel(), 1026 CreateChannels(new LastWordMediaChannel(), new LastWordMediaChannel(),
1035 RTCP_MUX, RTCP_MUX); 1027 RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1036 EXPECT_TRUE(SendInitiate()); 1028 EXPECT_TRUE(SendInitiate());
1037 EXPECT_TRUE(SendAccept()); 1029 EXPECT_TRUE(SendAccept());
1038 EXPECT_TRUE(SendTerminate()); 1030 EXPECT_TRUE(SendTerminate());
1039 } 1031 }
1040 1032
1041 // Send voice RTP data to the other side and ensure it gets there. 1033 // Send voice RTP data to the other side and ensure it gets there.
1042 void SendRtpToRtp() { 1034 void SendRtpToRtp() {
1043 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); 1035 CreateChannels(0, 0);
1044 EXPECT_TRUE(SendInitiate()); 1036 EXPECT_TRUE(SendInitiate());
1045 EXPECT_TRUE(SendAccept()); 1037 EXPECT_TRUE(SendAccept());
1046 EXPECT_EQ(1U, GetChannels1().size()); 1038 EXPECT_EQ(1U, GetChannels1().size());
1047 EXPECT_EQ(1U, GetChannels2().size()); 1039 EXPECT_EQ(1U, GetChannels2().size());
1048 SendRtp1(); 1040 SendRtp1();
1049 SendRtp2(); 1041 SendRtp2();
1050 WaitForThreads(); 1042 WaitForThreads();
1051 EXPECT_TRUE(CheckRtp1()); 1043 EXPECT_TRUE(CheckRtp1());
1052 EXPECT_TRUE(CheckRtp2()); 1044 EXPECT_TRUE(CheckRtp2());
1053 EXPECT_TRUE(CheckNoRtp1()); 1045 EXPECT_TRUE(CheckNoRtp1());
1054 EXPECT_TRUE(CheckNoRtp2()); 1046 EXPECT_TRUE(CheckNoRtp2());
1055 } 1047 }
1056 1048
1057 void TestDeinit() { 1049 void TestDeinit() {
1058 CreateChannels(0, 0); 1050 CreateChannels(RTCP, RTCP);
1059 EXPECT_TRUE(SendInitiate()); 1051 EXPECT_TRUE(SendInitiate());
1060 EXPECT_TRUE(SendAccept()); 1052 EXPECT_TRUE(SendAccept());
1061 SendRtp1(); 1053 SendRtp1();
1062 SendRtp2(); 1054 SendRtp2();
1063 SendRtcp1(); 1055 SendRtcp1();
1064 SendRtcp2(); 1056 SendRtcp2();
1065 // Do not wait, destroy channels. 1057 // Do not wait, destroy channels.
1066 channel1_.reset(nullptr); 1058 channel1_.reset(nullptr);
1067 channel2_.reset(nullptr); 1059 channel2_.reset(nullptr);
1068 } 1060 }
1069 1061
1070 // Check that RTCP can be transmitted between both sides. 1062 // Check that RTCP is not transmitted if both sides don't support RTCP.
1071 void SendRtcpToRtcp() { 1063 void SendNoRtcpToNoRtcp() {
1072 CreateChannels(0, 0); 1064 CreateChannels(0, 0);
1073 EXPECT_TRUE(SendInitiate()); 1065 EXPECT_TRUE(SendInitiate());
1074 EXPECT_TRUE(SendAccept()); 1066 EXPECT_TRUE(SendAccept());
1067 EXPECT_EQ(1U, GetChannels1().size());
1068 EXPECT_EQ(1U, GetChannels2().size());
1069 SendRtcp1();
1070 SendRtcp2();
1071 WaitForThreads();
1072 EXPECT_TRUE(CheckNoRtcp1());
1073 EXPECT_TRUE(CheckNoRtcp2());
1074 }
1075
1076 // Check that RTCP is not transmitted if the callee doesn't support RTCP.
1077 void SendNoRtcpToRtcp() {
1078 CreateChannels(0, RTCP);
1079 EXPECT_TRUE(SendInitiate());
1080 EXPECT_TRUE(SendAccept());
1081 EXPECT_EQ(1U, GetChannels1().size());
1082 EXPECT_EQ(2U, GetChannels2().size());
1083 SendRtcp1();
1084 SendRtcp2();
1085 WaitForThreads();
1086 EXPECT_TRUE(CheckNoRtcp1());
1087 EXPECT_TRUE(CheckNoRtcp2());
1088 }
1089
1090 // Check that RTCP is not transmitted if the caller doesn't support RTCP.
1091 void SendRtcpToNoRtcp() {
1092 CreateChannels(RTCP, 0);
1093 EXPECT_TRUE(SendInitiate());
1094 EXPECT_TRUE(SendAccept());
1075 EXPECT_EQ(2U, GetChannels1().size()); 1095 EXPECT_EQ(2U, GetChannels1().size());
1096 EXPECT_EQ(1U, GetChannels2().size());
1097 SendRtcp1();
1098 SendRtcp2();
1099 WaitForThreads();
1100 EXPECT_TRUE(CheckNoRtcp1());
1101 EXPECT_TRUE(CheckNoRtcp2());
1102 }
1103
1104 // Check that RTCP is transmitted if both sides support RTCP.
1105 void SendRtcpToRtcp() {
1106 CreateChannels(RTCP, RTCP);
1107 EXPECT_TRUE(SendInitiate());
1108 EXPECT_TRUE(SendAccept());
1109 EXPECT_EQ(2U, GetChannels1().size());
1076 EXPECT_EQ(2U, GetChannels2().size()); 1110 EXPECT_EQ(2U, GetChannels2().size());
1077 SendRtcp1(); 1111 SendRtcp1();
1078 SendRtcp2(); 1112 SendRtcp2();
1079 WaitForThreads(); 1113 WaitForThreads();
1080 EXPECT_TRUE(CheckRtcp1()); 1114 EXPECT_TRUE(CheckRtcp1());
1081 EXPECT_TRUE(CheckRtcp2()); 1115 EXPECT_TRUE(CheckRtcp2());
1082 EXPECT_TRUE(CheckNoRtcp1()); 1116 EXPECT_TRUE(CheckNoRtcp1());
1083 EXPECT_TRUE(CheckNoRtcp2()); 1117 EXPECT_TRUE(CheckNoRtcp2());
1084 } 1118 }
1085 1119
1086 // Check that RTCP is transmitted if only the initiator supports mux. 1120 // Check that RTCP is transmitted if only the initiator supports mux.
1087 void SendRtcpMuxToRtcp() { 1121 void SendRtcpMuxToRtcp() {
1088 CreateChannels(RTCP_MUX, 0); 1122 CreateChannels(RTCP | RTCP_MUX, RTCP);
1089 EXPECT_TRUE(SendInitiate()); 1123 EXPECT_TRUE(SendInitiate());
1090 EXPECT_TRUE(SendAccept()); 1124 EXPECT_TRUE(SendAccept());
1091 EXPECT_EQ(2U, GetChannels1().size()); 1125 EXPECT_EQ(2U, GetChannels1().size());
1092 EXPECT_EQ(2U, GetChannels2().size()); 1126 EXPECT_EQ(2U, GetChannels2().size());
1093 SendRtcp1(); 1127 SendRtcp1();
1094 SendRtcp2(); 1128 SendRtcp2();
1095 WaitForThreads(); 1129 WaitForThreads();
1096 EXPECT_TRUE(CheckRtcp1()); 1130 EXPECT_TRUE(CheckRtcp1());
1097 EXPECT_TRUE(CheckRtcp2()); 1131 EXPECT_TRUE(CheckRtcp2());
1098 EXPECT_TRUE(CheckNoRtcp1()); 1132 EXPECT_TRUE(CheckNoRtcp1());
1099 EXPECT_TRUE(CheckNoRtcp2()); 1133 EXPECT_TRUE(CheckNoRtcp2());
1100 } 1134 }
1101 1135
1102 // Check that RTP and RTCP are transmitted ok when both sides support mux. 1136 // Check that RTP and RTCP are transmitted ok when both sides support mux.
1103 void SendRtcpMuxToRtcpMux() { 1137 void SendRtcpMuxToRtcpMux() {
1104 CreateChannels(RTCP_MUX, RTCP_MUX); 1138 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1105 EXPECT_TRUE(SendInitiate()); 1139 EXPECT_TRUE(SendInitiate());
1106 EXPECT_EQ(2U, GetChannels1().size()); 1140 EXPECT_EQ(2U, GetChannels1().size());
1107 EXPECT_EQ(1U, GetChannels2().size()); 1141 EXPECT_EQ(1U, GetChannels2().size());
1108 EXPECT_TRUE(SendAccept()); 1142 EXPECT_TRUE(SendAccept());
1109 EXPECT_EQ(1U, GetChannels1().size()); 1143 EXPECT_EQ(1U, GetChannels1().size());
1110 SendRtp1(); 1144 SendRtp1();
1111 SendRtp2(); 1145 SendRtp2();
1112 SendRtcp1(); 1146 SendRtcp1();
1113 SendRtcp2(); 1147 SendRtcp2();
1114 WaitForThreads(); 1148 WaitForThreads();
1115 EXPECT_TRUE(CheckRtp1()); 1149 EXPECT_TRUE(CheckRtp1());
1116 EXPECT_TRUE(CheckRtp2()); 1150 EXPECT_TRUE(CheckRtp2());
1117 EXPECT_TRUE(CheckNoRtp1()); 1151 EXPECT_TRUE(CheckNoRtp1());
1118 EXPECT_TRUE(CheckNoRtp2()); 1152 EXPECT_TRUE(CheckNoRtp2());
1119 EXPECT_TRUE(CheckRtcp1()); 1153 EXPECT_TRUE(CheckRtcp1());
1120 EXPECT_TRUE(CheckRtcp2()); 1154 EXPECT_TRUE(CheckRtcp2());
1121 EXPECT_TRUE(CheckNoRtcp1()); 1155 EXPECT_TRUE(CheckNoRtcp1());
1122 EXPECT_TRUE(CheckNoRtcp2()); 1156 EXPECT_TRUE(CheckNoRtcp2());
1123 } 1157 }
1124 1158
1125 // Check that RTP and RTCP are transmitted ok when both sides 1159 // Check that RTP and RTCP are transmitted ok when both sides
1126 // support mux and one the offerer requires mux. 1160 // support mux and one the offerer requires mux.
1127 void SendRequireRtcpMuxToRtcpMux() { 1161 void SendRequireRtcpMuxToRtcpMux() {
1128 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX); 1162 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1163 channel1_->ActivateRtcpMux();
1129 EXPECT_TRUE(SendInitiate()); 1164 EXPECT_TRUE(SendInitiate());
1130 EXPECT_EQ(1U, GetChannels1().size()); 1165 EXPECT_EQ(1U, GetChannels1().size());
1131 EXPECT_EQ(1U, GetChannels2().size()); 1166 EXPECT_EQ(1U, GetChannels2().size());
1132 EXPECT_TRUE(SendAccept()); 1167 EXPECT_TRUE(SendAccept());
1133 SendRtp1(); 1168 SendRtp1();
1134 SendRtp2(); 1169 SendRtp2();
1135 SendRtcp1(); 1170 SendRtcp1();
1136 SendRtcp2(); 1171 SendRtcp2();
1137 WaitForThreads(); 1172 WaitForThreads();
1138 EXPECT_TRUE(CheckRtp1()); 1173 EXPECT_TRUE(CheckRtp1());
1139 EXPECT_TRUE(CheckRtp2()); 1174 EXPECT_TRUE(CheckRtp2());
1140 EXPECT_TRUE(CheckNoRtp1()); 1175 EXPECT_TRUE(CheckNoRtp1());
1141 EXPECT_TRUE(CheckNoRtp2()); 1176 EXPECT_TRUE(CheckNoRtp2());
1142 EXPECT_TRUE(CheckRtcp1()); 1177 EXPECT_TRUE(CheckRtcp1());
1143 EXPECT_TRUE(CheckRtcp2()); 1178 EXPECT_TRUE(CheckRtcp2());
1144 EXPECT_TRUE(CheckNoRtcp1()); 1179 EXPECT_TRUE(CheckNoRtcp1());
1145 EXPECT_TRUE(CheckNoRtcp2()); 1180 EXPECT_TRUE(CheckNoRtcp2());
1146 } 1181 }
1147 1182
1148 // Check that RTP and RTCP are transmitted ok when both sides 1183 // Check that RTP and RTCP are transmitted ok when both sides
1149 // support mux and only the answerer requires rtcp mux. 1184 // support mux and one the answerer requires rtcp mux.
1150 void SendRtcpMuxToRequireRtcpMux() { 1185 void SendRtcpMuxToRequireRtcpMux() {
1151 CreateChannels(RTCP_MUX, RTCP_MUX | RTCP_MUX_REQUIRED); 1186 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1187 channel2_->ActivateRtcpMux();
1152 EXPECT_TRUE(SendInitiate()); 1188 EXPECT_TRUE(SendInitiate());
1153 EXPECT_EQ(2U, GetChannels1().size()); 1189 EXPECT_EQ(2U, GetChannels1().size());
1154 EXPECT_EQ(1U, GetChannels2().size()); 1190 EXPECT_EQ(1U, GetChannels2().size());
1155 EXPECT_TRUE(SendAccept()); 1191 EXPECT_TRUE(SendAccept());
1156 EXPECT_EQ(1U, GetChannels1().size()); 1192 EXPECT_EQ(1U, GetChannels1().size());
1157 SendRtp1(); 1193 SendRtp1();
1158 SendRtp2(); 1194 SendRtp2();
1159 SendRtcp1(); 1195 SendRtcp1();
1160 SendRtcp2(); 1196 SendRtcp2();
1161 WaitForThreads(); 1197 WaitForThreads();
1162 EXPECT_TRUE(CheckRtp1()); 1198 EXPECT_TRUE(CheckRtp1());
1163 EXPECT_TRUE(CheckRtp2()); 1199 EXPECT_TRUE(CheckRtp2());
1164 EXPECT_TRUE(CheckNoRtp1()); 1200 EXPECT_TRUE(CheckNoRtp1());
1165 EXPECT_TRUE(CheckNoRtp2()); 1201 EXPECT_TRUE(CheckNoRtp2());
1166 EXPECT_TRUE(CheckRtcp1()); 1202 EXPECT_TRUE(CheckRtcp1());
1167 EXPECT_TRUE(CheckRtcp2()); 1203 EXPECT_TRUE(CheckRtcp2());
1168 EXPECT_TRUE(CheckNoRtcp1()); 1204 EXPECT_TRUE(CheckNoRtcp1());
1169 EXPECT_TRUE(CheckNoRtcp2()); 1205 EXPECT_TRUE(CheckNoRtcp2());
1170 } 1206 }
1171 1207
1172 // Check that RTP and RTCP are transmitted ok when both sides 1208 // Check that RTP and RTCP are transmitted ok when both sides
1173 // require mux. 1209 // require mux.
1174 void SendRequireRtcpMuxToRequireRtcpMux() { 1210 void SendRequireRtcpMuxToRequireRtcpMux() {
1175 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); 1211 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1212 channel1_->ActivateRtcpMux();
1213 channel2_->ActivateRtcpMux();
1176 EXPECT_TRUE(SendInitiate()); 1214 EXPECT_TRUE(SendInitiate());
1177 EXPECT_EQ(1U, GetChannels1().size()); 1215 EXPECT_EQ(1U, GetChannels1().size());
1178 EXPECT_EQ(1U, GetChannels2().size()); 1216 EXPECT_EQ(1U, GetChannels2().size());
1179 EXPECT_TRUE(SendAccept()); 1217 EXPECT_TRUE(SendAccept());
1180 EXPECT_EQ(1U, GetChannels1().size()); 1218 EXPECT_EQ(1U, GetChannels1().size());
1181 SendRtp1(); 1219 SendRtp1();
1182 SendRtp2(); 1220 SendRtp2();
1183 SendRtcp1(); 1221 SendRtcp1();
1184 SendRtcp2(); 1222 SendRtcp2();
1185 WaitForThreads(); 1223 WaitForThreads();
1186 EXPECT_TRUE(CheckRtp1()); 1224 EXPECT_TRUE(CheckRtp1());
1187 EXPECT_TRUE(CheckRtp2()); 1225 EXPECT_TRUE(CheckRtp2());
1188 EXPECT_TRUE(CheckNoRtp1()); 1226 EXPECT_TRUE(CheckNoRtp1());
1189 EXPECT_TRUE(CheckNoRtp2()); 1227 EXPECT_TRUE(CheckNoRtp2());
1190 EXPECT_TRUE(CheckRtcp1()); 1228 EXPECT_TRUE(CheckRtcp1());
1191 EXPECT_TRUE(CheckRtcp2()); 1229 EXPECT_TRUE(CheckRtcp2());
1192 EXPECT_TRUE(CheckNoRtcp1()); 1230 EXPECT_TRUE(CheckNoRtcp1());
1193 EXPECT_TRUE(CheckNoRtcp2()); 1231 EXPECT_TRUE(CheckNoRtcp2());
1194 } 1232 }
1195 1233
1196 // Check that SendAccept fails if the answerer doesn't support mux 1234 // Check that SendAccept fails if the answerer doesn't support mux
1197 // and the offerer requires it. 1235 // and the offerer requires it.
1198 void SendRequireRtcpMuxToNoRtcpMux() { 1236 void SendRequireRtcpMuxToNoRtcpMux() {
1199 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, 0); 1237 CreateChannels(RTCP | RTCP_MUX, RTCP);
1238 channel1_->ActivateRtcpMux();
1200 EXPECT_TRUE(SendInitiate()); 1239 EXPECT_TRUE(SendInitiate());
1201 EXPECT_EQ(1U, GetChannels1().size()); 1240 EXPECT_EQ(1U, GetChannels1().size());
1202 EXPECT_EQ(2U, GetChannels2().size()); 1241 EXPECT_EQ(2U, GetChannels2().size());
1203 EXPECT_FALSE(SendAccept()); 1242 EXPECT_FALSE(SendAccept());
1204 } 1243 }
1205 1244
1206 // Check that RTCP data sent by the initiator before the accept is not muxed. 1245 // Check that RTCP data sent by the initiator before the accept is not muxed.
1207 void SendEarlyRtcpMuxToRtcp() { 1246 void SendEarlyRtcpMuxToRtcp() {
1208 CreateChannels(RTCP_MUX, 0); 1247 CreateChannels(RTCP | RTCP_MUX, RTCP);
1209 EXPECT_TRUE(SendInitiate()); 1248 EXPECT_TRUE(SendInitiate());
1210 EXPECT_EQ(2U, GetChannels1().size()); 1249 EXPECT_EQ(2U, GetChannels1().size());
1211 EXPECT_EQ(2U, GetChannels2().size()); 1250 EXPECT_EQ(2U, GetChannels2().size());
1212 1251
1213 // RTCP can be sent before the call is accepted, if the transport is ready. 1252 // RTCP can be sent before the call is accepted, if the transport is ready.
1214 // It should not be muxed though, as the remote side doesn't support mux. 1253 // It should not be muxed though, as the remote side doesn't support mux.
1215 SendRtcp1(); 1254 SendRtcp1();
1216 WaitForThreads(); 1255 WaitForThreads();
1217 EXPECT_TRUE(CheckNoRtp2()); 1256 EXPECT_TRUE(CheckNoRtp2());
1218 EXPECT_TRUE(CheckRtcp2()); 1257 EXPECT_TRUE(CheckRtcp2());
(...skipping 12 matching lines...) Expand all
1231 WaitForThreads(); 1270 WaitForThreads();
1232 EXPECT_TRUE(CheckRtcp2()); 1271 EXPECT_TRUE(CheckRtcp2());
1233 EXPECT_TRUE(CheckRtcp1()); 1272 EXPECT_TRUE(CheckRtcp1());
1234 } 1273 }
1235 1274
1236 1275
1237 // Check that RTCP data is not muxed until both sides have enabled muxing, 1276 // Check that RTCP data is not muxed until both sides have enabled muxing,
1238 // but that we properly demux before we get the accept message, since there 1277 // but that we properly demux before we get the accept message, since there
1239 // is a race between RTP data and the jingle accept. 1278 // is a race between RTP data and the jingle accept.
1240 void SendEarlyRtcpMuxToRtcpMux() { 1279 void SendEarlyRtcpMuxToRtcpMux() {
1241 CreateChannels(RTCP_MUX, RTCP_MUX); 1280 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1242 EXPECT_TRUE(SendInitiate()); 1281 EXPECT_TRUE(SendInitiate());
1243 EXPECT_EQ(2U, GetChannels1().size()); 1282 EXPECT_EQ(2U, GetChannels1().size());
1244 EXPECT_EQ(1U, GetChannels2().size()); 1283 EXPECT_EQ(1U, GetChannels2().size());
1245 1284
1246 // RTCP can't be sent yet, since the RTCP transport isn't writable, and 1285 // RTCP can't be sent yet, since the RTCP transport isn't writable, and
1247 // we haven't yet received the accept that says we should mux. 1286 // we haven't yet received the accept that says we should mux.
1248 SendRtcp1(); 1287 SendRtcp1();
1249 WaitForThreads(); 1288 WaitForThreads();
1250 EXPECT_TRUE(CheckNoRtcp2()); 1289 EXPECT_TRUE(CheckNoRtcp2());
1251 1290
(...skipping 12 matching lines...) Expand all
1264 EXPECT_TRUE(CheckRtcp2()); 1303 EXPECT_TRUE(CheckRtcp2());
1265 EXPECT_TRUE(CheckRtcp1()); 1304 EXPECT_TRUE(CheckRtcp1());
1266 } 1305 }
1267 1306
1268 // Test that we properly send SRTP with RTCP in both directions. 1307 // Test that we properly send SRTP with RTCP in both directions.
1269 // You can pass in DTLS and/or RTCP_MUX as flags. 1308 // You can pass in DTLS and/or RTCP_MUX as flags.
1270 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { 1309 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) {
1271 ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); 1310 ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0);
1272 ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); 1311 ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0);
1273 1312
1274 int flags1 = SECURE | flags1_in; 1313 int flags1 = RTCP | SECURE | flags1_in;
1275 int flags2 = SECURE | flags2_in; 1314 int flags2 = RTCP | SECURE | flags2_in;
1276 bool dtls1 = !!(flags1_in & DTLS); 1315 bool dtls1 = !!(flags1_in & DTLS);
1277 bool dtls2 = !!(flags2_in & DTLS); 1316 bool dtls2 = !!(flags2_in & DTLS);
1278 CreateChannels(flags1, flags2); 1317 CreateChannels(flags1, flags2);
1279 EXPECT_FALSE(channel1_->secure()); 1318 EXPECT_FALSE(channel1_->secure());
1280 EXPECT_FALSE(channel2_->secure()); 1319 EXPECT_FALSE(channel2_->secure());
1281 EXPECT_TRUE(SendInitiate()); 1320 EXPECT_TRUE(SendInitiate());
1282 WaitForThreads(); 1321 WaitForThreads();
1283 EXPECT_TRUE(channel1_->writable()); 1322 EXPECT_TRUE(channel1_->writable());
1284 EXPECT_TRUE(channel2_->writable()); 1323 EXPECT_TRUE(channel2_->writable());
1285 EXPECT_TRUE(SendAccept()); 1324 EXPECT_TRUE(SendAccept());
(...skipping 19 matching lines...) Expand all
1305 EXPECT_TRUE(CheckNoRtp1()); 1344 EXPECT_TRUE(CheckNoRtp1());
1306 EXPECT_TRUE(CheckNoRtp2()); 1345 EXPECT_TRUE(CheckNoRtp2());
1307 EXPECT_TRUE(CheckRtcp1()); 1346 EXPECT_TRUE(CheckRtcp1());
1308 EXPECT_TRUE(CheckRtcp2()); 1347 EXPECT_TRUE(CheckRtcp2());
1309 EXPECT_TRUE(CheckNoRtcp1()); 1348 EXPECT_TRUE(CheckNoRtcp1());
1310 EXPECT_TRUE(CheckNoRtcp2()); 1349 EXPECT_TRUE(CheckNoRtcp2());
1311 } 1350 }
1312 1351
1313 // Test that we properly handling SRTP negotiating down to RTP. 1352 // Test that we properly handling SRTP negotiating down to RTP.
1314 void SendSrtpToRtp() { 1353 void SendSrtpToRtp() {
1315 CreateChannels(SECURE, 0); 1354 CreateChannels(RTCP | SECURE, RTCP);
1316 EXPECT_FALSE(channel1_->secure()); 1355 EXPECT_FALSE(channel1_->secure());
1317 EXPECT_FALSE(channel2_->secure()); 1356 EXPECT_FALSE(channel2_->secure());
1318 EXPECT_TRUE(SendInitiate()); 1357 EXPECT_TRUE(SendInitiate());
1319 EXPECT_TRUE(SendAccept()); 1358 EXPECT_TRUE(SendAccept());
1320 EXPECT_FALSE(channel1_->secure()); 1359 EXPECT_FALSE(channel1_->secure());
1321 EXPECT_FALSE(channel2_->secure()); 1360 EXPECT_FALSE(channel2_->secure());
1322 SendRtp1(); 1361 SendRtp1();
1323 SendRtp2(); 1362 SendRtp2();
1324 SendRtcp1(); 1363 SendRtcp1();
1325 SendRtcp2(); 1364 SendRtcp2();
1326 WaitForThreads(); 1365 WaitForThreads();
1327 EXPECT_TRUE(CheckRtp1()); 1366 EXPECT_TRUE(CheckRtp1());
1328 EXPECT_TRUE(CheckRtp2()); 1367 EXPECT_TRUE(CheckRtp2());
1329 EXPECT_TRUE(CheckNoRtp1()); 1368 EXPECT_TRUE(CheckNoRtp1());
1330 EXPECT_TRUE(CheckNoRtp2()); 1369 EXPECT_TRUE(CheckNoRtp2());
1331 EXPECT_TRUE(CheckRtcp1()); 1370 EXPECT_TRUE(CheckRtcp1());
1332 EXPECT_TRUE(CheckRtcp2()); 1371 EXPECT_TRUE(CheckRtcp2());
1333 EXPECT_TRUE(CheckNoRtcp1()); 1372 EXPECT_TRUE(CheckNoRtcp1());
1334 EXPECT_TRUE(CheckNoRtcp2()); 1373 EXPECT_TRUE(CheckNoRtcp2());
1335 } 1374 }
1336 1375
1337 // Test that we can send and receive early media when a provisional answer is 1376 // Test that we can send and receive early media when a provisional answer is
1338 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. 1377 // sent and received. The test uses SRTP, RTCP mux and SSRC mux.
1339 void SendEarlyMediaUsingRtcpMuxSrtp() { 1378 void SendEarlyMediaUsingRtcpMuxSrtp() {
1340 int sequence_number1_1 = 0, sequence_number2_2 = 0; 1379 int sequence_number1_1 = 0, sequence_number2_2 = 0;
1341 1380
1342 CreateChannels(SSRC_MUX | RTCP_MUX | SECURE, 1381 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE,
1343 SSRC_MUX | RTCP_MUX | SECURE); 1382 SSRC_MUX | RTCP | RTCP_MUX | SECURE);
1344 EXPECT_TRUE(SendOffer()); 1383 EXPECT_TRUE(SendOffer());
1345 EXPECT_TRUE(SendProvisionalAnswer()); 1384 EXPECT_TRUE(SendProvisionalAnswer());
1346 EXPECT_TRUE(channel1_->secure()); 1385 EXPECT_TRUE(channel1_->secure());
1347 EXPECT_TRUE(channel2_->secure()); 1386 EXPECT_TRUE(channel2_->secure());
1348 EXPECT_EQ(2U, GetChannels1().size()); 1387 EXPECT_EQ(2U, GetChannels1().size());
1349 EXPECT_EQ(2U, GetChannels2().size()); 1388 EXPECT_EQ(2U, GetChannels2().size());
1350 WaitForThreads(); // Wait for 'sending' flag go through network thread. 1389 WaitForThreads(); // Wait for 'sending' flag go through network thread.
1351 SendCustomRtcp1(kSsrc1); 1390 SendCustomRtcp1(kSsrc1);
1352 SendCustomRtp1(kSsrc1, ++sequence_number1_1); 1391 SendCustomRtp1(kSsrc1, ++sequence_number1_1);
1353 WaitForThreads(); 1392 WaitForThreads();
(...skipping 19 matching lines...) Expand all
1373 SendCustomRtp2(kSsrc2, ++sequence_number2_2); 1412 SendCustomRtp2(kSsrc2, ++sequence_number2_2);
1374 WaitForThreads(); 1413 WaitForThreads();
1375 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); 1414 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1));
1376 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); 1415 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1));
1377 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); 1416 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2));
1378 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, sequence_number2_2)); 1417 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, sequence_number2_2));
1379 } 1418 }
1380 1419
1381 // Test that we properly send RTP without SRTP from a thread. 1420 // Test that we properly send RTP without SRTP from a thread.
1382 void SendRtpToRtpOnThread() { 1421 void SendRtpToRtpOnThread() {
1383 CreateChannels(0, 0); 1422 CreateChannels(RTCP, RTCP);
1384 EXPECT_TRUE(SendInitiate()); 1423 EXPECT_TRUE(SendInitiate());
1385 EXPECT_TRUE(SendAccept()); 1424 EXPECT_TRUE(SendAccept());
1386 ScopedCallThread send_rtp1([this] { SendRtp1(); }); 1425 ScopedCallThread send_rtp1([this] { SendRtp1(); });
1387 ScopedCallThread send_rtp2([this] { SendRtp2(); }); 1426 ScopedCallThread send_rtp2([this] { SendRtp2(); });
1388 ScopedCallThread send_rtcp1([this] { SendRtcp1(); }); 1427 ScopedCallThread send_rtcp1([this] { SendRtcp1(); });
1389 ScopedCallThread send_rtcp2([this] { SendRtcp2(); }); 1428 ScopedCallThread send_rtcp2([this] { SendRtcp2(); });
1390 rtc::Thread* involved_threads[] = {send_rtp1.thread(), send_rtp2.thread(), 1429 rtc::Thread* involved_threads[] = {send_rtp1.thread(), send_rtp2.thread(),
1391 send_rtcp1.thread(), 1430 send_rtcp1.thread(),
1392 send_rtcp2.thread()}; 1431 send_rtcp2.thread()};
1393 WaitForThreads(involved_threads); 1432 WaitForThreads(involved_threads);
1394 EXPECT_TRUE(CheckRtp1()); 1433 EXPECT_TRUE(CheckRtp1());
1395 EXPECT_TRUE(CheckRtp2()); 1434 EXPECT_TRUE(CheckRtp2());
1396 EXPECT_TRUE(CheckNoRtp1()); 1435 EXPECT_TRUE(CheckNoRtp1());
1397 EXPECT_TRUE(CheckNoRtp2()); 1436 EXPECT_TRUE(CheckNoRtp2());
1398 EXPECT_TRUE(CheckRtcp1()); 1437 EXPECT_TRUE(CheckRtcp1());
1399 EXPECT_TRUE(CheckRtcp2()); 1438 EXPECT_TRUE(CheckRtcp2());
1400 EXPECT_TRUE(CheckNoRtcp1()); 1439 EXPECT_TRUE(CheckNoRtcp1());
1401 EXPECT_TRUE(CheckNoRtcp2()); 1440 EXPECT_TRUE(CheckNoRtcp2());
1402 } 1441 }
1403 1442
1404 // Test that we properly send SRTP with RTCP from a thread. 1443 // Test that we properly send SRTP with RTCP from a thread.
1405 void SendSrtpToSrtpOnThread() { 1444 void SendSrtpToSrtpOnThread() {
1406 CreateChannels(SECURE, SECURE); 1445 CreateChannels(RTCP | SECURE, RTCP | SECURE);
1407 EXPECT_TRUE(SendInitiate()); 1446 EXPECT_TRUE(SendInitiate());
1408 EXPECT_TRUE(SendAccept()); 1447 EXPECT_TRUE(SendAccept());
1409 ScopedCallThread send_rtp1([this] { SendRtp1(); }); 1448 ScopedCallThread send_rtp1([this] { SendRtp1(); });
1410 ScopedCallThread send_rtp2([this] { SendRtp2(); }); 1449 ScopedCallThread send_rtp2([this] { SendRtp2(); });
1411 ScopedCallThread send_rtcp1([this] { SendRtcp1(); }); 1450 ScopedCallThread send_rtcp1([this] { SendRtcp1(); });
1412 ScopedCallThread send_rtcp2([this] { SendRtcp2(); }); 1451 ScopedCallThread send_rtcp2([this] { SendRtcp2(); });
1413 rtc::Thread* involved_threads[] = {send_rtp1.thread(), send_rtp2.thread(), 1452 rtc::Thread* involved_threads[] = {send_rtp1.thread(), send_rtp2.thread(),
1414 send_rtcp1.thread(), 1453 send_rtcp1.thread(),
1415 send_rtcp2.thread()}; 1454 send_rtcp2.thread()};
1416 WaitForThreads(involved_threads); 1455 WaitForThreads(involved_threads);
1417 EXPECT_TRUE(CheckRtp1()); 1456 EXPECT_TRUE(CheckRtp1());
1418 EXPECT_TRUE(CheckRtp2()); 1457 EXPECT_TRUE(CheckRtp2());
1419 EXPECT_TRUE(CheckNoRtp1()); 1458 EXPECT_TRUE(CheckNoRtp1());
1420 EXPECT_TRUE(CheckNoRtp2()); 1459 EXPECT_TRUE(CheckNoRtp2());
1421 EXPECT_TRUE(CheckRtcp1()); 1460 EXPECT_TRUE(CheckRtcp1());
1422 EXPECT_TRUE(CheckRtcp2()); 1461 EXPECT_TRUE(CheckRtcp2());
1423 EXPECT_TRUE(CheckNoRtcp1()); 1462 EXPECT_TRUE(CheckNoRtcp1());
1424 EXPECT_TRUE(CheckNoRtcp2()); 1463 EXPECT_TRUE(CheckNoRtcp2());
1425 } 1464 }
1426 1465
1427 // Test that the mediachannel retains its sending state after the transport 1466 // Test that the mediachannel retains its sending state after the transport
1428 // becomes non-writable. 1467 // becomes non-writable.
1429 void SendWithWritabilityLoss() { 1468 void SendWithWritabilityLoss() {
1430 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); 1469 CreateChannels(0, 0);
1431 EXPECT_TRUE(SendInitiate()); 1470 EXPECT_TRUE(SendInitiate());
1432 EXPECT_TRUE(SendAccept()); 1471 EXPECT_TRUE(SendAccept());
1433 EXPECT_EQ(1U, GetChannels1().size()); 1472 EXPECT_EQ(1U, GetChannels1().size());
1434 EXPECT_EQ(1U, GetChannels2().size()); 1473 EXPECT_EQ(1U, GetChannels2().size());
1435 SendRtp1(); 1474 SendRtp1();
1436 SendRtp2(); 1475 SendRtp2();
1437 WaitForThreads(); 1476 WaitForThreads();
1438 EXPECT_TRUE(CheckRtp1()); 1477 EXPECT_TRUE(CheckRtp1());
1439 EXPECT_TRUE(CheckRtp2()); 1478 EXPECT_TRUE(CheckRtp2());
1440 EXPECT_TRUE(CheckNoRtp1()); 1479 EXPECT_TRUE(CheckNoRtp1());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 } 1527 }
1489 1528
1490 void SendBundleToBundle( 1529 void SendBundleToBundle(
1491 const int* pl_types, int len, bool rtcp_mux, bool secure) { 1530 const int* pl_types, int len, bool rtcp_mux, bool secure) {
1492 ASSERT_EQ(2, len); 1531 ASSERT_EQ(2, len);
1493 int sequence_number1_1 = 0, sequence_number2_2 = 0; 1532 int sequence_number1_1 = 0, sequence_number2_2 = 0;
1494 // Only pl_type1 was added to the bundle filter for both |channel1_| 1533 // Only pl_type1 was added to the bundle filter for both |channel1_|
1495 // and |channel2_|. 1534 // and |channel2_|.
1496 int pl_type1 = pl_types[0]; 1535 int pl_type1 = pl_types[0];
1497 int pl_type2 = pl_types[1]; 1536 int pl_type2 = pl_types[1];
1498 int flags = SSRC_MUX; 1537 int flags = SSRC_MUX | RTCP;
1499 if (secure) flags |= SECURE; 1538 if (secure) flags |= SECURE;
1500 uint32_t expected_channels = 2U; 1539 uint32_t expected_channels = 2U;
1501 if (rtcp_mux) { 1540 if (rtcp_mux) {
1502 flags |= RTCP_MUX; 1541 flags |= RTCP_MUX;
1503 expected_channels = 1U; 1542 expected_channels = 1U;
1504 } 1543 }
1505 CreateChannels(flags, flags); 1544 CreateChannels(flags, flags);
1506 EXPECT_TRUE(SendInitiate()); 1545 EXPECT_TRUE(SendInitiate());
1507 EXPECT_EQ(2U, GetChannels1().size()); 1546 EXPECT_EQ(2U, GetChannels1().size());
1508 EXPECT_EQ(expected_channels, GetChannels2().size()); 1547 EXPECT_EQ(expected_channels, GetChannels2().size());
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 std::unique_ptr<cricket::SessionDescription> sdesc3( 1717 std::unique_ptr<cricket::SessionDescription> sdesc3(
1679 CreateSessionDescriptionWithStream(3)); 1718 CreateSessionDescriptionWithStream(3));
1680 EXPECT_TRUE(channel1_->PushdownRemoteDescription( 1719 EXPECT_TRUE(channel1_->PushdownRemoteDescription(
1681 sdesc3.get(), cricket::CA_ANSWER, &err)); 1720 sdesc3.get(), cricket::CA_ANSWER, &err));
1682 EXPECT_TRUE(media_channel1_->HasSendStream(1)); 1721 EXPECT_TRUE(media_channel1_->HasSendStream(1));
1683 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); 1722 EXPECT_FALSE(media_channel1_->HasRecvStream(2));
1684 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); 1723 EXPECT_TRUE(media_channel1_->HasRecvStream(3));
1685 } 1724 }
1686 1725
1687 void TestFlushRtcp() { 1726 void TestFlushRtcp() {
1688 CreateChannels(0, 0); 1727 CreateChannels(RTCP, RTCP);
1689 EXPECT_TRUE(SendInitiate()); 1728 EXPECT_TRUE(SendInitiate());
1690 EXPECT_TRUE(SendAccept()); 1729 EXPECT_TRUE(SendAccept());
1691 EXPECT_EQ(2U, GetChannels1().size()); 1730 EXPECT_EQ(2U, GetChannels1().size());
1692 EXPECT_EQ(2U, GetChannels2().size()); 1731 EXPECT_EQ(2U, GetChannels2().size());
1693 1732
1694 // Send RTCP1 from a different thread. 1733 // Send RTCP1 from a different thread.
1695 ScopedCallThread send_rtcp([this] { SendRtcp1(); }); 1734 ScopedCallThread send_rtcp([this] { SendRtcp1(); });
1696 // The sending message is only posted. channel2_ should be empty. 1735 // The sending message is only posted. channel2_ should be empty.
1697 EXPECT_TRUE(CheckNoRtcp2()); 1736 EXPECT_TRUE(CheckNoRtcp2());
1698 rtc::Thread* wait_for[] = {send_rtcp.thread()}; 1737 rtc::Thread* wait_for[] = {send_rtcp.thread()};
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 0x00, 0x01}; 1772 0x00, 0x01};
1734 1773
1735 // Using fake clock because this tests that SRTP errors are signaled at 1774 // Using fake clock because this tests that SRTP errors are signaled at
1736 // specific times based on set_signal_silent_time. 1775 // specific times based on set_signal_silent_time.
1737 rtc::ScopedFakeClock fake_clock; 1776 rtc::ScopedFakeClock fake_clock;
1738 // Some code uses a time of 0 as a special value, so we must start with 1777 // Some code uses a time of 0 as a special value, so we must start with
1739 // a non-zero time. 1778 // a non-zero time.
1740 // TODO(deadbeef): Fix this. 1779 // TODO(deadbeef): Fix this.
1741 fake_clock.AdvanceTime(rtc::TimeDelta::FromSeconds(1)); 1780 fake_clock.AdvanceTime(rtc::TimeDelta::FromSeconds(1));
1742 1781
1743 CreateChannels(SECURE, SECURE); 1782 CreateChannels(RTCP | SECURE, RTCP | SECURE);
1744 EXPECT_FALSE(channel1_->secure()); 1783 EXPECT_FALSE(channel1_->secure());
1745 EXPECT_FALSE(channel2_->secure()); 1784 EXPECT_FALSE(channel2_->secure());
1746 EXPECT_TRUE(SendInitiate()); 1785 EXPECT_TRUE(SendInitiate());
1747 EXPECT_TRUE(SendAccept()); 1786 EXPECT_TRUE(SendAccept());
1748 EXPECT_TRUE(channel1_->secure()); 1787 EXPECT_TRUE(channel1_->secure());
1749 EXPECT_TRUE(channel2_->secure()); 1788 EXPECT_TRUE(channel2_->secure());
1750 channel2_->srtp_filter()->set_signal_silent_time(250); 1789 channel2_->srtp_filter()->set_signal_silent_time(250);
1751 channel2_->srtp_filter()->SignalSrtpError.connect( 1790 channel2_->srtp_filter()->SignalSrtpError.connect(
1752 &error_handler, &SrtpErrorHandler::OnSrtpError); 1791 &error_handler, &SrtpErrorHandler::OnSrtpError);
1753 1792
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 transport_channel, reinterpret_cast<const char*>(kBadPacket), 1825 transport_channel, reinterpret_cast<const char*>(kBadPacket),
1787 sizeof(kBadPacket), rtc::PacketTime(), 0); 1826 sizeof(kBadPacket), rtc::PacketTime(), 0);
1788 }); 1827 });
1789 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); 1828 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_);
1790 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); 1829 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_);
1791 // Terminate channels before the fake clock is destroyed. 1830 // Terminate channels before the fake clock is destroyed.
1792 EXPECT_TRUE(SendTerminate()); 1831 EXPECT_TRUE(SendTerminate());
1793 } 1832 }
1794 1833
1795 void TestOnReadyToSend() { 1834 void TestOnReadyToSend() {
1796 CreateChannels(0, 0); 1835 CreateChannels(RTCP, RTCP);
1797 TransportChannel* rtp = channel1_->rtp_transport(); 1836 TransportChannel* rtp = channel1_->rtp_transport();
1798 TransportChannel* rtcp = channel1_->rtcp_transport(); 1837 TransportChannel* rtcp = channel1_->rtcp_transport();
1799 EXPECT_FALSE(media_channel1_->ready_to_send()); 1838 EXPECT_FALSE(media_channel1_->ready_to_send());
1800 1839
1801 network_thread_->Invoke<void>(RTC_FROM_HERE, 1840 network_thread_->Invoke<void>(RTC_FROM_HERE,
1802 [rtp] { rtp->SignalReadyToSend(rtp); }); 1841 [rtp] { rtp->SignalReadyToSend(rtp); });
1803 WaitForThreads(); 1842 WaitForThreads();
1804 EXPECT_FALSE(media_channel1_->ready_to_send()); 1843 EXPECT_FALSE(media_channel1_->ready_to_send());
1805 1844
1806 network_thread_->Invoke<void>(RTC_FROM_HERE, 1845 network_thread_->Invoke<void>(RTC_FROM_HERE,
(...skipping 24 matching lines...) Expand all
1831 EXPECT_FALSE(media_channel1_->ready_to_send()); 1870 EXPECT_FALSE(media_channel1_->ready_to_send());
1832 1871
1833 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { 1872 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] {
1834 channel1_->SetTransportChannelReadyToSend(true, true); 1873 channel1_->SetTransportChannelReadyToSend(true, true);
1835 }); 1874 });
1836 WaitForThreads(); 1875 WaitForThreads();
1837 EXPECT_TRUE(media_channel1_->ready_to_send()); 1876 EXPECT_TRUE(media_channel1_->ready_to_send());
1838 } 1877 }
1839 1878
1840 void TestOnReadyToSendWithRtcpMux() { 1879 void TestOnReadyToSendWithRtcpMux() {
1841 CreateChannels(0, 0); 1880 CreateChannels(RTCP, RTCP);
1842 typename T::Content content; 1881 typename T::Content content;
1843 CreateContent(0, kPcmuCodec, kH264Codec, &content); 1882 CreateContent(0, kPcmuCodec, kH264Codec, &content);
1844 // Both sides agree on mux. Should no longer be a separate RTCP channel. 1883 // Both sides agree on mux. Should no longer be a separate RTCP channel.
1845 content.set_rtcp_mux(true); 1884 content.set_rtcp_mux(true);
1846 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); 1885 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL));
1847 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); 1886 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL));
1848 EXPECT_TRUE(channel1_->rtcp_transport() == NULL); 1887 EXPECT_TRUE(channel1_->rtcp_transport() == NULL);
1849 TransportChannel* rtp = channel1_->rtp_transport(); 1888 TransportChannel* rtp = channel1_->rtp_transport();
1850 EXPECT_FALSE(media_channel1_->ready_to_send()); 1889 EXPECT_FALSE(media_channel1_->ready_to_send());
1851 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel 1890 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 rtc::Thread* worker_thread, 2053 rtc::Thread* worker_thread,
2015 rtc::Thread* network_thread, 2054 rtc::Thread* network_thread,
2016 cricket::MediaEngineInterface* engine, 2055 cricket::MediaEngineInterface* engine,
2017 cricket::FakeVideoMediaChannel* ch, 2056 cricket::FakeVideoMediaChannel* ch,
2018 cricket::TransportController* transport_controller, 2057 cricket::TransportController* transport_controller,
2019 int flags) { 2058 int flags) {
2020 rtc::Thread* signaling_thread = 2059 rtc::Thread* signaling_thread =
2021 transport_controller ? transport_controller->signaling_thread() : nullptr; 2060 transport_controller ? transport_controller->signaling_thread() : nullptr;
2022 cricket::VideoChannel* channel = new cricket::VideoChannel( 2061 cricket::VideoChannel* channel = new cricket::VideoChannel(
2023 worker_thread, network_thread, signaling_thread, ch, cricket::CN_VIDEO, 2062 worker_thread, network_thread, signaling_thread, ch, cricket::CN_VIDEO,
2024 (flags & RTCP_MUX_REQUIRED) != 0, (flags & SECURE) != 0); 2063 (flags & RTCP) != 0, (flags & SECURE) != 0);
2025 rtc::CryptoOptions crypto_options; 2064 rtc::CryptoOptions crypto_options;
2026 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; 2065 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0;
2027 channel->SetCryptoOptions(crypto_options); 2066 channel->SetCryptoOptions(crypto_options);
2028 cricket::TransportChannel* rtp_transport = 2067 cricket::TransportChannel* rtp_transport =
2029 transport_controller->CreateTransportChannel( 2068 transport_controller->CreateTransportChannel(
2030 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); 2069 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP);
2031 cricket::TransportChannel* rtcp_transport = nullptr; 2070 cricket::TransportChannel* rtcp_transport = nullptr;
2032 if (channel->NeedsRtcpTransport()) { 2071 if (channel->NeedsRtcpTransport()) {
2033 rtcp_transport = transport_controller->CreateTransportChannel( 2072 rtcp_transport = transport_controller->CreateTransportChannel(
2034 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); 2073 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 } 2221 }
2183 2222
2184 TEST_F(VoiceChannelSingleThreadTest, TestCallTeardownRtcpMux) { 2223 TEST_F(VoiceChannelSingleThreadTest, TestCallTeardownRtcpMux) {
2185 Base::TestCallTeardownRtcpMux(); 2224 Base::TestCallTeardownRtcpMux();
2186 } 2225 }
2187 2226
2188 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtp) { 2227 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtp) {
2189 Base::SendRtpToRtp(); 2228 Base::SendRtpToRtp();
2190 } 2229 }
2191 2230
2231 TEST_F(VoiceChannelSingleThreadTest, SendNoRtcpToNoRtcp) {
2232 Base::SendNoRtcpToNoRtcp();
2233 }
2234
2235 TEST_F(VoiceChannelSingleThreadTest, SendNoRtcpToRtcp) {
2236 Base::SendNoRtcpToRtcp();
2237 }
2238
2239 TEST_F(VoiceChannelSingleThreadTest, SendRtcpToNoRtcp) {
2240 Base::SendRtcpToNoRtcp();
2241 }
2242
2192 TEST_F(VoiceChannelSingleThreadTest, SendRtcpToRtcp) { 2243 TEST_F(VoiceChannelSingleThreadTest, SendRtcpToRtcp) {
2193 Base::SendRtcpToRtcp(); 2244 Base::SendRtcpToRtcp();
2194 } 2245 }
2195 2246
2196 TEST_F(VoiceChannelSingleThreadTest, SendRtcpMuxToRtcp) { 2247 TEST_F(VoiceChannelSingleThreadTest, SendRtcpMuxToRtcp) {
2197 Base::SendRtcpMuxToRtcp(); 2248 Base::SendRtcpMuxToRtcp();
2198 } 2249 }
2199 2250
2200 TEST_F(VoiceChannelSingleThreadTest, SendRtcpMuxToRtcpMux) { 2251 TEST_F(VoiceChannelSingleThreadTest, SendRtcpMuxToRtcpMux) {
2201 Base::SendRtcpMuxToRtcpMux(); 2252 Base::SendRtcpMuxToRtcpMux();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 TEST_F(VoiceChannelSingleThreadTest, TestOnReadyToSend) { 2389 TEST_F(VoiceChannelSingleThreadTest, TestOnReadyToSend) {
2339 Base::TestOnReadyToSend(); 2390 Base::TestOnReadyToSend();
2340 } 2391 }
2341 2392
2342 TEST_F(VoiceChannelSingleThreadTest, TestOnReadyToSendWithRtcpMux) { 2393 TEST_F(VoiceChannelSingleThreadTest, TestOnReadyToSendWithRtcpMux) {
2343 Base::TestOnReadyToSendWithRtcpMux(); 2394 Base::TestOnReadyToSendWithRtcpMux();
2344 } 2395 }
2345 2396
2346 // Test that we can scale the output volume properly for 1:1 calls. 2397 // Test that we can scale the output volume properly for 1:1 calls.
2347 TEST_F(VoiceChannelSingleThreadTest, TestScaleVolume1to1Call) { 2398 TEST_F(VoiceChannelSingleThreadTest, TestScaleVolume1to1Call) {
2348 CreateChannels(0, 0); 2399 CreateChannels(RTCP, RTCP);
2349 EXPECT_TRUE(SendInitiate()); 2400 EXPECT_TRUE(SendInitiate());
2350 EXPECT_TRUE(SendAccept()); 2401 EXPECT_TRUE(SendAccept());
2351 double volume; 2402 double volume;
2352 2403
2353 // Default is (1.0). 2404 // Default is (1.0).
2354 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume)); 2405 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2355 EXPECT_DOUBLE_EQ(1.0, volume); 2406 EXPECT_DOUBLE_EQ(1.0, volume);
2356 // invalid ssrc. 2407 // invalid ssrc.
2357 EXPECT_FALSE(media_channel1_->GetOutputVolume(3, &volume)); 2408 EXPECT_FALSE(media_channel1_->GetOutputVolume(3, &volume));
2358 2409
2359 // Set scale to (1.5). 2410 // Set scale to (1.5).
2360 EXPECT_TRUE(channel1_->SetOutputVolume(0, 1.5)); 2411 EXPECT_TRUE(channel1_->SetOutputVolume(0, 1.5));
2361 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume)); 2412 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2362 EXPECT_DOUBLE_EQ(1.5, volume); 2413 EXPECT_DOUBLE_EQ(1.5, volume);
2363 2414
2364 // Set scale to (0). 2415 // Set scale to (0).
2365 EXPECT_TRUE(channel1_->SetOutputVolume(0, 0.0)); 2416 EXPECT_TRUE(channel1_->SetOutputVolume(0, 0.0));
2366 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume)); 2417 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2367 EXPECT_DOUBLE_EQ(0.0, volume); 2418 EXPECT_DOUBLE_EQ(0.0, volume);
2368 } 2419 }
2369 2420
2370 // Test that we can scale the output volume properly for multiway calls. 2421 // Test that we can scale the output volume properly for multiway calls.
2371 TEST_F(VoiceChannelSingleThreadTest, TestScaleVolumeMultiwayCall) { 2422 TEST_F(VoiceChannelSingleThreadTest, TestScaleVolumeMultiwayCall) {
2372 CreateChannels(0, 0); 2423 CreateChannels(RTCP, RTCP);
2373 EXPECT_TRUE(SendInitiate()); 2424 EXPECT_TRUE(SendInitiate());
2374 EXPECT_TRUE(SendAccept()); 2425 EXPECT_TRUE(SendAccept());
2375 EXPECT_TRUE(AddStream1(1)); 2426 EXPECT_TRUE(AddStream1(1));
2376 EXPECT_TRUE(AddStream1(2)); 2427 EXPECT_TRUE(AddStream1(2));
2377 2428
2378 double volume; 2429 double volume;
2379 // Default is (1.0). 2430 // Default is (1.0).
2380 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume)); 2431 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2381 EXPECT_DOUBLE_EQ(1.0, volume); 2432 EXPECT_DOUBLE_EQ(1.0, volume);
2382 EXPECT_TRUE(media_channel1_->GetOutputVolume(1, &volume)); 2433 EXPECT_TRUE(media_channel1_->GetOutputVolume(1, &volume));
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 } 2566 }
2516 2567
2517 TEST_F(VoiceChannelDoubleThreadTest, TestCallTeardownRtcpMux) { 2568 TEST_F(VoiceChannelDoubleThreadTest, TestCallTeardownRtcpMux) {
2518 Base::TestCallTeardownRtcpMux(); 2569 Base::TestCallTeardownRtcpMux();
2519 } 2570 }
2520 2571
2521 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtp) { 2572 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtp) {
2522 Base::SendRtpToRtp(); 2573 Base::SendRtpToRtp();
2523 } 2574 }
2524 2575
2576 TEST_F(VoiceChannelDoubleThreadTest, SendNoRtcpToNoRtcp) {
2577 Base::SendNoRtcpToNoRtcp();
2578 }
2579
2580 TEST_F(VoiceChannelDoubleThreadTest, SendNoRtcpToRtcp) {
2581 Base::SendNoRtcpToRtcp();
2582 }
2583
2584 TEST_F(VoiceChannelDoubleThreadTest, SendRtcpToNoRtcp) {
2585 Base::SendRtcpToNoRtcp();
2586 }
2587
2525 TEST_F(VoiceChannelDoubleThreadTest, SendRtcpToRtcp) { 2588 TEST_F(VoiceChannelDoubleThreadTest, SendRtcpToRtcp) {
2526 Base::SendRtcpToRtcp(); 2589 Base::SendRtcpToRtcp();
2527 } 2590 }
2528 2591
2529 TEST_F(VoiceChannelDoubleThreadTest, SendRtcpMuxToRtcp) { 2592 TEST_F(VoiceChannelDoubleThreadTest, SendRtcpMuxToRtcp) {
2530 Base::SendRtcpMuxToRtcp(); 2593 Base::SendRtcpMuxToRtcp();
2531 } 2594 }
2532 2595
2533 TEST_F(VoiceChannelDoubleThreadTest, SendRtcpMuxToRtcpMux) { 2596 TEST_F(VoiceChannelDoubleThreadTest, SendRtcpMuxToRtcpMux) {
2534 Base::SendRtcpMuxToRtcpMux(); 2597 Base::SendRtcpMuxToRtcpMux();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 TEST_F(VoiceChannelDoubleThreadTest, TestOnReadyToSend) { 2734 TEST_F(VoiceChannelDoubleThreadTest, TestOnReadyToSend) {
2672 Base::TestOnReadyToSend(); 2735 Base::TestOnReadyToSend();
2673 } 2736 }
2674 2737
2675 TEST_F(VoiceChannelDoubleThreadTest, TestOnReadyToSendWithRtcpMux) { 2738 TEST_F(VoiceChannelDoubleThreadTest, TestOnReadyToSendWithRtcpMux) {
2676 Base::TestOnReadyToSendWithRtcpMux(); 2739 Base::TestOnReadyToSendWithRtcpMux();
2677 } 2740 }
2678 2741
2679 // Test that we can scale the output volume properly for 1:1 calls. 2742 // Test that we can scale the output volume properly for 1:1 calls.
2680 TEST_F(VoiceChannelDoubleThreadTest, TestScaleVolume1to1Call) { 2743 TEST_F(VoiceChannelDoubleThreadTest, TestScaleVolume1to1Call) {
2681 CreateChannels(0, 0); 2744 CreateChannels(RTCP, RTCP);
2682 EXPECT_TRUE(SendInitiate()); 2745 EXPECT_TRUE(SendInitiate());
2683 EXPECT_TRUE(SendAccept()); 2746 EXPECT_TRUE(SendAccept());
2684 double volume; 2747 double volume;
2685 2748
2686 // Default is (1.0). 2749 // Default is (1.0).
2687 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume)); 2750 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2688 EXPECT_DOUBLE_EQ(1.0, volume); 2751 EXPECT_DOUBLE_EQ(1.0, volume);
2689 // invalid ssrc. 2752 // invalid ssrc.
2690 EXPECT_FALSE(media_channel1_->GetOutputVolume(3, &volume)); 2753 EXPECT_FALSE(media_channel1_->GetOutputVolume(3, &volume));
2691 2754
2692 // Set scale to (1.5). 2755 // Set scale to (1.5).
2693 EXPECT_TRUE(channel1_->SetOutputVolume(0, 1.5)); 2756 EXPECT_TRUE(channel1_->SetOutputVolume(0, 1.5));
2694 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume)); 2757 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2695 EXPECT_DOUBLE_EQ(1.5, volume); 2758 EXPECT_DOUBLE_EQ(1.5, volume);
2696 2759
2697 // Set scale to (0). 2760 // Set scale to (0).
2698 EXPECT_TRUE(channel1_->SetOutputVolume(0, 0.0)); 2761 EXPECT_TRUE(channel1_->SetOutputVolume(0, 0.0));
2699 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume)); 2762 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2700 EXPECT_DOUBLE_EQ(0.0, volume); 2763 EXPECT_DOUBLE_EQ(0.0, volume);
2701 } 2764 }
2702 2765
2703 // Test that we can scale the output volume properly for multiway calls. 2766 // Test that we can scale the output volume properly for multiway calls.
2704 TEST_F(VoiceChannelDoubleThreadTest, TestScaleVolumeMultiwayCall) { 2767 TEST_F(VoiceChannelDoubleThreadTest, TestScaleVolumeMultiwayCall) {
2705 CreateChannels(0, 0); 2768 CreateChannels(RTCP, RTCP);
2706 EXPECT_TRUE(SendInitiate()); 2769 EXPECT_TRUE(SendInitiate());
2707 EXPECT_TRUE(SendAccept()); 2770 EXPECT_TRUE(SendAccept());
2708 EXPECT_TRUE(AddStream1(1)); 2771 EXPECT_TRUE(AddStream1(1));
2709 EXPECT_TRUE(AddStream1(2)); 2772 EXPECT_TRUE(AddStream1(2));
2710 2773
2711 double volume; 2774 double volume;
2712 // Default is (1.0). 2775 // Default is (1.0).
2713 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume)); 2776 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2714 EXPECT_DOUBLE_EQ(1.0, volume); 2777 EXPECT_DOUBLE_EQ(1.0, volume);
2715 EXPECT_TRUE(media_channel1_->GetOutputVolume(1, &volume)); 2778 EXPECT_TRUE(media_channel1_->GetOutputVolume(1, &volume));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2844 } 2907 }
2845 2908
2846 TEST_F(VideoChannelSingleThreadTest, TestCallTeardownRtcpMux) { 2909 TEST_F(VideoChannelSingleThreadTest, TestCallTeardownRtcpMux) {
2847 Base::TestCallTeardownRtcpMux(); 2910 Base::TestCallTeardownRtcpMux();
2848 } 2911 }
2849 2912
2850 TEST_F(VideoChannelSingleThreadTest, SendRtpToRtp) { 2913 TEST_F(VideoChannelSingleThreadTest, SendRtpToRtp) {
2851 Base::SendRtpToRtp(); 2914 Base::SendRtpToRtp();
2852 } 2915 }
2853 2916
2917 TEST_F(VideoChannelSingleThreadTest, SendNoRtcpToNoRtcp) {
2918 Base::SendNoRtcpToNoRtcp();
2919 }
2920
2921 TEST_F(VideoChannelSingleThreadTest, SendNoRtcpToRtcp) {
2922 Base::SendNoRtcpToRtcp();
2923 }
2924
2925 TEST_F(VideoChannelSingleThreadTest, SendRtcpToNoRtcp) {
2926 Base::SendRtcpToNoRtcp();
2927 }
2928
2854 TEST_F(VideoChannelSingleThreadTest, SendRtcpToRtcp) { 2929 TEST_F(VideoChannelSingleThreadTest, SendRtcpToRtcp) {
2855 Base::SendRtcpToRtcp(); 2930 Base::SendRtcpToRtcp();
2856 } 2931 }
2857 2932
2858 TEST_F(VideoChannelSingleThreadTest, SendRtcpMuxToRtcp) { 2933 TEST_F(VideoChannelSingleThreadTest, SendRtcpMuxToRtcp) {
2859 Base::SendRtcpMuxToRtcp(); 2934 Base::SendRtcpMuxToRtcp();
2860 } 2935 }
2861 2936
2862 TEST_F(VideoChannelSingleThreadTest, SendRtcpMuxToRtcpMux) { 2937 TEST_F(VideoChannelSingleThreadTest, SendRtcpMuxToRtcpMux) {
2863 Base::SendRtcpMuxToRtcpMux(); 2938 Base::SendRtcpMuxToRtcpMux();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 } 3151 }
3077 3152
3078 TEST_F(VideoChannelDoubleThreadTest, TestCallTeardownRtcpMux) { 3153 TEST_F(VideoChannelDoubleThreadTest, TestCallTeardownRtcpMux) {
3079 Base::TestCallTeardownRtcpMux(); 3154 Base::TestCallTeardownRtcpMux();
3080 } 3155 }
3081 3156
3082 TEST_F(VideoChannelDoubleThreadTest, SendRtpToRtp) { 3157 TEST_F(VideoChannelDoubleThreadTest, SendRtpToRtp) {
3083 Base::SendRtpToRtp(); 3158 Base::SendRtpToRtp();
3084 } 3159 }
3085 3160
3161 TEST_F(VideoChannelDoubleThreadTest, SendNoRtcpToNoRtcp) {
3162 Base::SendNoRtcpToNoRtcp();
3163 }
3164
3165 TEST_F(VideoChannelDoubleThreadTest, SendNoRtcpToRtcp) {
3166 Base::SendNoRtcpToRtcp();
3167 }
3168
3169 TEST_F(VideoChannelDoubleThreadTest, SendRtcpToNoRtcp) {
3170 Base::SendRtcpToNoRtcp();
3171 }
3172
3086 TEST_F(VideoChannelDoubleThreadTest, SendRtcpToRtcp) { 3173 TEST_F(VideoChannelDoubleThreadTest, SendRtcpToRtcp) {
3087 Base::SendRtcpToRtcp(); 3174 Base::SendRtcpToRtcp();
3088 } 3175 }
3089 3176
3090 TEST_F(VideoChannelDoubleThreadTest, SendRtcpMuxToRtcp) { 3177 TEST_F(VideoChannelDoubleThreadTest, SendRtcpMuxToRtcp) {
3091 Base::SendRtcpMuxToRtcp(); 3178 Base::SendRtcpMuxToRtcp();
3092 } 3179 }
3093 3180
3094 TEST_F(VideoChannelDoubleThreadTest, SendRtcpMuxToRtcpMux) { 3181 TEST_F(VideoChannelDoubleThreadTest, SendRtcpMuxToRtcpMux) {
3095 Base::SendRtcpMuxToRtcpMux(); 3182 Base::SendRtcpMuxToRtcpMux();
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 rtc::Thread* worker_thread, 3335 rtc::Thread* worker_thread,
3249 rtc::Thread* network_thread, 3336 rtc::Thread* network_thread,
3250 cricket::MediaEngineInterface* engine, 3337 cricket::MediaEngineInterface* engine,
3251 cricket::FakeDataMediaChannel* ch, 3338 cricket::FakeDataMediaChannel* ch,
3252 cricket::TransportController* transport_controller, 3339 cricket::TransportController* transport_controller,
3253 int flags) { 3340 int flags) {
3254 rtc::Thread* signaling_thread = 3341 rtc::Thread* signaling_thread =
3255 transport_controller ? transport_controller->signaling_thread() : nullptr; 3342 transport_controller ? transport_controller->signaling_thread() : nullptr;
3256 cricket::RtpDataChannel* channel = new cricket::RtpDataChannel( 3343 cricket::RtpDataChannel* channel = new cricket::RtpDataChannel(
3257 worker_thread, network_thread, signaling_thread, ch, cricket::CN_DATA, 3344 worker_thread, network_thread, signaling_thread, ch, cricket::CN_DATA,
3258 (flags & RTCP_MUX_REQUIRED) != 0, (flags & SECURE) != 0); 3345 (flags & RTCP) != 0, (flags & SECURE) != 0);
3259 rtc::CryptoOptions crypto_options; 3346 rtc::CryptoOptions crypto_options;
3260 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; 3347 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0;
3261 channel->SetCryptoOptions(crypto_options); 3348 channel->SetCryptoOptions(crypto_options);
3262 cricket::TransportChannel* rtp_transport = 3349 cricket::TransportChannel* rtp_transport =
3263 transport_controller->CreateTransportChannel( 3350 transport_controller->CreateTransportChannel(
3264 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); 3351 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP);
3265 cricket::TransportChannel* rtcp_transport = nullptr; 3352 cricket::TransportChannel* rtcp_transport = nullptr;
3266 if (channel->NeedsRtcpTransport()) { 3353 if (channel->NeedsRtcpTransport()) {
3267 rtcp_transport = transport_controller->CreateTransportChannel( 3354 rtcp_transport = transport_controller->CreateTransportChannel(
3268 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); 3355 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3372 } 3459 }
3373 3460
3374 TEST_F(RtpDataChannelSingleThreadTest, TestOnReadyToSendWithRtcpMux) { 3461 TEST_F(RtpDataChannelSingleThreadTest, TestOnReadyToSendWithRtcpMux) {
3375 Base::TestOnReadyToSendWithRtcpMux(); 3462 Base::TestOnReadyToSendWithRtcpMux();
3376 } 3463 }
3377 3464
3378 TEST_F(RtpDataChannelSingleThreadTest, SendRtpToRtp) { 3465 TEST_F(RtpDataChannelSingleThreadTest, SendRtpToRtp) {
3379 Base::SendRtpToRtp(); 3466 Base::SendRtpToRtp();
3380 } 3467 }
3381 3468
3469 TEST_F(RtpDataChannelSingleThreadTest, SendNoRtcpToNoRtcp) {
3470 Base::SendNoRtcpToNoRtcp();
3471 }
3472
3473 TEST_F(RtpDataChannelSingleThreadTest, SendNoRtcpToRtcp) {
3474 Base::SendNoRtcpToRtcp();
3475 }
3476
3477 TEST_F(RtpDataChannelSingleThreadTest, SendRtcpToNoRtcp) {
3478 Base::SendRtcpToNoRtcp();
3479 }
3480
3382 TEST_F(RtpDataChannelSingleThreadTest, SendRtcpToRtcp) { 3481 TEST_F(RtpDataChannelSingleThreadTest, SendRtcpToRtcp) {
3383 Base::SendRtcpToRtcp(); 3482 Base::SendRtcpToRtcp();
3384 } 3483 }
3385 3484
3386 TEST_F(RtpDataChannelSingleThreadTest, SendRtcpMuxToRtcp) { 3485 TEST_F(RtpDataChannelSingleThreadTest, SendRtcpMuxToRtcp) {
3387 Base::SendRtcpMuxToRtcp(); 3486 Base::SendRtcpMuxToRtcp();
3388 } 3487 }
3389 3488
3390 TEST_F(RtpDataChannelSingleThreadTest, SendRtcpMuxToRtcpMux) { 3489 TEST_F(RtpDataChannelSingleThreadTest, SendRtcpMuxToRtcpMux) {
3391 Base::SendRtcpMuxToRtcpMux(); 3490 Base::SendRtcpMuxToRtcpMux();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3504 } 3603 }
3505 3604
3506 TEST_F(RtpDataChannelDoubleThreadTest, TestOnReadyToSendWithRtcpMux) { 3605 TEST_F(RtpDataChannelDoubleThreadTest, TestOnReadyToSendWithRtcpMux) {
3507 Base::TestOnReadyToSendWithRtcpMux(); 3606 Base::TestOnReadyToSendWithRtcpMux();
3508 } 3607 }
3509 3608
3510 TEST_F(RtpDataChannelDoubleThreadTest, SendRtpToRtp) { 3609 TEST_F(RtpDataChannelDoubleThreadTest, SendRtpToRtp) {
3511 Base::SendRtpToRtp(); 3610 Base::SendRtpToRtp();
3512 } 3611 }
3513 3612
3613 TEST_F(RtpDataChannelDoubleThreadTest, SendNoRtcpToNoRtcp) {
3614 Base::SendNoRtcpToNoRtcp();
3615 }
3616
3617 TEST_F(RtpDataChannelDoubleThreadTest, SendNoRtcpToRtcp) {
3618 Base::SendNoRtcpToRtcp();
3619 }
3620
3621 TEST_F(RtpDataChannelDoubleThreadTest, SendRtcpToNoRtcp) {
3622 Base::SendRtcpToNoRtcp();
3623 }
3624
3514 TEST_F(RtpDataChannelDoubleThreadTest, SendRtcpToRtcp) { 3625 TEST_F(RtpDataChannelDoubleThreadTest, SendRtcpToRtcp) {
3515 Base::SendRtcpToRtcp(); 3626 Base::SendRtcpToRtcp();
3516 } 3627 }
3517 3628
3518 TEST_F(RtpDataChannelDoubleThreadTest, SendRtcpMuxToRtcp) { 3629 TEST_F(RtpDataChannelDoubleThreadTest, SendRtcpMuxToRtcp) {
3519 Base::SendRtcpMuxToRtcp(); 3630 Base::SendRtcpMuxToRtcp();
3520 } 3631 }
3521 3632
3522 TEST_F(RtpDataChannelDoubleThreadTest, SendRtcpMuxToRtcpMux) { 3633 TEST_F(RtpDataChannelDoubleThreadTest, SendRtcpMuxToRtcpMux) {
3523 Base::SendRtcpMuxToRtcpMux(); 3634 Base::SendRtcpMuxToRtcpMux();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3571 }; 3682 };
3572 rtc::CopyOnWriteBuffer payload(data, 3); 3683 rtc::CopyOnWriteBuffer payload(data, 3);
3573 cricket::SendDataResult result; 3684 cricket::SendDataResult result;
3574 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 3685 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
3575 EXPECT_EQ(params.ssrc, 3686 EXPECT_EQ(params.ssrc,
3576 media_channel1_->last_sent_data_params().ssrc); 3687 media_channel1_->last_sent_data_params().ssrc);
3577 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 3688 EXPECT_EQ("foo", media_channel1_->last_sent_data());
3578 } 3689 }
3579 3690
3580 // TODO(pthatcher): TestSetReceiver? 3691 // TODO(pthatcher): TestSetReceiver?
OLDNEW
« no previous file with comments | « webrtc/pc/channel.cc ('k') | webrtc/pc/channelmanager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698