From 91d039b37f5ae3dd28cda1308bec466ac11d4ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 11 Jan 2018 17:43:30 +0100 Subject: [PATCH] Test creating two senders with the same track. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When https://crbug.com/webrtc/8734 is resolved this setup should be valid and CreateOffer() and SetLocalDescription() should work, but currently it doesn't. It probably fails because both senders are assigned the same ID (the track ID). EXPECT-ing the current behavior with a TODO referencing the bug. Bug: webrtc:8734 Change-Id: If2a9cc9b0be12c39def83b0e219e1ca82dbd7d65 Reviewed-on: https://webrtc-review.googlesource.com/39041 Reviewed-by: Steve Anton Commit-Queue: Henrik Boström Cr-Commit-Position: refs/heads/master@{#21654} --- pc/peerconnection_rtp_unittest.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pc/peerconnection_rtp_unittest.cc b/pc/peerconnection_rtp_unittest.cc index f418f7ee9f..12e58b7e65 100644 --- a/pc/peerconnection_rtp_unittest.cc +++ b/pc/peerconnection_rtp_unittest.cc @@ -866,4 +866,27 @@ TEST_F(PeerConnectionRtpUnifiedPlanTest, EXPECT_FALSE(caller->observer()->negotiation_needed()); } +// Sender setups in a call. + +class PeerConnectionSenderTest : public PeerConnectionRtpTest {}; + +TEST_F(PeerConnectionSenderTest, CreateTwoSendersWithSameTrack) { + auto caller = CreatePeerConnection(); + auto callee = CreatePeerConnection(); + + auto track = caller->CreateAudioTrack("audio_track"); + auto sender1 = caller->AddTrack(track); + ASSERT_TRUE(sender1); + // We need to temporarily reset the track for the subsequent AddTrack() to + // succeed. + EXPECT_TRUE(sender1->SetTrack(nullptr)); + auto sender2 = caller->AddTrack(track); + EXPECT_TRUE(sender2); + EXPECT_TRUE(sender1->SetTrack(track)); + + // TODO(hbos): When https://crbug.com/webrtc/8734 is resolved, this should + // return true, and doing |callee->SetRemoteDescription()| should work. + EXPECT_FALSE(caller->CreateOfferAndSetAsLocal()); +} + } // namespace webrtc