summaryrefslogtreecommitdiffstats
path: root/media/webrtc/signaling
diff options
context:
space:
mode:
Diffstat (limited to 'media/webrtc/signaling')
-rw-r--r--media/webrtc/signaling/gtest/jsep_session_unittest.cpp47
-rw-r--r--media/webrtc/signaling/gtest/jsep_track_unittest.cpp9
-rw-r--r--media/webrtc/signaling/gtest/mediapipeline_unittest.cpp18
3 files changed, 55 insertions, 19 deletions
diff --git a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
index 2ed2c4575a..2e4faa3af4 100644
--- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
@@ -4985,10 +4985,13 @@ TEST_F(JsepSessionTest, TestRtcpFbStar) {
}
}
-TEST_F(JsepSessionTest, TestUniquePayloadTypes) {
- // The audio payload types will all appear more than once, but the video
- // payload types will be unique.
- AddTracks(*mSessionOff, "audio,audio,video");
+TEST_F(JsepSessionTest, TestUniqueReceivePayloadTypes) {
+ // The audio payload types will all appear more than once.
+ // For the offerer, only one video m-section will be receiving, so those
+ // video payload types will be unique.
+ // On the other hand, the answerer will have two video m-sections receiving,
+ // so those _won't_ be unique.
+ AddTracks(*mSessionOff, "audio,audio,video,video");
AddTracks(*mSessionAns, "audio,audio,video");
std::string offer = CreateOffer();
@@ -5000,49 +5003,67 @@ TEST_F(JsepSessionTest, TestUniquePayloadTypes) {
auto offerTransceivers = GetTransceivers(*mSessionOff);
auto answerTransceivers = GetTransceivers(*mSessionAns);
- ASSERT_EQ(3U, offerTransceivers.size());
- ASSERT_EQ(3U, answerTransceivers.size());
+ ASSERT_EQ(4U, offerTransceivers.size());
+ ASSERT_EQ(4U, answerTransceivers.size());
ASSERT_FALSE(IsNull(offerTransceivers[0].mRecvTrack));
ASSERT_TRUE(offerTransceivers[0].mRecvTrack.GetNegotiatedDetails());
ASSERT_EQ(0U, offerTransceivers[0]
.mRecvTrack.GetNegotiatedDetails()
- ->GetUniquePayloadTypes()
+ ->GetUniqueReceivePayloadTypes()
.size());
ASSERT_FALSE(IsNull(offerTransceivers[1].mRecvTrack));
ASSERT_TRUE(offerTransceivers[1].mRecvTrack.GetNegotiatedDetails());
ASSERT_EQ(0U, offerTransceivers[1]
.mRecvTrack.GetNegotiatedDetails()
- ->GetUniquePayloadTypes()
+ ->GetUniqueReceivePayloadTypes()
.size());
+ // First video transceiver is the only one receiving, so gets unique pts.
ASSERT_FALSE(IsNull(offerTransceivers[2].mRecvTrack));
ASSERT_TRUE(offerTransceivers[2].mRecvTrack.GetNegotiatedDetails());
ASSERT_NE(0U, offerTransceivers[2]
.mRecvTrack.GetNegotiatedDetails()
- ->GetUniquePayloadTypes()
+ ->GetUniqueReceivePayloadTypes()
+ .size());
+
+ // First video transceiver is not receiving, so does not get unique pts.
+ ASSERT_TRUE(IsNull(offerTransceivers[3].mRecvTrack));
+ ASSERT_TRUE(offerTransceivers[3].mRecvTrack.GetNegotiatedDetails());
+ ASSERT_EQ(0U, offerTransceivers[3]
+ .mRecvTrack.GetNegotiatedDetails()
+ ->GetUniqueReceivePayloadTypes()
.size());
ASSERT_FALSE(IsNull(answerTransceivers[0].mRecvTrack));
ASSERT_TRUE(answerTransceivers[0].mRecvTrack.GetNegotiatedDetails());
ASSERT_EQ(0U, answerTransceivers[0]
.mRecvTrack.GetNegotiatedDetails()
- ->GetUniquePayloadTypes()
+ ->GetUniqueReceivePayloadTypes()
.size());
ASSERT_FALSE(IsNull(answerTransceivers[1].mRecvTrack));
ASSERT_TRUE(answerTransceivers[1].mRecvTrack.GetNegotiatedDetails());
ASSERT_EQ(0U, answerTransceivers[1]
.mRecvTrack.GetNegotiatedDetails()
- ->GetUniquePayloadTypes()
+ ->GetUniqueReceivePayloadTypes()
.size());
+ // Answerer is receiving two video streams with the same payload types.
+ // Neither recv track should have unique pts.
ASSERT_FALSE(IsNull(answerTransceivers[2].mRecvTrack));
ASSERT_TRUE(answerTransceivers[2].mRecvTrack.GetNegotiatedDetails());
- ASSERT_NE(0U, answerTransceivers[2]
+ ASSERT_EQ(0U, answerTransceivers[2]
+ .mRecvTrack.GetNegotiatedDetails()
+ ->GetUniqueReceivePayloadTypes()
+ .size());
+
+ ASSERT_FALSE(IsNull(answerTransceivers[3].mRecvTrack));
+ ASSERT_TRUE(answerTransceivers[3].mRecvTrack.GetNegotiatedDetails());
+ ASSERT_EQ(0U, answerTransceivers[3]
.mRecvTrack.GetNegotiatedDetails()
- ->GetUniquePayloadTypes()
+ ->GetUniqueReceivePayloadTypes()
.size());
}
diff --git a/media/webrtc/signaling/gtest/jsep_track_unittest.cpp b/media/webrtc/signaling/gtest/jsep_track_unittest.cpp
index cbb351c379..24e39b6a24 100644
--- a/media/webrtc/signaling/gtest/jsep_track_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_track_unittest.cpp
@@ -302,10 +302,11 @@ class JsepTrackTest : public JsepTrackTestBase {
SanityCheckEncodings(a.GetEncoding(i), b.GetEncoding(i));
}
- ASSERT_EQ(a.GetUniquePayloadTypes().size(),
- b.GetUniquePayloadTypes().size());
- for (size_t i = 0; i < a.GetUniquePayloadTypes().size(); ++i) {
- ASSERT_EQ(a.GetUniquePayloadTypes()[i], b.GetUniquePayloadTypes()[i]);
+ ASSERT_EQ(a.GetUniqueReceivePayloadTypes().size(),
+ b.GetUniqueReceivePayloadTypes().size());
+ for (size_t i = 0; i < a.GetUniqueReceivePayloadTypes().size(); ++i) {
+ ASSERT_EQ(a.GetUniqueReceivePayloadTypes()[i],
+ b.GetUniqueReceivePayloadTypes()[i]);
}
}
diff --git a/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp b/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
index afbdb85f18..032023d95f 100644
--- a/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
+++ b/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
@@ -598,6 +598,15 @@ TEST_F(MediaPipelineFilterTest, TestSSRCFilter) {
EXPECT_FALSE(Filter(filter, 556, 110));
}
+TEST_F(MediaPipelineFilterTest, TestSSRCFilterOverridesPayloadTypeFilter) {
+ MediaPipelineFilter filter;
+ filter.AddRemoteSSRC(555);
+ filter.AddUniqueReceivePT(110);
+ // We have a configured ssrc; do not allow payload type matching.
+ EXPECT_FALSE(Filter(filter, 556, 110));
+ EXPECT_TRUE(Filter(filter, 555, 110));
+}
+
#define SSRC(ssrc) \
((ssrc >> 24) & 0xFF), ((ssrc >> 16) & 0xFF), ((ssrc >> 8) & 0xFF), \
(ssrc & 0xFF)
@@ -627,9 +636,14 @@ TEST_F(MediaPipelineFilterTest, TestMidFilter) {
TEST_F(MediaPipelineFilterTest, TestPayloadTypeFilter) {
MediaPipelineFilter filter;
- filter.AddUniquePT(110);
+ filter.AddUniqueReceivePT(110);
EXPECT_TRUE(Filter(filter, 555, 110));
EXPECT_FALSE(Filter(filter, 556, 111));
+ // Matching based on unique payload type causes us to learn the ssrc.
+ EXPECT_TRUE(Filter(filter, 555, 98));
+ // Once we have learned an SSRC, do _not_ learn new ones based on payload
+ // type.
+ EXPECT_FALSE(Filter(filter, 557, 110));
}
TEST_F(MediaPipelineFilterTest, TestSSRCMovedWithMid) {
@@ -651,7 +665,7 @@ TEST_F(MediaPipelineFilterTest, TestRemoteSDPNoSSRCs) {
MediaPipelineFilter filter;
const auto mid = Some(std::string("mid0"));
filter.SetRemoteMediaStreamId(mid);
- filter.AddUniquePT(111);
+ filter.AddUniqueReceivePT(111);
EXPECT_TRUE(Filter(filter, 555, 110, mid));
EXPECT_TRUE(Filter(filter, 555, 110));