Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / libjingle / source / talk / app / webrtc / peerconnectioninterface.h
index cda98fd..54d3417 100644 (file)
@@ -76,6 +76,7 @@
 #include "talk/app/webrtc/jsep.h"
 #include "talk/app/webrtc/mediastreaminterface.h"
 #include "talk/app/webrtc/statstypes.h"
+#include "talk/app/webrtc/umametrics.h"
 #include "talk/base/fileutils.h"
 #include "talk/base/socketaddress.h"
 
@@ -118,6 +119,15 @@ class StatsObserver : public talk_base::RefCountInterface {
   virtual ~StatsObserver() {}
 };
 
+class UMAObserver : public talk_base::RefCountInterface {
+ public:
+  virtual void IncrementCounter(UMAMetricsCounter type) = 0;
+  virtual void AddHistogramSample(UMAMetricsName type, int value) = 0;
+
+ protected:
+  virtual ~UMAObserver() {}
+};
+
 class PeerConnectionInterface : public talk_base::RefCountInterface {
  public:
   // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions .
@@ -166,6 +176,21 @@ class PeerConnectionInterface : public talk_base::RefCountInterface {
   };
   typedef std::vector<IceServer> IceServers;
 
+  enum IceTransportsType {
+    kNone,
+    kRelay,
+    kNoHost,
+    kAll
+  };
+
+  struct RTCConfiguration {
+    IceTransportsType type;
+    IceServers servers;
+
+    RTCConfiguration() : type(kAll) {}
+    explicit RTCConfiguration(IceTransportsType type) : type(type) {}
+  };
+
   // Used by GetStats to decide which stats to include in the stats reports.
   // |kStatsOutputLevelStandard| includes the standard stats for Javascript API;
   // |kStatsOutputLevelDebug| includes both the standard stats and additional
@@ -240,6 +265,8 @@ class PeerConnectionInterface : public talk_base::RefCountInterface {
   // take the ownership of the |candidate|.
   virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0;
 
+  virtual void RegisterUMAObserver(UMAObserver* observer) = 0;
+
   // Returns the current SignalingState.
   virtual SignalingState signaling_state() = 0;
 
@@ -412,19 +439,34 @@ class PeerConnectionFactoryInterface : public talk_base::RefCountInterface {
   };
 
   virtual void SetOptions(const Options& options) = 0;
-  virtual talk_base::scoped_refptr<PeerConnectionInterface>
-     CreatePeerConnection(
-         const PeerConnectionInterface::IceServers& configuration,
-         const MediaConstraintsInterface* constraints,
-         DTLSIdentityServiceInterface* dtls_identity_service,
-         PeerConnectionObserver* observer) = 0;
+
   virtual talk_base::scoped_refptr<PeerConnectionInterface>
       CreatePeerConnection(
-          const PeerConnectionInterface::IceServers& configuration,
+          const PeerConnectionInterface::RTCConfiguration& configuration,
           const MediaConstraintsInterface* constraints,
           PortAllocatorFactoryInterface* allocator_factory,
           DTLSIdentityServiceInterface* dtls_identity_service,
           PeerConnectionObserver* observer) = 0;
+
+  // TODO(mallinath) : Remove below versions after clients are updated
+  // to above method.
+  // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration,
+  // and not IceServers. RTCConfiguration is made up of ice servers and
+  // ice transport type.
+  // http://dev.w3.org/2011/webrtc/editor/webrtc.html
+  inline talk_base::scoped_refptr<PeerConnectionInterface>
+      CreatePeerConnection(
+          const PeerConnectionInterface::IceServers& configuration,
+          const MediaConstraintsInterface* constraints,
+          PortAllocatorFactoryInterface* allocator_factory,
+          DTLSIdentityServiceInterface* dtls_identity_service,
+          PeerConnectionObserver* observer) {
+      PeerConnectionInterface::RTCConfiguration rtc_config;
+      rtc_config.servers = configuration;
+      return CreatePeerConnection(rtc_config, constraints, allocator_factory,
+                                  dtls_identity_service, observer);
+  }
+
   virtual talk_base::scoped_refptr<MediaStreamInterface>
       CreateLocalMediaStream(const std::string& label) = 0;