Don't create unsignalled receive streams for RTX, RED RTX, and ULPFEC packets.
BUG=webrtc:4389 Review URL: https://codereview.webrtc.org/1226093002 Cr-Commit-Position: refs/heads/master@{#9566}
This commit is contained in:
@ -1383,9 +1383,24 @@ void WebRtcVideoChannel2::OnPacketReceived(
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(pbos): Ignore unsignalled packets that don't use the video payload
|
||||
// (prevent creating default receivers for RTX configured as if it would
|
||||
// receive media payloads on those SSRCs).
|
||||
int payload_type = 0;
|
||||
if (!GetRtpPayloadType(packet->data(), packet->size(), &payload_type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// See if this payload_type is registered as one that usually gets its own
|
||||
// SSRC (RTX) or at least is safe to drop either way (ULPFEC). If it is, and
|
||||
// it wasn't handled above by DeliverPacket, that means we don't know what
|
||||
// stream it associates with, and we shouldn't ever create an implicit channel
|
||||
// for these.
|
||||
for (auto& codec : recv_codecs_) {
|
||||
if (payload_type == codec.rtx_payload_type ||
|
||||
payload_type == codec.fec.red_rtx_payload_type ||
|
||||
payload_type == codec.fec.ulpfec_payload_type) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (unsignalled_ssrc_handler_->OnUnsignalledSsrc(this, ssrc)) {
|
||||
case UnsignalledSsrcHandler::kDropPacket:
|
||||
return;
|
||||
|
@ -57,9 +57,12 @@ static const cricket::VideoCodec kH264Codec(102, "H264", 640, 400, 30, 0);
|
||||
static const cricket::VideoCodec kRedCodec(116, "red", 0, 0, 0, 0);
|
||||
static const cricket::VideoCodec kUlpfecCodec(117, "ulpfec", 0, 0, 0, 0);
|
||||
|
||||
static const uint8_t kRedRtxPayloadType = 125;
|
||||
|
||||
static const uint32 kSsrcs1[] = {1};
|
||||
static const uint32 kSsrcs3[] = {1, 2, 3};
|
||||
static const uint32 kRtxSsrcs1[] = {4};
|
||||
static const uint32 kIncomingUnsignalledSsrc = 0xC0FFEE;
|
||||
static const char kUnsupportedExtensionName[] =
|
||||
"urn:ietf:params:rtp-hdrext:unsupported";
|
||||
|
||||
@ -972,6 +975,8 @@ class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test,
|
||||
|
||||
void TestCpuAdaptation(bool enable_overuse, bool is_screenshare);
|
||||
void TestReceiverLocalSsrcConfiguration(bool receiver_first);
|
||||
void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type,
|
||||
bool expect_created_receive_stream);
|
||||
|
||||
FakeVideoSendStream* SetDenoisingOption(bool enabled) {
|
||||
VideoOptions options;
|
||||
@ -2582,6 +2587,58 @@ TEST_F(WebRtcVideoChannel2Test, ReportsSsrcGroupsInStats) {
|
||||
EXPECT_EQ(receiver_sp.ssrc_groups, info.receivers[0].ssrc_groups);
|
||||
}
|
||||
|
||||
void WebRtcVideoChannel2Test::TestReceiveUnsignalledSsrcPacket(
|
||||
uint8_t payload_type,
|
||||
bool expect_created_receive_stream) {
|
||||
std::vector<VideoCodec> codecs(engine_.codecs());
|
||||
// Add a RED RTX codec.
|
||||
VideoCodec red_rtx_codec =
|
||||
VideoCodec::CreateRtxCodec(kRedRtxPayloadType, kDefaultRedPlType);
|
||||
codecs.push_back(red_rtx_codec);
|
||||
EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
|
||||
|
||||
ASSERT_EQ(0u, fake_call_->GetVideoReceiveStreams().size());
|
||||
const size_t kDataLength = 12;
|
||||
uint8_t data[kDataLength];
|
||||
memset(data, 0, sizeof(data));
|
||||
|
||||
rtc::Set8(data, 1, payload_type);
|
||||
rtc::SetBE32(&data[8], kIncomingUnsignalledSsrc);
|
||||
rtc::Buffer packet(data, kDataLength);
|
||||
rtc::PacketTime packet_time;
|
||||
channel_->OnPacketReceived(&packet, packet_time);
|
||||
|
||||
if (expect_created_receive_stream) {
|
||||
EXPECT_EQ(1u, fake_call_->GetVideoReceiveStreams().size())
|
||||
<< "Should have created a receive stream for payload type: "
|
||||
<< payload_type;
|
||||
} else {
|
||||
EXPECT_EQ(0u, fake_call_->GetVideoReceiveStreams().size())
|
||||
<< "Shouldn't have created a receive stream for payload type: "
|
||||
<< payload_type;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoChannel2Test, Vp8PacketCreatesUnsignalledStream) {
|
||||
TestReceiveUnsignalledSsrcPacket(kDefaultVp8PlType, true);
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoChannel2Test, Vp9PacketCreatesUnsignalledStream) {
|
||||
TestReceiveUnsignalledSsrcPacket(kDefaultVp9PlType, true);
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoChannel2Test, RtxPacketDoesntCreateUnsignalledStream) {
|
||||
TestReceiveUnsignalledSsrcPacket(kDefaultRtxVp8PlType, false);
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoChannel2Test, UlpfecPacketDoesntCreateUnsignalledStream) {
|
||||
TestReceiveUnsignalledSsrcPacket(kDefaultUlpfecType, false);
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoChannel2Test, RedRtxPacketDoesntCreateUnsignalledStream) {
|
||||
TestReceiveUnsignalledSsrcPacket(kRedRtxPayloadType, false);
|
||||
}
|
||||
|
||||
void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration(
|
||||
bool receiver_first) {
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs()));
|
||||
|
Reference in New Issue
Block a user