Bug 1401540 - Allow empty BUNDLE groups; r?bwc draft
authorDan Minor <dminor@mozilla.com>
Wed, 27 Sep 2017 12:49:19 -0400
changeset 672775 67a10115d806d6fa00afccb40d422b17faed8710
parent 672593 cd9c8c48e4b3ded47a776f757008f3dcf570c59c
child 733920 fc45456fa10315561926f220a629b6b9b42bb886
push id82372
push userbmo:dminor@mozilla.com
push dateFri, 29 Sep 2017 19:06:23 +0000
reviewersbwc
bugs1401540
milestone58.0a1
Bug 1401540 - Allow empty BUNDLE groups; r?bwc MozReview-Commit-ID: 9IIwUnaMZ1m
media/webrtc/signaling/gtest/jsep_session_unittest.cpp
media/webrtc/signaling/src/sdp/SdpHelper.cpp
--- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
@@ -3620,16 +3620,30 @@ TEST_F(JsepSessionTest, ValidateAnswered
         fmtps[2].parameters.get());
 
   ASSERT_EQ((uint32_t)0x42a00d, 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);
 #endif
 }
 
+TEST_F(JsepSessionTest, OfferWithBundleGroupNoTags)
+{
+  AddTracks(*mSessionOff, "audio,video");
+  AddTracks(*mSessionAns, "audio,video");
+
+  std::string offer = CreateOffer();
+  size_t i = offer.find("a=group:BUNDLE");
+  offer.insert(i, "a=group:BUNDLE\r\n");
+
+  SetLocalOffer(offer, CHECK_SUCCESS);
+  SetRemoteOffer(offer, CHECK_SUCCESS);
+  std::string answer(CreateAnswer());
+}
+
 static void
 Replace(const std::string& toReplace,
         const std::string& with,
         std::string* in)
 {
   size_t pos = in->find(toReplace);
   ASSERT_NE(std::string::npos, pos);
   in->replace(pos, toReplace.size(), with);
--- a/media/webrtc/signaling/src/sdp/SdpHelper.cpp
+++ b/media/webrtc/signaling/src/sdp/SdpHelper.cpp
@@ -202,18 +202,17 @@ SdpHelper::GetBundleGroups(
 nsresult
 SdpHelper::GetBundledMids(const Sdp& sdp, BundledMids* bundledMids)
 {
   std::vector<SdpGroupAttributeList::Group> bundleGroups;
   GetBundleGroups(sdp, &bundleGroups);
 
   for (SdpGroupAttributeList::Group& group : bundleGroups) {
     if (group.tags.empty()) {
-      SDP_SET_ERROR("Empty BUNDLE group");
-      return NS_ERROR_INVALID_ARG;
+      continue;
     }
 
     const SdpMediaSection* masterBundleMsection(
         FindMsectionByMid(sdp, group.tags[0]));
 
     if (!masterBundleMsection) {
       SDP_SET_ERROR("mid specified for bundle transport in group attribute"
           " does not exist in the SDP. (mid=" << group.tags[0] << ")");