Bug 1744098: Test-case for bug. r=mjf

Differential Revision: https://phabricator.services.mozilla.com/D132827
This commit is contained in:
Byron Campen [:bwc] 2021-12-03 21:12:11 +00:00
parent da4e10d9f4
commit 6c48e39691
2 changed files with 81 additions and 0 deletions

View File

@ -1004,6 +1004,11 @@ class SdpRtcpFbAttributeList : public SdpAttribute {
Type type;
std::string parameter;
std::string extra;
// TODO(bug 1744307): Use =default here once it is supported
bool operator==(const Feedback& aOther) const {
return pt == aOther.pt && type == aOther.type &&
parameter == aOther.parameter && extra == aOther.extra;
}
};
void PushEntry(const std::string& pt, Type type,

View File

@ -12,6 +12,7 @@
#include "jsep/JsepTrack.h"
#include "sdp/SipccSdp.h"
#include "sdp/SipccSdpParser.h"
#include "sdp/SdpHelper.h"
namespace mozilla {
@ -1442,4 +1443,79 @@ TEST_F(JsepTrackTest, NonDefaultOpusParameters) {
VERIFY_OPUS_FORCE_MONO(mRecvAns, true);
}
TEST_F(JsepTrackTest, RtcpFbWithPayloadTypeAsymmetry) {
std::vector<std::string> expectedAckFbTypes;
std::vector<std::string> expectedNackFbTypes{"", "pli"};
std::vector<std::string> expectedCcmFbTypes{"fir"};
std::vector<SdpRtcpFbAttributeList::Feedback> expectedOtherFbTypes{
{"", SdpRtcpFbAttributeList::kRemb, "", ""},
{"", SdpRtcpFbAttributeList::kTransportCC, "", ""}};
InitCodecs();
// On offerer, configure to support remb and transport-cc on video codecs
for (auto& codec : mOffCodecs) {
if (codec->mType == SdpMediaSection::kVideo) {
auto& videoCodec = static_cast<JsepVideoCodecDescription&>(*codec);
videoCodec.EnableRemb();
videoCodec.EnableTransportCC();
}
}
InitTracks(SdpMediaSection::kVideo);
InitSdp(SdpMediaSection::kVideo);
CreateOffer();
// We do not bother trying to bamboozle the answerer into doing asymmetric
// payload types, we just use a raw SDP.
const std::string answer =
"v=0\r\n"
"o=- 0 0 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
"t=0 0\r\n"
"a=msid-semantic:WMS *\r\n"
"m=video 0 UDP/TLS/RTP/SAVPF 136\r\n"
"c=IN IP4 0.0.0.0\r\n"
"a=sendrecv\r\n"
"a=fmtp:136 "
"profile-level-id=42e00d;level-asymmetry-allowed=1;packetization-mode="
"1\r\n"
"a=msid:stream_id\r\n"
"a=rtcp-fb:136 nack\r\n"
"a=rtcp-fb:136 nack pli\r\n"
"a=rtcp-fb:136 ccm fir\r\n"
"a=rtcp-fb:136 goog-remb\r\n"
"a=rtcp-fb:136 transport-cc\r\n"
"a=rtpmap:136 H264/90000\r\n"
"a=ssrc:2025549043 cname:\r\n";
UniquePtr<SdpParser> parser(new SipccSdpParser);
mAnswer = std::move(parser->Parse(answer)->Sdp());
ASSERT_TRUE(mAnswer);
std::cerr << "Offer SDP: " << std::endl;
mOffer->Serialize(std::cerr);
std::cerr << "Answer SDP: " << std::endl;
mAnswer->Serialize(std::cerr);
mRecvOff.UpdateRecvTrack(*mAnswer, GetAnswer());
mRecvOff.Negotiate(GetAnswer(), GetAnswer());
mSendOff.Negotiate(GetAnswer(), GetAnswer());
ASSERT_TRUE(mSendOff.GetNegotiatedDetails());
ASSERT_TRUE(mRecvOff.GetNegotiatedDetails());
UniquePtr<JsepVideoCodecDescription> codec;
ASSERT_TRUE((codec = GetVideoCodec(mSendOff)));
ASSERT_EQ("136", codec->mDefaultPt)
<< "Offerer should have seen answer asymmetry!";
ASSERT_TRUE((codec = GetVideoCodec(mRecvOff)));
ASSERT_EQ("126", codec->mDefaultPt);
ASSERT_EQ(expectedAckFbTypes, codec->mAckFbTypes);
ASSERT_EQ(expectedNackFbTypes, codec->mNackFbTypes);
ASSERT_EQ(expectedCcmFbTypes, codec->mCcmFbTypes);
ASSERT_EQ(expectedOtherFbTypes, codec->mOtherFbTypes);
}
} // namespace mozilla