Bug 1140637: Add jsep_session_unittest to testing/cppunittest.ini, and unbust it. r=jesup
authorByron Campen [:bwc] <docfaraday@gmail.com>
Mon, 09 Mar 2015 14:45:46 -0700
changeset 261622 02c9b11ccb6794b1051f4bdad9a11981ab55c8c0
parent 261621 4930072a9b28c21ace3b6267ecb12cc72a0abb6c
child 261623 8c8b685a72041a05807bc9bad4ac4be7cb893a4b
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1140637
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1140637: Add jsep_session_unittest to testing/cppunittest.ini, and unbust it. r=jesup
media/webrtc/signaling/src/jsep/JsepCodecDescription.h
media/webrtc/signaling/src/sdp/SdpAttribute.h
media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp
media/webrtc/signaling/test/jsep_session_unittest.cpp
testing/cppunittest.ini
--- a/media/webrtc/signaling/src/jsep/JsepCodecDescription.h
+++ b/media/webrtc/signaling/src/jsep/JsepCodecDescription.h
@@ -289,17 +289,20 @@ struct JsepVideoCodecDescription : publi
       params->max_br = mMaxBr;
       strncpy(params->sprop_parameter_sets,
               mSpropParameterSets.c_str(),
               sizeof(params->sprop_parameter_sets) - 1);
       fmtp.PushEntry(mDefaultPt, "", mozilla::Move(params));
     } 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;
       fmtp.PushEntry(mDefaultPt, "", mozilla::Move(params));
     }
   }
 
   virtual void
--- a/media/webrtc/signaling/src/sdp/SdpAttribute.h
+++ b/media/webrtc/signaling/src/sdp/SdpAttribute.h
@@ -1013,18 +1013,18 @@ public:
     unsigned int max_dpb;
     unsigned int max_br;
   };
 
   // Also used for VP9 since they share parameters
   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)
     {
     }
 
     virtual Parameters*
     Clone() const MOZ_OVERRIDE
     {
       return new VP8Parameters(*this);
     }
--- a/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp
+++ b/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp
@@ -642,20 +642,30 @@ SipccSdpAttributeList::LoadFmtp(sdp_t* s
         h264Parameters->max_mbps = fmtp->max_mbps;
         h264Parameters->max_fs = fmtp->max_fs;
         h264Parameters->max_cpb = fmtp->max_cpb;
         h264Parameters->max_dpb = fmtp->max_dpb;
         h264Parameters->max_br = fmtp->max_br;
 
         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;
 
         parameters.reset(vp8Parameters);
       } break;
       default: {
       }
--- a/media/webrtc/signaling/test/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/test/jsep_session_unittest.cpp
@@ -2057,75 +2057,91 @@ TEST_F(JsepSessionTest, ValidateOfferedC
                            << "Errors were: " << GetParseErrors(parser);
 
   ASSERT_EQ(2U, outputSdp->GetMediaSectionCount());
   auto& video_section = outputSdp->GetMediaSection(1);
   ASSERT_EQ(SdpMediaSection::kVideo, video_section.GetMediaType());
   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);
 
   // Validate fmtps
   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);
   ASSERT_TRUE(!!fmtps[0].parameters);
   ASSERT_EQ(SdpRtpmapAttributeList::kVP8, fmtps[0].parameters->codec_type);
 
   auto& parsed_vp8_params =
       *static_cast<const SdpFmtpAttributeList::VP8Parameters*>(
           fmtps[0].parameters.get());
 
   ASSERT_EQ((uint32_t)12288, parsed_vp8_params.max_fs);
   ASSERT_EQ((uint32_t)60, parsed_vp8_params.max_fr);
 
+  // VP9
+  ASSERT_EQ("121", fmtps[1].format);
+  ASSERT_TRUE(!!fmtps[1].parameters);
+  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[1].format);
-  ASSERT_TRUE(!!fmtps[1].parameters);
-  ASSERT_EQ(SdpRtpmapAttributeList::kH264, fmtps[1].parameters->codec_type);
+  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);
   ASSERT_EQ(0U, parsed_h264_0_params.packetization_mode);
 }
 
 TEST_F(JsepSessionTest, ValidateAnsweredCodecParams)
 {
--- a/testing/cppunittest.ini
+++ b/testing/cppunittest.ini
@@ -90,16 +90,17 @@ skip-if = os == 'b2g'  #Bug 919595
 skip-if = os == 'b2g'  #Bug 1068946
 [mediaconduit_unittests]
 [mediapipeline_unittest]
 skip-if = os == 'b2g' || os == 'android'  # Bug 919646
 [nrappkit_unittest]
 [rlogringbuffer_unittest]
 [runnable_utils_unittest]
 [sctp_unittest]
+[jsep_session_unittest]
 [sdp_unittests]
 [signaling_unittests]
 [simpletokenbucket_unittest]
 [sockettransportservice_unittest]
 [test_AsXXX_helpers]
 [test_IHistory]
 [test_StatementCache]
 [test_asyncStatementExecution_transaction]