Allow all "token" chars from RFC 4566 when checking for legal mid names.

Previously only alphanumeric characters were allowed.

Bug: webrtc:9537
Change-Id: I3fd793ad88520b25ecd884efe3a698f2f0af4639
Reviewed-on: https://webrtc-review.googlesource.com/89388
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24167}
This commit is contained in:
Joachim Bauch
2018-08-01 10:12:00 +02:00
committed by Commit Bot
parent 78026754a7
commit d3b7ec2e91
6 changed files with 77 additions and 7 deletions

View File

@ -12,6 +12,7 @@
#include <algorithm>
#include <memory>
#include <string>
#include <vector>
#include "rtc_base/checks.h"
@ -160,4 +161,54 @@ TEST_F(RtpRtcpAPITest, RtxSender) {
EXPECT_EQ(kRtxRetransmitted, module_->RtxSendStatus());
}
TEST_F(RtpRtcpAPITest, LegalMidName) {
static const std::string kLegalMidNames[] = {
// clang-format off
"audio",
"audio0",
"audio_0",
// clang-format on
};
for (const auto& name : kLegalMidNames) {
EXPECT_TRUE(StreamId::IsLegalMidName(name))
<< "Mid should be legal: " << name;
}
static const std::string kNonLegalMidNames[] = {
// clang-format off
"",
"(audio0)",
// clang-format on
};
for (const auto& name : kNonLegalMidNames) {
EXPECT_FALSE(StreamId::IsLegalMidName(name))
<< "Mid should not be legal: " << name;
}
}
TEST_F(RtpRtcpAPITest, LegalRsidName) {
static const std::string kLegalRsidNames[] = {
// clang-format off
"audio",
"audio0",
// clang-format on
};
for (const auto& name : kLegalRsidNames) {
EXPECT_TRUE(StreamId::IsLegalRsidName(name))
<< "Rsid should be legal: " << name;
}
static const std::string kNonLegalRsidNames[] = {
// clang-format off
"",
"audio_0",
"(audio0)",
// clang-format on
};
for (const auto& name : kNonLegalRsidNames) {
EXPECT_FALSE(StreamId::IsLegalRsidName(name))
<< "Rsid should not be legal: " << name;
}
}
} // namespace webrtc