OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 } | 518 } |
519 | 519 |
520 void RemoveMsidFromReceivedSdp(bool remove) { remove_msid_ = remove; } | 520 void RemoveMsidFromReceivedSdp(bool remove) { remove_msid_ = remove; } |
521 | 521 |
522 void RemoveSdesCryptoFromReceivedSdp(bool remove) { remove_sdes_ = remove; } | 522 void RemoveSdesCryptoFromReceivedSdp(bool remove) { remove_sdes_ = remove; } |
523 | 523 |
524 void RemoveBundleFromReceivedSdp(bool remove) { remove_bundle_ = remove; } | 524 void RemoveBundleFromReceivedSdp(bool remove) { remove_bundle_ = remove; } |
525 | 525 |
526 void RemoveCvoFromReceivedSdp(bool remove) { remove_cvo_ = remove; } | 526 void RemoveCvoFromReceivedSdp(bool remove) { remove_cvo_ = remove; } |
527 | 527 |
528 void MakeRealMaxBundleOfferFromReceivedSdp(bool real) { | |
529 make_real_max_bundle_offer_ = real; | |
pthatcher1
2017/02/17 19:17:32
A better name might be:
modify_remote_offers_to_s
Taylor Brandstetter
2017/02/17 21:49:14
Replaced "real" with "spec compliant".
| |
530 } | |
531 | |
528 bool can_receive_audio() { | 532 bool can_receive_audio() { |
529 bool value; | 533 bool value; |
530 if (prefer_constraint_apis_) { | 534 if (prefer_constraint_apis_) { |
531 if (webrtc::FindConstraint( | 535 if (webrtc::FindConstraint( |
532 &offer_answer_constraints_, | 536 &offer_answer_constraints_, |
533 MediaConstraintsInterface::kOfferToReceiveAudio, &value, | 537 MediaConstraintsInterface::kOfferToReceiveAudio, &value, |
534 nullptr)) { | 538 nullptr)) { |
535 return value; | 539 return value; |
536 } | 540 } |
537 return true; | 541 return true; |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1049 } | 1053 } |
1050 | 1054 |
1051 void HandleIncomingOffer(const std::string& msg) { | 1055 void HandleIncomingOffer(const std::string& msg) { |
1052 LOG(INFO) << id_ << "HandleIncomingOffer "; | 1056 LOG(INFO) << id_ << "HandleIncomingOffer "; |
1053 if (NumberOfLocalMediaStreams() == 0 && auto_add_stream_) { | 1057 if (NumberOfLocalMediaStreams() == 0 && auto_add_stream_) { |
1054 // If we are not sending any streams ourselves it is time to add some. | 1058 // If we are not sending any streams ourselves it is time to add some. |
1055 AddMediaStream(true, true); | 1059 AddMediaStream(true, true); |
1056 } | 1060 } |
1057 std::unique_ptr<SessionDescriptionInterface> desc( | 1061 std::unique_ptr<SessionDescriptionInterface> desc( |
1058 webrtc::CreateSessionDescription("offer", msg, nullptr)); | 1062 webrtc::CreateSessionDescription("offer", msg, nullptr)); |
1063 | |
1064 // Do the equivalent of setting the port to 0, adding a=bundle-only, and | |
1065 // removing a=ice-ufrag, a=ice-pwd, a=fingerprint and a=setup from all but | |
1066 // the first m= section. | |
1067 if (make_real_max_bundle_offer_) { | |
1068 bool first = true; | |
1069 for (cricket::ContentInfo& content : desc->description()->contents()) { | |
1070 if (first) { | |
1071 first = false; | |
1072 continue; | |
1073 } | |
1074 content.bundle_only = true; | |
1075 } | |
1076 first = true; | |
1077 for (cricket::TransportInfo& transport : | |
1078 desc->description()->transport_infos()) { | |
1079 if (first) { | |
1080 first = false; | |
1081 continue; | |
1082 } | |
1083 transport.description.ice_ufrag.clear(); | |
1084 transport.description.ice_pwd.clear(); | |
1085 transport.description.connection_role = cricket::CONNECTIONROLE_NONE; | |
1086 transport.description.identity_fingerprint.reset(nullptr); | |
1087 } | |
1088 } | |
1089 | |
1059 EXPECT_TRUE(DoSetRemoteDescription(desc.release())); | 1090 EXPECT_TRUE(DoSetRemoteDescription(desc.release())); |
1060 // Set the RtpReceiverObserver after receivers are created. | 1091 // Set the RtpReceiverObserver after receivers are created. |
1061 SetRtpReceiverObservers(); | 1092 SetRtpReceiverObservers(); |
1062 std::unique_ptr<SessionDescriptionInterface> answer; | 1093 std::unique_ptr<SessionDescriptionInterface> answer; |
1063 EXPECT_TRUE(DoCreateAnswer(&answer)); | 1094 EXPECT_TRUE(DoCreateAnswer(&answer)); |
1064 std::string sdp; | 1095 std::string sdp; |
1065 EXPECT_TRUE(answer->ToString(&sdp)); | 1096 EXPECT_TRUE(answer->ToString(&sdp)); |
1066 EXPECT_TRUE(DoSetLocalDescription(answer.release())); | 1097 EXPECT_TRUE(DoSetLocalDescription(answer.release())); |
1067 SendSdpMessage(webrtc::SessionDescriptionInterface::kAnswer, sdp); | 1098 SendSdpMessage(webrtc::SessionDescriptionInterface::kAnswer, sdp); |
1068 } | 1099 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1209 webrtc::FakeConstraints offer_answer_constraints_; | 1240 webrtc::FakeConstraints offer_answer_constraints_; |
1210 PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options_; | 1241 PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options_; |
1211 bool remove_msid_ = false; // True if MSID should be removed in received SDP. | 1242 bool remove_msid_ = false; // True if MSID should be removed in received SDP. |
1212 bool remove_bundle_ = | 1243 bool remove_bundle_ = |
1213 false; // True if bundle should be removed in received SDP. | 1244 false; // True if bundle should be removed in received SDP. |
1214 bool remove_sdes_ = | 1245 bool remove_sdes_ = |
1215 false; // True if a=crypto should be removed in received SDP. | 1246 false; // True if a=crypto should be removed in received SDP. |
1216 // |remove_cvo_| is true if extension urn:3gpp:video-orientation should be | 1247 // |remove_cvo_| is true if extension urn:3gpp:video-orientation should be |
1217 // removed in the received SDP. | 1248 // removed in the received SDP. |
1218 bool remove_cvo_ = false; | 1249 bool remove_cvo_ = false; |
1250 // See LocalP2PTestWithRealMaxBundleOffer. | |
1251 bool make_real_max_bundle_offer_ = false; | |
1219 | 1252 |
1220 rtc::scoped_refptr<DataChannelInterface> data_channel_; | 1253 rtc::scoped_refptr<DataChannelInterface> data_channel_; |
1221 std::unique_ptr<MockDataChannelObserver> data_observer_; | 1254 std::unique_ptr<MockDataChannelObserver> data_observer_; |
1222 | 1255 |
1223 std::vector<std::unique_ptr<MockRtpReceiverObserver>> rtp_receiver_observers_; | 1256 std::vector<std::unique_ptr<MockRtpReceiverObserver>> rtp_receiver_observers_; |
1224 }; | 1257 }; |
1225 | 1258 |
1226 class P2PTestConductor : public testing::Test { | 1259 class P2PTestConductor : public testing::Test { |
1227 public: | 1260 public: |
1228 P2PTestConductor() | 1261 P2PTestConductor() |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1856 FakeConstraints constraint; | 1889 FakeConstraints constraint; |
1857 constraint.SetOptionalMaxWidth(320); | 1890 constraint.SetOptionalMaxWidth(320); |
1858 SetVideoConstraints(constraint, constraint); | 1891 SetVideoConstraints(constraint, constraint); |
1859 initializing_client()->AddMediaStream(true, true); | 1892 initializing_client()->AddMediaStream(true, true); |
1860 initializing_client()->AddMediaStream(false, true); | 1893 initializing_client()->AddMediaStream(false, true); |
1861 ASSERT_EQ(2u, initializing_client()->NumberOfLocalMediaStreams()); | 1894 ASSERT_EQ(2u, initializing_client()->NumberOfLocalMediaStreams()); |
1862 LocalP2PTest(); | 1895 LocalP2PTest(); |
1863 EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); | 1896 EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); |
1864 } | 1897 } |
1865 | 1898 |
1899 // Test that if applying a true "max bundle" offer, which uses ports of 0, | |
1900 // "a=bundle-only", omitting "a=fingerprint", "a=setup", "a=ice-ufrag" and | |
1901 // "a=ice-pwd" for all but the audio "m=" section, negotiation still completes | |
1902 // successfully and media flows. | |
1903 // TODO(deadbeef): Update this test to also omit "a=rtcp-mux", once that works. | |
1904 // TODO(deadbeef): Won't need this test once we start generating actual | |
1905 // standards-compliant SDP. | |
1906 TEST_F(P2PTestConductor, LocalP2PTestWithRealMaxBundleOffer) { | |
pthatcher1
2017/02/17 19:17:32
A better test name might be IncomingOfferWithSpecC
| |
1907 ASSERT_TRUE(CreateTestClients()); | |
1908 receiving_client()->MakeRealMaxBundleOfferFromReceivedSdp(true); | |
1909 LocalP2PTest(); | |
1910 } | |
1911 | |
1866 // Test that we can receive the audio output level from a remote audio track. | 1912 // Test that we can receive the audio output level from a remote audio track. |
1867 TEST_F(P2PTestConductor, GetAudioOutputLevelStats) { | 1913 TEST_F(P2PTestConductor, GetAudioOutputLevelStats) { |
1868 ASSERT_TRUE(CreateTestClients()); | 1914 ASSERT_TRUE(CreateTestClients()); |
1869 LocalP2PTest(); | 1915 LocalP2PTest(); |
1870 | 1916 |
1871 StreamCollectionInterface* remote_streams = | 1917 StreamCollectionInterface* remote_streams = |
1872 initializing_client()->remote_streams(); | 1918 initializing_client()->remote_streams(); |
1873 ASSERT_GT(remote_streams->count(), 0u); | 1919 ASSERT_GT(remote_streams->count(), 0u); |
1874 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); | 1920 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); |
1875 MediaStreamTrackInterface* remote_audio_track = | 1921 MediaStreamTrackInterface* remote_audio_track = |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2835 servers.push_back(server); | 2881 servers.push_back(server); |
2836 EXPECT_EQ(webrtc::RTCErrorType::NONE, | 2882 EXPECT_EQ(webrtc::RTCErrorType::NONE, |
2837 webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); | 2883 webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); |
2838 EXPECT_EQ(2U, turn_servers_.size()); | 2884 EXPECT_EQ(2U, turn_servers_.size()); |
2839 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); | 2885 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); |
2840 } | 2886 } |
2841 | 2887 |
2842 #endif // if !defined(THREAD_SANITIZER) | 2888 #endif // if !defined(THREAD_SANITIZER) |
2843 | 2889 |
2844 } // namespace | 2890 } // namespace |
OLD | NEW |