Bug 1140637: Add jsep_session_unittest to testing/cppunittest.ini, and unbust it. r=jesup

This commit is contained in:
Byron Campen [:bwc] 2015-03-09 14:45:46 -07:00
parent b76a0d118f
commit 555ae0c048
5 changed files with 47 additions and 17 deletions

View File

@ -294,7 +294,10 @@ struct JsepVideoCodecDescription : public JsepCodecDescription {
} else if (mName == "VP8" || mName == "VP9") {
// VP8 and VP9 share the same SDP parameters thus far
UniquePtr<SdpFmtpAttributeList::VP8Parameters> params =
MakeUnique<SdpFmtpAttributeList::VP8Parameters>();
MakeUnique<SdpFmtpAttributeList::VP8Parameters>(
mName == "VP8" ?
SdpRtpmapAttributeList::kVP8 :
SdpRtpmapAttributeList::kVP9);
params->max_fs = mMaxFs;
params->max_fr = mMaxFr;

View File

@ -1018,8 +1018,8 @@ public:
class VP8Parameters : public Parameters
{
public:
VP8Parameters()
: Parameters(SdpRtpmapAttributeList::kVP8), max_fs(0), max_fr(0)
explicit VP8Parameters(SdpRtpmapAttributeList::CodecType type)
: Parameters(type), max_fs(0), max_fr(0)
{
}

View File

@ -647,10 +647,20 @@ SipccSdpAttributeList::LoadFmtp(sdp_t* sdp, uint16_t level)
parameters.reset(h264Parameters);
} break;
case RTP_VP9:
case RTP_VP9: {
SdpFmtpAttributeList::VP8Parameters* vp9Parameters(
new SdpFmtpAttributeList::VP8Parameters(
SdpRtpmapAttributeList::kVP9));
vp9Parameters->max_fs = fmtp->max_fs;
vp9Parameters->max_fr = fmtp->max_fr;
parameters.reset(vp9Parameters);
} break;
case RTP_VP8: {
SdpFmtpAttributeList::VP8Parameters* vp8Parameters(
new SdpFmtpAttributeList::VP8Parameters);
new SdpFmtpAttributeList::VP8Parameters(
SdpRtpmapAttributeList::kVP8));
vp8Parameters->max_fs = fmtp->max_fs;
vp8Parameters->max_fr = fmtp->max_fr;

View File

@ -2062,23 +2062,27 @@ TEST_F(JsepSessionTest, ValidateOfferedCodecParams)
auto& video_attrs = video_section.GetAttributeList();
ASSERT_EQ(SdpDirectionAttribute::kSendrecv, video_attrs.GetDirection());
ASSERT_EQ(3U, video_section.GetFormats().size());
ASSERT_EQ(4U, video_section.GetFormats().size());
ASSERT_EQ("120", video_section.GetFormats()[0]);
ASSERT_EQ("126", video_section.GetFormats()[1]);
ASSERT_EQ("97", video_section.GetFormats()[2]);
ASSERT_EQ("121", video_section.GetFormats()[1]);
ASSERT_EQ("126", video_section.GetFormats()[2]);
ASSERT_EQ("97", video_section.GetFormats()[3]);
// Validate rtpmap
ASSERT_TRUE(video_attrs.HasAttribute(SdpAttribute::kRtpmapAttribute));
auto& rtpmaps = video_attrs.GetRtpmap();
ASSERT_TRUE(rtpmaps.HasEntry("120"));
ASSERT_TRUE(rtpmaps.HasEntry("121"));
ASSERT_TRUE(rtpmaps.HasEntry("126"));
ASSERT_TRUE(rtpmaps.HasEntry("97"));
auto& vp8_entry = rtpmaps.GetEntry("120");
auto& vp9_entry = rtpmaps.GetEntry("121");
auto& h264_1_entry = rtpmaps.GetEntry("126");
auto& h264_0_entry = rtpmaps.GetEntry("97");
ASSERT_EQ("VP8", vp8_entry.name);
ASSERT_EQ("VP9", vp9_entry.name);
ASSERT_EQ("H264", h264_1_entry.name);
ASSERT_EQ("H264", h264_0_entry.name);
@ -2086,7 +2090,7 @@ TEST_F(JsepSessionTest, ValidateOfferedCodecParams)
ASSERT_TRUE(video_attrs.HasAttribute(SdpAttribute::kFmtpAttribute));
auto& fmtps = video_attrs.GetFmtp().mFmtps;
ASSERT_EQ(3U, fmtps.size());
ASSERT_EQ(4U, fmtps.size());
// VP8
ASSERT_EQ("120", fmtps[0].format);
@ -2100,27 +2104,39 @@ TEST_F(JsepSessionTest, ValidateOfferedCodecParams)
ASSERT_EQ((uint32_t)12288, parsed_vp8_params.max_fs);
ASSERT_EQ((uint32_t)60, parsed_vp8_params.max_fr);
// H264 packetization mode 1
ASSERT_EQ("126", fmtps[1].format);
// VP9
ASSERT_EQ("121", fmtps[1].format);
ASSERT_TRUE(!!fmtps[1].parameters);
ASSERT_EQ(SdpRtpmapAttributeList::kH264, fmtps[1].parameters->codec_type);
ASSERT_EQ(SdpRtpmapAttributeList::kVP9, fmtps[1].parameters->codec_type);
auto& parsed_vp9_params =
*static_cast<const SdpFmtpAttributeList::VP8Parameters*>(
fmtps[1].parameters.get());
ASSERT_EQ((uint32_t)12288, parsed_vp9_params.max_fs);
ASSERT_EQ((uint32_t)60, parsed_vp9_params.max_fr);
// H264 packetization mode 1
ASSERT_EQ("126", fmtps[2].format);
ASSERT_TRUE(!!fmtps[2].parameters);
ASSERT_EQ(SdpRtpmapAttributeList::kH264, fmtps[2].parameters->codec_type);
auto& parsed_h264_1_params =
*static_cast<const SdpFmtpAttributeList::H264Parameters*>(
fmtps[1].parameters.get());
fmtps[2].parameters.get());
ASSERT_EQ((uint32_t)0x42e00d, parsed_h264_1_params.profile_level_id);
ASSERT_TRUE(parsed_h264_1_params.level_asymmetry_allowed);
ASSERT_EQ(1U, parsed_h264_1_params.packetization_mode);
// H264 packetization mode 0
ASSERT_EQ("97", fmtps[2].format);
ASSERT_TRUE(!!fmtps[2].parameters);
ASSERT_EQ(SdpRtpmapAttributeList::kH264, fmtps[2].parameters->codec_type);
ASSERT_EQ("97", fmtps[3].format);
ASSERT_TRUE(!!fmtps[3].parameters);
ASSERT_EQ(SdpRtpmapAttributeList::kH264, fmtps[3].parameters->codec_type);
auto& parsed_h264_0_params =
*static_cast<const SdpFmtpAttributeList::H264Parameters*>(
fmtps[2].parameters.get());
fmtps[3].parameters.get());
ASSERT_EQ((uint32_t)0x42e00d, parsed_h264_0_params.profile_level_id);
ASSERT_TRUE(parsed_h264_0_params.level_asymmetry_allowed);

View File

@ -95,6 +95,7 @@ skip-if = os == 'b2g' || os == 'android' # Bug 919646
[rlogringbuffer_unittest]
[runnable_utils_unittest]
[sctp_unittest]
[jsep_session_unittest]
[sdp_unittests]
[signaling_unittests]
[simpletokenbucket_unittest]