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

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

Issue 2810733003: Fix SDP stream ID mismatch issue when a track's stream changes. (Closed)
Patch Set: Created 3 years, 8 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
« webrtc/pc/mediasession.cc ('K') | « webrtc/pc/mediasession.cc ('k') | no next file » | 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 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 new FakeRTCCertificateGenerator()); 210 new FakeRTCCertificateGenerator());
211 PeerConnectionWrapper* client(new PeerConnectionWrapper(debug_name)); 211 PeerConnectionWrapper* client(new PeerConnectionWrapper(debug_name));
212 if (!client->Init(constraints, nullptr, nullptr, std::move(cert_generator), 212 if (!client->Init(constraints, nullptr, nullptr, std::move(cert_generator),
213 network_thread, worker_thread)) { 213 network_thread, worker_thread)) {
214 delete client; 214 delete client;
215 return nullptr; 215 return nullptr;
216 } 216 }
217 return client; 217 return client;
218 } 218 }
219 219
220 webrtc::PeerConnectionFactoryInterface* pc_factory() const {
221 return peer_connection_factory_.get();
222 }
223
220 webrtc::PeerConnectionInterface* pc() const { return peer_connection_.get(); } 224 webrtc::PeerConnectionInterface* pc() const { return peer_connection_.get(); }
221 225
222 // If a signaling message receiver is set (via ConnectFakeSignaling), this 226 // If a signaling message receiver is set (via ConnectFakeSignaling), this
223 // will set the whole offer/answer exchange in motion. Just need to wait for 227 // will set the whole offer/answer exchange in motion. Just need to wait for
224 // the signaling state to reach "stable". 228 // the signaling state to reach "stable".
225 void CreateAndSetAndSignalOffer() { 229 void CreateAndSetAndSignalOffer() {
226 auto offer = CreateOffer(); 230 auto offer = CreateOffer();
227 ASSERT_NE(nullptr, offer); 231 ASSERT_NE(nullptr, offer);
228 EXPECT_TRUE(SetLocalDescriptionAndSendSdpMessage(std::move(offer))); 232 EXPECT_TRUE(SetLocalDescriptionAndSendSdpMessage(std::move(offer)));
229 } 233 }
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 ASSERT_GT(callee()->pc()->GetReceivers().size(), 0u); 2770 ASSERT_GT(callee()->pc()->GetReceivers().size(), 0u);
2767 auto receiver = callee()->pc()->GetReceivers()[0]; 2771 auto receiver = callee()->pc()->GetReceivers()[0];
2768 ASSERT_EQ(receiver->media_type(), cricket::MEDIA_TYPE_AUDIO); 2772 ASSERT_EQ(receiver->media_type(), cricket::MEDIA_TYPE_AUDIO);
2769 2773
2770 auto contributing_sources = receiver->GetSources(); 2774 auto contributing_sources = receiver->GetSources();
2771 ASSERT_GT(receiver->GetParameters().encodings.size(), 0u); 2775 ASSERT_GT(receiver->GetParameters().encodings.size(), 0u);
2772 EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc, 2776 EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc,
2773 contributing_sources[0].source_id()); 2777 contributing_sources[0].source_id());
2774 } 2778 }
2775 2779
2780 // Test that if a track is removed and added again with a different stream ID,
2781 // the new stream ID is successfully communicated in SDP and media continues to
2782 // flow end-to-end.
2783 TEST_F(PeerConnectionIntegrationTest, AddTrackWithDifferentStreamId) {
2784 ASSERT_TRUE(CreatePeerConnectionWrappers());
2785 ConnectFakeSignaling();
2786
2787 rtc::scoped_refptr<MediaStreamInterface> stream_1 =
2788 caller()->pc_factory()->CreateLocalMediaStream("stream_1");
2789 rtc::scoped_refptr<MediaStreamInterface> stream_2 =
2790 caller()->pc_factory()->CreateLocalMediaStream("stream_2");
2791
2792 // Add track using stream 1, do offer/answer.
2793 rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
2794 caller()->CreateLocalAudioTrack();
2795 rtc::scoped_refptr<webrtc::RtpSenderInterface> sender =
2796 caller()->pc()->AddTrack(track, {stream_1.get()});
2797 caller()->CreateAndSetAndSignalOffer();
2798 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
2799 // Wait for one audio frame to be received by the callee.
2800 ExpectNewFramesReceivedWithWait(0, 0, 1, 0, kMaxWaitForFramesMs);
2801
2802 // Remove the sender, and create a new one with the new stream.
2803 caller()->pc()->RemoveTrack(sender);
2804 sender = caller()->pc()->AddTrack(track, {stream_2.get()});
2805 caller()->CreateAndSetAndSignalOffer();
2806 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
2807 // Wait for additional audio frames to be received by the callee.
2808 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0,
2809 kMaxWaitForFramesMs);
2810 }
2811
2776 } // namespace 2812 } // namespace
2777 2813
2778 #endif // if !defined(THREAD_SANITIZER) 2814 #endif // if !defined(THREAD_SANITIZER)
OLDNEW
« webrtc/pc/mediasession.cc ('K') | « webrtc/pc/mediasession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698