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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 326 } |
327 return false; | 327 return false; |
328 } | 328 } |
329 | 329 |
330 // Check if |senders| contains the specified sender, by id and stream id. | 330 // Check if |senders| contains the specified sender, by id and stream id. |
331 bool ContainsSender( | 331 bool ContainsSender( |
332 const std::vector<rtc::scoped_refptr<RtpSenderInterface>>& senders, | 332 const std::vector<rtc::scoped_refptr<RtpSenderInterface>>& senders, |
333 const std::string& id, | 333 const std::string& id, |
334 const std::string& stream_id) { | 334 const std::string& stream_id) { |
335 for (const auto& sender : senders) { | 335 for (const auto& sender : senders) { |
336 if (sender->id() == id && sender->stream_id() == stream_id) { | 336 if (sender->id() == id && sender->stream_ids()[0] == stream_id) { |
337 return true; | 337 return true; |
338 } | 338 } |
339 } | 339 } |
340 return false; | 340 return false; |
341 } | 341 } |
342 | 342 |
343 // Create a collection of streams. | 343 // Create a collection of streams. |
344 // CreateStreamCollection(1) creates a collection that | 344 // CreateStreamCollection(1) creates a collection that |
345 // correspond to kSdpStringWithStream1. | 345 // correspond to kSdpStringWithStream1. |
346 // CreateStreamCollection(2) correspond to kSdpStringWithStream1And2. | 346 // CreateStreamCollection(2) correspond to kSdpStringWithStream1And2. |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 pc_factory_->CreateLocalMediaStream(kStreamLabel1)); | 1159 pc_factory_->CreateLocalMediaStream(kStreamLabel1)); |
1160 std::vector<MediaStreamInterface*> stream_list; | 1160 std::vector<MediaStreamInterface*> stream_list; |
1161 stream_list.push_back(stream.get()); | 1161 stream_list.push_back(stream.get()); |
1162 scoped_refptr<AudioTrackInterface> audio_track( | 1162 scoped_refptr<AudioTrackInterface> audio_track( |
1163 pc_factory_->CreateAudioTrack("audio_track", nullptr)); | 1163 pc_factory_->CreateAudioTrack("audio_track", nullptr)); |
1164 scoped_refptr<VideoTrackInterface> video_track(pc_factory_->CreateVideoTrack( | 1164 scoped_refptr<VideoTrackInterface> video_track(pc_factory_->CreateVideoTrack( |
1165 "video_track", | 1165 "video_track", |
1166 pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer()))); | 1166 pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer()))); |
1167 auto audio_sender = pc_->AddTrack(audio_track, stream_list); | 1167 auto audio_sender = pc_->AddTrack(audio_track, stream_list); |
1168 auto video_sender = pc_->AddTrack(video_track, stream_list); | 1168 auto video_sender = pc_->AddTrack(video_track, stream_list); |
1169 EXPECT_EQ(kStreamLabel1, audio_sender->stream_id()); | 1169 EXPECT_EQ(1UL, audio_sender->stream_ids().size()); |
| 1170 EXPECT_EQ(kStreamLabel1, audio_sender->stream_ids()[0]); |
1170 EXPECT_EQ("audio_track", audio_sender->id()); | 1171 EXPECT_EQ("audio_track", audio_sender->id()); |
1171 EXPECT_EQ(audio_track, audio_sender->track()); | 1172 EXPECT_EQ(audio_track, audio_sender->track()); |
1172 EXPECT_EQ(kStreamLabel1, video_sender->stream_id()); | 1173 EXPECT_EQ(1UL, video_sender->stream_ids().size()); |
| 1174 EXPECT_EQ(kStreamLabel1, video_sender->stream_ids()[0]); |
1173 EXPECT_EQ("video_track", video_sender->id()); | 1175 EXPECT_EQ("video_track", video_sender->id()); |
1174 EXPECT_EQ(video_track, video_sender->track()); | 1176 EXPECT_EQ(video_track, video_sender->track()); |
1175 | 1177 |
1176 // Now create an offer and check for the senders. | 1178 // Now create an offer and check for the senders. |
1177 std::unique_ptr<SessionDescriptionInterface> offer; | 1179 std::unique_ptr<SessionDescriptionInterface> offer; |
1178 ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); | 1180 ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); |
1179 | 1181 |
1180 const cricket::ContentInfo* audio_content = | 1182 const cricket::ContentInfo* audio_content = |
1181 cricket::GetFirstAudioContent(offer->description()); | 1183 cricket::GetFirstAudioContent(offer->description()); |
1182 const cricket::AudioContentDescription* audio_desc = | 1184 const cricket::AudioContentDescription* audio_desc = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 auto audio_sender = | 1237 auto audio_sender = |
1236 pc_->AddTrack(audio_track, std::vector<MediaStreamInterface*>()); | 1238 pc_->AddTrack(audio_track, std::vector<MediaStreamInterface*>()); |
1237 auto video_sender = | 1239 auto video_sender = |
1238 pc_->AddTrack(video_track, std::vector<MediaStreamInterface*>()); | 1240 pc_->AddTrack(video_track, std::vector<MediaStreamInterface*>()); |
1239 EXPECT_EQ("audio_track", audio_sender->id()); | 1241 EXPECT_EQ("audio_track", audio_sender->id()); |
1240 EXPECT_EQ(audio_track, audio_sender->track()); | 1242 EXPECT_EQ(audio_track, audio_sender->track()); |
1241 EXPECT_EQ("video_track", video_sender->id()); | 1243 EXPECT_EQ("video_track", video_sender->id()); |
1242 EXPECT_EQ(video_track, video_sender->track()); | 1244 EXPECT_EQ(video_track, video_sender->track()); |
1243 // If the ID is truly a random GUID, it should be infinitely unlikely they | 1245 // If the ID is truly a random GUID, it should be infinitely unlikely they |
1244 // will be the same. | 1246 // will be the same. |
1245 EXPECT_NE(video_sender->stream_id(), audio_sender->stream_id()); | 1247 EXPECT_NE(video_sender->stream_ids(), audio_sender->stream_ids()); |
1246 } | 1248 } |
1247 | 1249 |
1248 TEST_F(PeerConnectionInterfaceTest, CreateOfferReceiveAnswer) { | 1250 TEST_F(PeerConnectionInterfaceTest, CreateOfferReceiveAnswer) { |
1249 InitiateCall(); | 1251 InitiateCall(); |
1250 WaitAndVerifyOnAddStream(kStreamLabel1); | 1252 WaitAndVerifyOnAddStream(kStreamLabel1); |
1251 VerifyRemoteRtpHeaderExtensions(); | 1253 VerifyRemoteRtpHeaderExtensions(); |
1252 } | 1254 } |
1253 | 1255 |
1254 TEST_F(PeerConnectionInterfaceTest, CreateOfferReceivePrAnswerAndAnswer) { | 1256 TEST_F(PeerConnectionInterfaceTest, CreateOfferReceivePrAnswerAndAnswer) { |
1255 CreatePeerConnection(); | 1257 CreatePeerConnection(); |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2810 FakeConstraints updated_answer_c; | 2812 FakeConstraints updated_answer_c; |
2811 answer_c.SetMandatoryReceiveAudio(false); | 2813 answer_c.SetMandatoryReceiveAudio(false); |
2812 answer_c.SetMandatoryReceiveVideo(false); | 2814 answer_c.SetMandatoryReceiveVideo(false); |
2813 | 2815 |
2814 cricket::MediaSessionOptions updated_answer_options; | 2816 cricket::MediaSessionOptions updated_answer_options; |
2815 EXPECT_TRUE( | 2817 EXPECT_TRUE( |
2816 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2818 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2817 EXPECT_TRUE(updated_answer_options.has_audio()); | 2819 EXPECT_TRUE(updated_answer_options.has_audio()); |
2818 EXPECT_TRUE(updated_answer_options.has_video()); | 2820 EXPECT_TRUE(updated_answer_options.has_video()); |
2819 } | 2821 } |
OLD | NEW |