Add GetSources to VideoRtpReceiver
BUG=webrtc:9770
Change-Id: I16143fce6eb727bbab0f6c621aa5b51bc6d28d6b
Reviewed-on: https://webrtc-review.googlesource.com/101600
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24858}
diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc
index dd977b4..3cf3e58 100644
--- a/pc/peerconnection_integrationtest.cc
+++ b/pc/peerconnection_integrationtest.cc
@@ -4308,7 +4308,7 @@
ASSERT_TRUE(ExpectNewFrames(media_expectations));
}
-TEST_P(PeerConnectionIntegrationTest, GetSources) {
+TEST_P(PeerConnectionIntegrationTest, GetSourcesAudio) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
caller()->AddAudioTrack();
@@ -4318,14 +4318,34 @@
MediaExpectations media_expectations;
media_expectations.CalleeExpectsSomeAudio(1);
ASSERT_TRUE(ExpectNewFrames(media_expectations));
- ASSERT_GT(callee()->pc()->GetReceivers().size(), 0u);
+ ASSERT_EQ(callee()->pc()->GetReceivers().size(), 1u);
auto receiver = callee()->pc()->GetReceivers()[0];
ASSERT_EQ(receiver->media_type(), cricket::MEDIA_TYPE_AUDIO);
-
- auto contributing_sources = receiver->GetSources();
+ auto sources = receiver->GetSources();
ASSERT_GT(receiver->GetParameters().encodings.size(), 0u);
EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc,
- contributing_sources[0].source_id());
+ sources[0].source_id());
+ EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
+}
+
+TEST_P(PeerConnectionIntegrationTest, GetSourcesVideo) {
+ ASSERT_TRUE(CreatePeerConnectionWrappers());
+ ConnectFakeSignaling();
+ caller()->AddVideoTrack();
+ caller()->CreateAndSetAndSignalOffer();
+ ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
+ // Wait for one video frame to be received by the callee.
+ MediaExpectations media_expectations;
+ media_expectations.CalleeExpectsSomeVideo(1);
+ ASSERT_TRUE(ExpectNewFrames(media_expectations));
+ ASSERT_EQ(callee()->pc()->GetReceivers().size(), 1u);
+ auto receiver = callee()->pc()->GetReceivers()[0];
+ ASSERT_EQ(receiver->media_type(), cricket::MEDIA_TYPE_VIDEO);
+ auto sources = receiver->GetSources();
+ ASSERT_GT(receiver->GetParameters().encodings.size(), 0u);
+ EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc,
+ sources[0].source_id());
+ EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
}
// Test that if a track is removed and added again with a different stream ID,