Bug 818640 - Test that using dynamic payload types < 96 works. r=mt
authorByron Campen [:bwc] <docfaraday@gmail.com>
Thu, 14 May 2015 15:54:21 -0700
changeset 275928 b6dd069ab9a500632749e38e4ee8e077f47fcdd1
parent 275927 b30c80ba44f3f8ada4c03e8bffbb65a9f161ae47
child 275929 6ce67a06c9a93948af7cc21400a2aaaffacf515d
push idunknown
push userunknown
push dateunknown
reviewersmt
bugs818640
milestone41.0a1
Bug 818640 - Test that using dynamic payload types < 96 works. r=mt
media/webrtc/signaling/test/jsep_session_unittest.cpp
--- a/media/webrtc/signaling/test/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/test/jsep_session_unittest.cpp
@@ -392,16 +392,28 @@ protected:
 
       return &msection;
     }
 
     return nullptr;
   }
 
   void
+  SetPayloadTypeNumber(JsepSession& session,
+                       const std::string& codecName,
+                       const std::string& payloadType)
+  {
+    for (auto* codec : session.Codecs()) {
+      if (codec->mName == codecName) {
+        codec->mDefaultPt = payloadType;
+      }
+    }
+  }
+
+  void
   EnsureNegotiationFailure(SdpMediaSection::MediaType type,
                            const std::string& codecName)
   {
     for (auto i = mSessionOff.Codecs().begin(); i != mSessionOff.Codecs().end();
          ++i) {
       auto* codec = *i;
       if (codec->mType == type && codec->mName != codecName) {
         codec->mEnabled = false;
@@ -3153,16 +3165,35 @@ TEST_F(JsepSessionTest, StronglyPreferre
   GetCodec(mSessionAns, 0, true, 0, &codec); // sending
   ASSERT_TRUE(codec);
   ASSERT_EQ("H264", codec->mName);
   GetCodec(mSessionAns, 0, false, 0, &codec); // receiving
   ASSERT_TRUE(codec);
   ASSERT_EQ("H264", codec->mName);
 }
 
+TEST_F(JsepSessionTest, LowDynamicPayloadType)
+{
+  SetPayloadTypeNumber(mSessionOff, "opus", "12");
+  types.push_back(SdpMediaSection::kAudio);
+  AddTracks(mSessionOff, "audio");
+  AddTracks(mSessionAns, "audio");
+
+  OfferAnswer();
+  const JsepCodecDescription* codec;
+  GetCodec(mSessionAns, 0, true, 0, &codec); // sending
+  ASSERT_TRUE(codec);
+  ASSERT_EQ("opus", codec->mName);
+  ASSERT_EQ("12", codec->mDefaultPt);
+  GetCodec(mSessionAns, 0, false, 0, &codec); // receiving
+  ASSERT_TRUE(codec);
+  ASSERT_EQ("opus", codec->mName);
+  ASSERT_EQ("12", codec->mDefaultPt);
+}
+
 } // namespace mozilla
 
 int
 main(int argc, char** argv)
 {
   // Prevents some log spew
   ScopedXPCOM xpcom("jsep_session_unittest");