Add PeerConnection interop integration tests

These tests verify the behavior between Plan B and
Unified Plan PeerConnections.

Bug: webrtc:7600
Change-Id: Ic41a0e692d32cde6fe7719ada2dbffd4281c008c
Reviewed-on: https://webrtc-review.googlesource.com/43244
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21782}
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index 07e326d..6ffe561 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -1788,12 +1788,12 @@
       if (content->rejected && !transceiver->stopped()) {
         transceiver->Stop();
       }
-      if (!content->rejected) {
-        const auto& stream = content->media_description()->streams()[0];
+      const auto& streams = content->media_description()->streams();
+      if (!content->rejected && !streams.empty()) {
         transceiver->internal()->sender_internal()->set_stream_ids(
-            {stream.sync_label});
+            {streams[0].sync_label});
         transceiver->internal()->sender_internal()->SetSsrc(
-            stream.first_ssrc());
+            streams[0].first_ssrc());
       }
     }
   } else {
@@ -2032,7 +2032,8 @@
       if (RtpTransceiverDirectionHasRecv(local_direction) &&
           (!transceiver->current_direction() ||
            !RtpTransceiverDirectionHasRecv(
-               *transceiver->current_direction()))) {
+               *transceiver->current_direction())) &&
+          !media_desc->streams().empty()) {
         const std::string& sync_label = media_desc->streams()[0].sync_label;
         rtc::scoped_refptr<MediaStreamInterface> stream =
             remote_streams_->find(sync_label);
@@ -2061,7 +2062,7 @@
       if (content->rejected && !transceiver->stopped()) {
         transceiver->Stop();
       }
-      if (!content->rejected) {
+      if (!content->rejected && !media_desc->streams().empty()) {
         const auto& stream = content->media_description()->streams()[0];
         transceiver->internal()->receiver_internal()->SetupMediaChannel(
             stream.first_ssrc());
@@ -5375,30 +5376,6 @@
     }
   }
 
-  // Unified Plan SDP should have exactly one stream per m= section for audio
-  // and video.
-  if (IsUnifiedPlan()) {
-    for (const ContentInfo& content : sdesc->description()->contents()) {
-      if (content.rejected) {
-        continue;
-      }
-      if (content.media_description()) {
-        cricket::MediaType media_type = content.media_description()->type();
-        if (!(media_type == cricket::MEDIA_TYPE_AUDIO ||
-              media_type == cricket::MEDIA_TYPE_VIDEO)) {
-          continue;
-        }
-        const cricket::StreamParamsVec& streams =
-            content.media_description()->streams();
-        if (streams.size() != 1u) {
-          LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
-                               "Unified Plan SDP should have exactly one "
-                               "track per media section for audio and video.");
-        }
-      }
-    }
-  }
-
   return RTCError::OK();
 }