Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / libjingle / source / talk / app / webrtc / webrtcsession.h
index 4a39a11..88defce 100644 (file)
 #include "talk/session/media/mediasession.h"
 
 namespace cricket {
-
+class BaseChannel;
 class ChannelManager;
 class DataChannel;
 class StatsReport;
 class Transport;
 class VideoCapturer;
-class BaseChannel;
 class VideoChannel;
 class VoiceChannel;
-
 }  // namespace cricket
 
 namespace webrtc {
-
 class IceRestartAnswerLatch;
 class MediaStreamSignaling;
 class WebRtcSessionDescriptionFactory;
 
-extern const char kSetLocalSdpFailed[];
-extern const char kSetRemoteSdpFailed[];
-extern const char kCreateChannelFailed[];
 extern const char kBundleWithoutRtcpMux[];
+extern const char kCreateChannelFailed[];
 extern const char kInvalidCandidates[];
 extern const char kInvalidSdp[];
 extern const char kMlineMismatch[];
+extern const char kPushDownTDFailed[];
 extern const char kSdpWithoutCrypto[];
-extern const char kSdpWithoutSdesAndDtlsDisabled[];
 extern const char kSdpWithoutIceUfragPwd[];
+extern const char kSdpWithoutSdesAndDtlsDisabled[];
 extern const char kSessionError[];
-extern const char kUpdateStateFailed[];
-extern const char kPushDownOfferTDFailed[];
-extern const char kPushDownPranswerTDFailed[];
-extern const char kPushDownAnswerTDFailed[];
+extern const char kSessionErrorDesc[];
 
 // ICE state callback interface.
 class IceObserver {
  public:
+  IceObserver() {}
   // Called any time the IceConnectionState changes
   virtual void OnIceConnectionChange(
       PeerConnectionInterface::IceConnectionState new_state) {}
@@ -94,6 +88,9 @@ class IceObserver {
 
  protected:
   ~IceObserver() {}
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(IceObserver);
 };
 
 class WebRtcSession : public cricket::BaseSession,
@@ -131,8 +128,8 @@ class WebRtcSession : public cricket::BaseSession,
     return data_channel_.get();
   }
 
-  void set_secure_policy(cricket::SecureMediaPolicy secure_policy);
-  cricket::SecureMediaPolicy secure_policy() const;
+  void SetSecurePolicy(cricket::SecureMediaPolicy secure_policy);
+  cricket::SecureMediaPolicy SecurePolicy() const;
 
   // Get current ssl role from transport.
   bool GetSslRole(talk_base::SSLRole* role);
@@ -168,6 +165,7 @@ class WebRtcSession : public cricket::BaseSession,
   virtual void SetAudioSend(uint32 ssrc, bool enable,
                             const cricket::AudioOptions& options,
                             cricket::AudioRenderer* renderer) OVERRIDE;
+  virtual void SetAudioPlayoutVolume(uint32 ssrc, double volume) OVERRIDE;
 
   // Implements VideoMediaProviderInterface.
   virtual bool SetCaptureDevice(uint32 ssrc,
@@ -190,15 +188,14 @@ class WebRtcSession : public cricket::BaseSession,
                         cricket::SendDataResult* result) OVERRIDE;
   virtual bool ConnectDataChannel(DataChannel* webrtc_data_channel) OVERRIDE;
   virtual void DisconnectDataChannel(DataChannel* webrtc_data_channel) OVERRIDE;
-  virtual void AddRtpDataStream(uint32 send_ssrc, uint32 recv_ssrc) OVERRIDE;
   virtual void AddSctpDataStream(uint32 sid) OVERRIDE;
-  virtual void RemoveRtpDataStream(uint32 send_ssrc, uint32 recv_ssrc) OVERRIDE;
   virtual void RemoveSctpDataStream(uint32 sid) OVERRIDE;
   virtual bool ReadyToSendData() const OVERRIDE;
 
+  // Implements DataChannelFactory.
   talk_base::scoped_refptr<DataChannel> CreateDataChannel(
       const std::string& label,
-      const DataChannelInit* config);
+      const InternalDataChannelInit* config) OVERRIDE;
 
   cricket::DataChannelType data_channel_type() const;
 
@@ -226,7 +223,6 @@ class WebRtcSession : public cricket::BaseSession,
   // candidates allocation.
   bool StartCandidatesAllocation();
   bool UpdateSessionState(Action action, cricket::ContentSource source,
-                          const cricket::SessionDescription* desc,
                           std::string* err_desc);
   static Action GetAction(const std::string& type);
 
@@ -234,6 +230,8 @@ class WebRtcSession : public cricket::BaseSession,
   virtual void OnTransportRequestSignaling(cricket::Transport* transport);
   virtual void OnTransportConnecting(cricket::Transport* transport);
   virtual void OnTransportWritable(cricket::Transport* transport);
+  virtual void OnTransportCompleted(cricket::Transport* transport);
+  virtual void OnTransportFailed(cricket::Transport* transport);
   virtual void OnTransportProxyCandidatesReady(
       cricket::TransportProxy* proxy,
       const cricket::Candidates& candidates);
@@ -276,13 +274,16 @@ class WebRtcSession : public cricket::BaseSession,
   // The |saved_candidates_| will be cleared after this function call.
   void CopySavedCandidates(SessionDescriptionInterface* dest_desc);
 
-  void OnNewDataChannelReceived(const std::string& label,
-                                const DataChannelInit& init);
+  // Listens to SCTP CONTROL messages on unused SIDs and process them as OPEN
+  // messages.
+  void OnDataChannelMessageReceived(cricket::DataChannel* channel,
+                                    const cricket::ReceiveDataParams& params,
+                                    const talk_base::Buffer& payload);
 
   bool GetLocalTrackId(uint32 ssrc, std::string* track_id);
   bool GetRemoteTrackId(uint32 ssrc, std::string* track_id);
 
-  std::string BadStateErrMsg(const std::string& type, State state);
+  std::string BadStateErrMsg(State state);
   void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state);
 
   bool ValidateBundleSettings(const cricket::SessionDescription* desc);
@@ -290,7 +291,7 @@ class WebRtcSession : public cricket::BaseSession,
   // Below methods are helper methods which verifies SDP.
   bool ValidateSessionDescription(const SessionDescriptionInterface* sdesc,
                                   cricket::ContentSource source,
-                                  std::string* error_desc);
+                                  std::string* err_desc);
 
   // Check if a call to SetLocalDescription is acceptable with |action|.
   bool ExpectSetLocalDescription(Action action);
@@ -300,6 +301,8 @@ class WebRtcSession : public cricket::BaseSession,
   bool ValidateDtlsSetupAttribute(const cricket::SessionDescription* desc,
                                   Action action);
 
+  std::string GetSessionErrorMsg();
+
   talk_base::scoped_ptr<cricket::VoiceChannel> voice_channel_;
   talk_base::scoped_ptr<cricket::VideoChannel> video_channel_;
   talk_base::scoped_ptr<cricket::DataChannel> data_channel_;
@@ -332,8 +335,9 @@ class WebRtcSession : public cricket::BaseSession,
   sigslot::signal0<> SignalVoiceChannelDestroyed;
   sigslot::signal0<> SignalVideoChannelDestroyed;
   sigslot::signal0<> SignalDataChannelDestroyed;
-};
 
+  DISALLOW_COPY_AND_ASSIGN(WebRtcSession);
+};
 }  // namespace webrtc
 
 #endif  // TALK_APP_WEBRTC_WEBRTCSESSION_H_