Fixes to PeerConnection for Unified Plan sdp & transceiver logic.

This change includes updates to the sdp logic, and transceiver
dissociation and also tests these updates. The sdp validation for
unified plan is updated to consider both the stored remote and local
descriptions for an offer, because either could be the most up to date.
This is important when considering a recycled m section. This also
updates to only dissociate a transceiver when we are setting the remote
or local description from an offer. The final small update allows us to
properly create a media description for a transceiver that is not new
but is part of a recycled m section that has only been set locally for
an offer and we are re-offering.

Bug: webrtc:8765
Change-Id: Ia86e54fcd977478824cfa88ebaf992215ed68aae
Reviewed-on: https://webrtc-review.googlesource.com/52080
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22025}
diff --git a/pc/peerconnection.h b/pc/peerconnection.h
index 617aa37..e6d7b7e 100644
--- a/pc/peerconnection.h
+++ b/pc/peerconnection.h
@@ -422,8 +422,9 @@
   // part of setting the local/remote description.
   RTCError UpdateTransceiversAndDataChannels(
       cricket::ContentSource source,
-      const SessionDescriptionInterface* old_session,
-      const SessionDescriptionInterface& new_session);
+      const SessionDescriptionInterface& new_session,
+      const SessionDescriptionInterface* old_local_description,
+      const SessionDescriptionInterface* old_remote_description);
 
   // Either creates or destroys the transceiver's BaseChannel according to the
   // given media section.
@@ -443,9 +444,11 @@
   RTCErrorOr<
       rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>>
   AssociateTransceiver(cricket::ContentSource source,
+                       SdpType type,
                        size_t mline_index,
                        const cricket::ContentInfo& content,
-                       const cricket::ContentInfo* old_content);
+                       const cricket::ContentInfo* old_local_content,
+                       const cricket::ContentInfo* old_remote_content);
 
   // Returns the RtpTransceiver, if found, that is associated to the given MID.
   rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>