Bug 1107307: Teach JsepSessionImpl to handle rtcp-fb:* r=drno

This commit is contained in:
Byron Campen [:bwc] 2014-12-04 09:26:59 -08:00
parent cb188bcb02
commit 5310184bc7
4 changed files with 44 additions and 3 deletions

View File

@ -131,7 +131,7 @@ struct JsepCodecDescription {
if (attrs.HasAttribute(SdpAttribute::kRtcpFbAttribute)) {
auto& rtcpfbs = attrs.GetRtcpFb().mFeedbacks;
for (auto i = rtcpfbs.begin(); i != rtcpfbs.end(); ++i) {
if (i->pt == negotiated->mDefaultPt) {
if (i->pt == negotiated->mDefaultPt || i->pt == "*") {
if (!negotiated->LoadRtcpFbs(*i)) {
// Remote parameters were invalid
return nullptr;

View File

@ -777,7 +777,11 @@ SipccSdpAttributeList::LoadRtcpFb(sdp_t* sdp, uint16_t level,
}
std::stringstream osPayloadType;
osPayloadType << rtcpfb->payload_num;
if (rtcpfb->payload_num == UINT16_MAX) {
osPayloadType << "*";
} else {
osPayloadType << rtcpfb->payload_num;
}
std::string pt(osPayloadType.str());
std::string extra(rtcpfb->extra);

View File

@ -1165,6 +1165,41 @@ TEST_F(JsepSessionTest, TestExtmap)
ASSERT_EQ(3U, answerExtmap[1].entry);
}
TEST_F(JsepSessionTest, TestRtcpFbStar)
{
AddTracks(&mSessionOff, "video");
AddTracks(&mSessionAns, "video");
std::string offer = CreateOffer();
SipccSdpParser parser;
UniquePtr<Sdp> parsedOffer = parser.Parse(offer);
auto* rtcpfbs = new SdpRtcpFbAttributeList;
rtcpfbs->PushEntry("*", SdpRtcpFbAttributeList::kNack);
parsedOffer->GetMediaSection(0).GetAttributeList().SetAttribute(rtcpfbs);
offer = parsedOffer->ToString();
SetLocalOffer(offer, CHECK_SUCCESS);
SetRemoteOffer(offer, CHECK_SUCCESS);
std::string answer = CreateAnswer();
SetLocalAnswer(answer, CHECK_SUCCESS);
SetRemoteAnswer(answer, CHECK_SUCCESS);
ASSERT_EQ(1U, mSessionAns.GetRemoteTrackCount());
RefPtr<JsepTrack> track;
ASSERT_EQ(NS_OK, mSessionAns.GetRemoteTrack(0, &track));
ASSERT_TRUE(track->GetNegotiatedDetails());
auto* details = track->GetNegotiatedDetails();
for (size_t i = 0; i < details->GetCodecCount(); ++i) {
const JsepCodecDescription* codec;
ASSERT_EQ(NS_OK, details->GetCodec(i, &codec));
const JsepVideoCodecDescription* videoCodec =
static_cast<const JsepVideoCodecDescription*>(codec);
ASSERT_EQ(1U, videoCodec->mNackFbTypes.size());
ASSERT_EQ("", videoCodec->mNackFbTypes[0]);
}
}
} // namespace mozilla
int

View File

@ -1782,6 +1782,7 @@ const std::string kBasicAudioVideoDataOffer =
"a=rtcp-fb:97 nack" CRLF
"a=rtcp-fb:97 nack pli" CRLF
"a=rtcp-fb:97 ccm fir" CRLF
"a=rtcp-fb:* ccm tmmbr" CRLF
"a=setup:actpass" CRLF
"a=rtcp-mux" CRLF
"m=application 9 DTLS/SCTP 5000" CRLF
@ -1868,7 +1869,7 @@ TEST_P(NewSdpTest, CheckRtcpFb) {
auto& video_attrs = mSdp->GetMediaSection(1).GetAttributeList();
ASSERT_TRUE(video_attrs.HasAttribute(SdpAttribute::kRtcpFbAttribute));
auto& rtcpfbs = video_attrs.GetRtcpFb().mFeedbacks;
ASSERT_EQ(18U, rtcpfbs.size());
ASSERT_EQ(19U, rtcpfbs.size());
CheckRtcpFb(rtcpfbs[0], "120", SdpRtcpFbAttributeList::kAck, "rpsi");
CheckRtcpFb(rtcpfbs[1], "120", SdpRtcpFbAttributeList::kAck, "app", "foo");
CheckRtcpFb(rtcpfbs[2], "120", SdpRtcpFbAttributeList::kNack, "");
@ -1887,6 +1888,7 @@ TEST_P(NewSdpTest, CheckRtcpFb) {
CheckRtcpFb(rtcpfbs[15], "97", SdpRtcpFbAttributeList::kNack, "");
CheckRtcpFb(rtcpfbs[16], "97", SdpRtcpFbAttributeList::kNack, "pli");
CheckRtcpFb(rtcpfbs[17], "97", SdpRtcpFbAttributeList::kCcm, "fir");
CheckRtcpFb(rtcpfbs[18], "*", SdpRtcpFbAttributeList::kCcm, "tmmbr");
}
TEST_P(NewSdpTest, CheckSctpmap) {