Reland "Add AddTransceiver and GetTransceivers to PeerConnection"

This reverts commit 8b13f96e2d4b0449e54a3665121a4302ceb56e80.

Original change's description:
> Revert "Add AddTransceiver and GetTransceivers to PeerConnection"
> 
> This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a.
> 
> Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout
> 
> Original change's description:
> > Add AddTransceiver and GetTransceivers to PeerConnection
> > 
> > WebRTC 1.0 has added the transceiver API to PeerConnection. This
> > is the first step towards exposing this to WebRTC consumers. For
> > now, transceivers can be added and fetched but there is not yet
> > support for creating offers/answers or setting local/remote
> > descriptions. That support ("Unified Plan") will be added in
> > follow-up CLs.
> > 
> > The transceiver API is currently only available if the application
> > opts in by specifying the kUnifiedPlan SDP semantics when creating
> > the PeerConnection.
> > 
> > Bug: webrtc:7600
> > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e
> > Reviewed-on: https://webrtc-review.googlesource.com/23880
> > Commit-Queue: Steve Anton <steveanton@webrtc.org>
> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
> > Reviewed-by: Henrik Boström <hbos@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#20896}
> 
> TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org
> 
> Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:7600
> Reviewed-on: https://webrtc-review.googlesource.com/26400
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Commit-Queue: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20897}

TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org

Change-Id: I19fdf08c54f09302794e998a0ffddb82ae0d7b41
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:7600
Reviewed-on: https://webrtc-review.googlesource.com/26401
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20898}
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
index a7b4ef6..a1e7d7e 100644
--- a/api/peerconnectioninterface.h
+++ b/api/peerconnectioninterface.h
@@ -82,6 +82,7 @@
 #include "api/rtceventlogoutput.h"
 #include "api/rtpreceiverinterface.h"
 #include "api/rtpsenderinterface.h"
+#include "api/rtptransceiverinterface.h"
 #include "api/setremotedescriptionobserverinterface.h"
 #include "api/stats/rtcstatscollectorcallback.h"
 #include "api/statstypes.h"
@@ -601,6 +602,57 @@
   // Returns true on success.
   virtual bool RemoveTrack(RtpSenderInterface* sender) = 0;
 
+  // AddTransceiver creates a new RtpTransceiver and adds it to the set of
+  // transceivers. Adding a transceiver will cause future calls to CreateOffer
+  // to add a media description for the corresponding transceiver.
+  //
+  // The initial value of |mid| in the returned transceiver is null. Setting a
+  // new session description may change it to a non-null value.
+  //
+  // https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver
+  //
+  // Optionally, an RtpTransceiverInit structure can be specified to configure
+  // the transceiver from construction. If not specified, the transceiver will
+  // default to having a direction of kSendRecv and not be part of any streams.
+  //
+  // These methods are only available when Unified Plan is enabled (see
+  // RTCConfiguration).
+  //
+  // Common errors:
+  // - INTERNAL_ERROR: The configuration does not have Unified Plan enabled.
+  // TODO(steveanton): Make these pure virtual once downstream projects have
+  // updated.
+
+  // Adds a transceiver with a sender set to transmit the given track. The kind
+  // of the transceiver (and sender/receiver) will be derived from the kind of
+  // the track.
+  // Errors:
+  // - INVALID_PARAMETER: |track| is null.
+  virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
+  AddTransceiver(rtc::scoped_refptr<MediaStreamTrackInterface> track) {
+    return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented");
+  }
+  virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
+  AddTransceiver(rtc::scoped_refptr<MediaStreamTrackInterface> track,
+                 const RtpTransceiverInit& init) {
+    return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented");
+  }
+
+  // Adds a transceiver with the given kind. Can either be MEDIA_TYPE_AUDIO or
+  // MEDIA_TYPE_VIDEO.
+  // Errors:
+  // - INVALID_PARAMETER: |media_type| is not MEDIA_TYPE_AUDIO or
+  //                      MEDIA_TYPE_VIDEO.
+  virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
+  AddTransceiver(cricket::MediaType media_type) {
+    return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented");
+  }
+  virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
+  AddTransceiver(cricket::MediaType media_type,
+                 const RtpTransceiverInit& init) {
+    return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented");
+  }
+
   // Returns pointer to a DtmfSender on success. Otherwise returns null.
   //
   // This API is no longer part of the standard; instead DtmfSenders are
@@ -650,6 +702,15 @@
     return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>();
   }
 
+  // Get all RtpTransceivers, created either through AddTransceiver, AddTrack or
+  // by a remote description applied with SetRemoteDescription.
+  // Note: This method is only available when Unified Plan is enabled (see
+  // RTCConfiguration).
+  virtual std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>
+  GetTransceivers() const {
+    return {};
+  }
+
   virtual bool GetStats(StatsObserver* observer,
                         MediaStreamTrackInterface* track,
                         StatsOutputLevel level) = 0;