Skip to content

Commit

Permalink
Bug 1874471: Disable payload-type matching for filters that know an s…
Browse files Browse the repository at this point in the history
…src. r=mjf

Depends on D201766

Differential Revision: https://phabricator.services.mozilla.com/D201767
  • Loading branch information
docfaraday committed Feb 20, 2024
1 parent 891f124 commit c31b444
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
24 changes: 14 additions & 10 deletions dom/media/webrtc/transportbridge/MediaPipelineFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,24 @@ bool MediaPipelineFilter::Filter(const webrtc::RTPHeader& header) {
// Remote SSRC based filtering
//

if (remote_ssrc_set_.count(header.ssrc)) {
if (!remote_ssrc_set_.empty()) {
if (remote_ssrc_set_.count(header.ssrc)) {
DEBUG_LOG(
("MediaPipelineFilter SSRC: %u matched remote SSRC set."
" passing packet",
header.ssrc));
return true;
}
DEBUG_LOG(
("MediaPipelineFilter SSRC: %u matched remote SSRC set."
" passing packet",
header.ssrc));
return true;
("MediaPipelineFilter SSRC: %u did not match any of %zu"
" remote SSRCS.",
header.ssrc, remote_ssrc_set_.size()));
return false;
}
DEBUG_LOG(
("MediaPipelineFilter SSRC: %u did not match any of %zu"
" remote SSRCS.",
header.ssrc, remote_ssrc_set_.size()));

//
// PT, payload type, last ditch effort filtering
// PT, payload type, last ditch effort filtering. We only try this if we do
// not have any ssrcs configured (either by learning them, or negotiation).
//

if (receive_payload_type_set_.count(header.payloadType)) {
Expand Down
14 changes: 14 additions & 0 deletions media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -630,6 +639,11 @@ TEST_F(MediaPipelineFilterTest, TestPayloadTypeFilter) {
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) {
Expand Down

0 comments on commit c31b444

Please sign in to comment.