Permalink
Browse files

Update to 31805894.

Review URL: https://webrtc-codereview.appspot.com/676014

git-svn-id: http://libjingle.googlecode.com/svn/trunk@158 dd674b97-3498-5ee5-1854-bdd07cd0ff33
  • Loading branch information...
1 parent d603a28 commit 5e6bbe43789a22523fc6937d4a61c7930c854d75 ronghuawu@google.com committed Jul 12, 2012
Showing with 2,517 additions and 494 deletions.
  1. +1 −0 AUTHORS
  2. +5 −3 README
  3. +114 −5 talk/app/webrtc/jsep.h
  4. +24 −3 talk/app/webrtc/jsepsessiondescription.cc
  5. +13 −1 talk/app/webrtc/jsepsessiondescription.h
  6. +259 −8 talk/app/webrtc/peerconnection.cc
  7. +32 −2 talk/app/webrtc/peerconnection.h
  8. +216 −10 talk/app/webrtc/peerconnection_unittest.cc
  9. +54 −8 talk/app/webrtc/peerconnectionfactory.cc
  10. +8 −0 talk/app/webrtc/peerconnectionfactory.h
  11. +25 −0 talk/app/webrtc/peerconnectionfactory_unittest.cc
  12. +36 −10 talk/app/webrtc/peerconnectioninterface.h
  13. +152 −44 talk/app/webrtc/peerconnectioninterface_unittest.cc
  14. +2 −0 talk/app/webrtc/roapsignaling.h
  15. +14 −0 talk/app/webrtc/roapsignaling_unittest.cc
  16. +13 −2 talk/app/webrtc/webrtcsession.cc
  17. +16 −2 talk/app/webrtc/webrtcsession.h
  18. +16 −13 talk/app/webrtc/webrtcsession_unittest.cc
  19. +31 −0 talk/base/asynchttprequest_unittest.cc
  20. +33 −1 talk/base/httpclient.cc
  21. +7 −1 talk/base/httpclient.h
  22. +3 −0 talk/base/httpserver.cc
  23. +7 −2 talk/base/latebindingsymboltable.cc
  24. +85 −0 talk/base/latebindingsymboltable.cc.def
  25. +3 −0 talk/base/latebindingsymboltable.h
  26. +99 −0 talk/base/latebindingsymboltable.h.def
  27. +13 −4 talk/base/proxyserver.cc
  28. +0 −2 talk/base/socketpool.cc
  29. +9 −2 talk/base/stream.cc
  30. +3 −1 talk/base/stream.h
  31. +7 −0 talk/base/windowpickerfactory.h
  32. +23 −0 talk/examples/call/callclient.cc
  33. +2 −0 talk/examples/call/callclient.h
  34. +2 −0 talk/examples/peerconnection/client/conductor.h
  35. +2 −1 talk/p2p/base/dtlstransport.h
  36. +1 −1 talk/p2p/base/dtlstransportchannel.cc
  37. +1 −1 talk/p2p/base/dtlstransportchannel_unittest.cc
  38. +8 −5 talk/p2p/base/fakesession.h
  39. +4 −2 talk/p2p/base/p2ptransport.cc
  40. +1 −0 talk/p2p/base/p2ptransport.h
  41. +4 −3 talk/p2p/base/p2ptransportchannel.cc
  42. +2 −1 talk/p2p/base/p2ptransportchannel.h
  43. +1 −2 talk/p2p/base/p2ptransportchannel_unittest.cc
  44. +2 −1 talk/p2p/base/port.cc
  45. +8 −5 talk/p2p/base/portallocator.cc
  46. +7 −1 talk/p2p/base/portallocator.h
  47. +5 −3 talk/p2p/base/portallocatorsessionproxy.h
  48. +6 −5 talk/p2p/base/portallocatorsessionproxy_unittest.cc
  49. +3 −2 talk/p2p/base/rawtransport.cc
  50. +1 −0 talk/p2p/base/rawtransport.h
  51. +4 −3 talk/p2p/base/rawtransportchannel.cc
  52. +2 −1 talk/p2p/base/rawtransportchannel.h
  53. +5 −4 talk/p2p/base/session.cc
  54. +1 −1 talk/p2p/base/session.h
  55. +5 −3 talk/p2p/base/session_unittest.cc
  56. +26 −9 talk/p2p/base/transport.cc
  57. +33 −5 talk/p2p/base/transport.h
  58. +4 −2 talk/p2p/base/transport_unittest.cc
  59. +3 −2 talk/p2p/base/transportchannel.cc
  60. +6 −2 talk/p2p/base/transportchannel.h
  61. +2 −2 talk/p2p/base/transportchannelimpl.h
  62. +3 −2 talk/p2p/base/transportchannelproxy.cc
  63. +2 −1 talk/p2p/base/transportchannelproxy.h
  64. +5 −3 talk/p2p/client/basicportallocator.cc
  65. +2 −0 talk/p2p/client/basicportallocator.h
  66. +3 −1 talk/p2p/client/connectivitychecker.cc
  67. +2 −1 talk/p2p/client/connectivitychecker.h
  68. +5 −1 talk/p2p/client/connectivitychecker_unittest.cc
  69. +4 −2 talk/p2p/client/fakeportallocator.h
  70. +6 −3 talk/p2p/client/httpportallocator.cc
  71. +4 −0 talk/p2p/client/httpportallocator.h
  72. +5 −3 talk/p2p/client/portallocator_unittest.cc
  73. +55 −26 talk/session/phone/channel.cc
  74. +10 −7 talk/session/phone/channel.h
  75. +40 −27 talk/session/phone/channel_unittest.cc
  76. +4 −4 talk/session/phone/channelmanager.cc
  77. +25 −13 talk/session/phone/fakemediaengine.h
  78. +68 −12 talk/session/phone/fakewebrtcvoiceengine.h
  79. +6 −3 talk/session/phone/filemediaengine.h
  80. +74 −5 talk/session/phone/mediachannel.h
  81. +4 −2 talk/session/phone/mediaengine.h
  82. BIN talk/session/phone/testdata/1.frame_plus_1.byte
  83. +3 −3 talk/session/phone/videocommon.cc
  84. +27 −25 talk/session/phone/videocommon.h
  85. +6 −2 talk/session/phone/videoframe.cc
  86. +11 −2 talk/session/phone/webrtcpassthroughrender.cc
  87. +8 −2 talk/session/phone/webrtcpassthroughrender_unittest.cc
  88. +14 −15 talk/session/phone/webrtcvideocapturer.cc
  89. +36 −19 talk/session/phone/webrtcvideoengine.cc
  90. +1 −1 talk/session/phone/webrtcvideoengine_unittest.cc
  91. +17 −10 talk/session/phone/webrtcvideoframe.cc
  92. +4 −0 talk/session/phone/webrtcvideoframe_unittest.cc
  93. +133 −78 talk/session/phone/webrtcvoiceengine.cc
  94. +63 −9 talk/session/phone/webrtcvoiceengine.h
  95. +385 −17 talk/session/phone/webrtcvoiceengine_unittest.cc
  96. +8 −4 talk/session/tunnel/pseudotcpchannel.cc
View
@@ -1,4 +1,5 @@
Google Inc.
Eric Rescorla, RTFM Inc.
+Luke Weber
Pali Rohar
Robert Nagy
View
8 README
@@ -141,9 +141,11 @@ other input RTP dump, you may need to change the codecs in call_main.cc, lines
Libjingle also builds two server tools, a relay server and a STUN server. The
relay server may be used to relay traffic when a direct peer-to-peer connection
could not be established. The STUN Server implements the STUN protocol for
-Simple Traversal of UDP over NAT. See the Libjingle Developer Guide at
-http://code.google.com/apis/talk/index.html for information about configuring a
-client to use this relay server and this STUN server.
+Session Traversal Utilities for NAT(rfc5389), and the TURN server is in active
+development to reach compatibility with rfc5766. See the Libjingle Developer
+Guide at http://developers.google.com/talk/libjingle/developer_guide for
+information about configuring a client to use this relay server and this STUN
+server.
To use LinphoneMediaEngine, you need to perform the following additional steps:
* Download and install the "MediaStreamer" library on your
View
@@ -26,6 +26,9 @@
*/
// Interfaces matching the draft-ietf-rtcweb-jsep-00.
+// TODO: Remove all the jsep-00 APIs (marked as deprecated) once
+// chromium (WebKit and glue code) is ready. And update the comment above to
+// jsep-01.
#ifndef TALK_APP_WEBRTC_JSEP_H_
#define TALK_APP_WEBRTC_JSEP_H_
@@ -34,6 +37,7 @@
#include <vector>
#include "talk/base/basictypes.h"
+#include "talk/base/refcount.h"
namespace cricket {
class SessionDescription;
@@ -42,8 +46,25 @@ class Candidate;
namespace webrtc {
+class SessionDescriptionOptions {
+ public:
+ SessionDescriptionOptions() : has_audio_(true), has_video_(true) {}
+ SessionDescriptionOptions(bool receive_audio, bool receive_video)
+ : has_audio_(receive_audio),
+ has_video_(receive_video) {
+ }
+ // The peer wants to receive audio.
+ bool has_audio() const { return has_audio_; }
+ // The peer wants to receive video.
+ bool has_video() const { return has_video_; }
+
+ private:
+ bool has_audio_;
+ bool has_video_;
+};
+
// Class used for describing what media a PeerConnection can receive.
-class MediaHints {
+class MediaHints { // Deprecated (jsep00)
public:
MediaHints() : has_audio_(true), has_video_(true) {}
MediaHints(bool receive_audio, bool receive_video)
@@ -68,7 +89,9 @@ class IceCandidateInterface {
virtual ~IceCandidateInterface() {}
// The m= line this candidate is associated with.
// This is an integer index value stored as a string.
- virtual std::string label() const = 0;
+ virtual std::string label() const = 0; // Deprecated (jsep00)
+ // TODO: media_id should correspond to a=mid:.
+ virtual std::string media_id() const { return label(); }
virtual const cricket::Candidate& candidate() const = 0;
// Creates a SDP-ized form of this candidate.
virtual bool ToString(std::string* out) const = 0;
@@ -96,12 +119,22 @@ class IceCandidateCollection {
// a time and is therefore not expected to be thread safe.
class SessionDescriptionInterface {
public:
+ // The SdpType enums serve as arguments to setLocalDescription and
+ // setRemoteDescription.
+ // They provide information as to how the SDP should be handled.
+ enum SdpType {
+ kOffer,
+ kPrAnswer,
+ kAnswer,
+ };
+
virtual ~SessionDescriptionInterface() {}
virtual const cricket::SessionDescription* description() const = 0;
// Get the session id and session version, which are defined based on
// RFC 4566 for the SDP o= line.
virtual std::string session_id() const = 0;
virtual std::string session_version() const = 0;
+ virtual SdpType type() const = 0;
// Adds the specified candidate to the description.
// Ownership is not transferred.
// Returns false if the session description does not have a media section that
@@ -116,23 +149,52 @@ class SessionDescriptionInterface {
virtual bool ToString(std::string* out) const = 0;
};
-// Creates a SessionDescriptionInterface based on SDP string.
-// Returns NULL if the sdp string can't be parsed.
+// Deprecated (jsep00)
SessionDescriptionInterface* CreateSessionDescription(const std::string& sdp);
+// Creates a SessionDescriptionInterface based on SDP string and the SdpType.
+// Returns NULL if the sdp string can't be parsed.
+SessionDescriptionInterface* CreateSessionDescription(const std::string& sdp,
+ SessionDescriptionInterface::SdpType type);
// Jsep Ice candidate callback interface. An application should implement these
// methods to be notified of new local candidates.
class IceCandidateObserver {
public:
+ // TODO: Implement OnIceChange.
+ // Called any time the iceState changes.
+ virtual void OnIceChange() {}
// New Ice candidate have been found.
virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0;
// All Ice candidates have been found.
- virtual void OnIceComplete() = 0;
+ // Deprecated (jsep00)
+ virtual void OnIceComplete() {}
protected:
~IceCandidateObserver() {}
};
+// Jsep CreateOffer and CreateAnswer callback interface.
+class CreateSessionDescriptionObserver : public talk_base::RefCountInterface {
+ public:
+ // The implementation of the CreateSessionDescriptionObserver takes
+ // the ownership of the |desc|.
+ virtual void OnSuccess(SessionDescriptionInterface* desc) = 0;
+ virtual void OnFailure(const std::string& error) = 0;
+
+ protected:
+ ~CreateSessionDescriptionObserver() {}
+};
+
+// Jsep SetLocalDescription and SetRemoteDescription callback interface.
+class SetSessionDescriptionObserver : public talk_base::RefCountInterface {
+ public:
+ virtual void OnSuccess() = 0;
+ virtual void OnFailure(const std::string& error) = 0;
+
+ protected:
+ ~SetSessionDescriptionObserver() {}
+};
+
// Interface for implementing Jsep. PeerConnection implements these functions.
class JsepInterface {
public:
@@ -151,32 +213,79 @@ class JsepInterface {
kOnlyRelay
};
+ struct IceServer {
+ std::string uri;
+ std::string password;
+ };
+
+ typedef std::vector<IceServer> IceServers;
+
+ // Deprecated (jsep00)
virtual SessionDescriptionInterface* CreateOffer(const MediaHints& hints) = 0;
+
+ // Deprecated (jsep00)
// Create an answer to an offer. Returns NULL if an answer can't be created.
virtual SessionDescriptionInterface* CreateAnswer(
const MediaHints& hints,
const SessionDescriptionInterface* offer) = 0;
+ // Deprecated (jsep00)
// Starts or updates the ICE Agent process of
// gathering local candidates and pinging remote candidates.
// SetLocalDescription must be called before calling this method.
virtual bool StartIce(IceOptions options) = 0;
+ // Deprecated (jsep00)
// Sets the local session description.
// JsepInterface take ownership of |desc|.
virtual bool SetLocalDescription(Action action,
SessionDescriptionInterface* desc) = 0;
+
+ // Deprecated (jsep00)
// Sets the remote session description.
// JsepInterface take ownership of |desc|.
virtual bool SetRemoteDescription(Action action,
SessionDescriptionInterface* desc) = 0;
+
+ // Deprecated (jsep00)
// Processes received ICE information.
virtual bool ProcessIceMessage(
const IceCandidateInterface* ice_candidate) = 0;
virtual const SessionDescriptionInterface* local_description() const = 0;
virtual const SessionDescriptionInterface* remote_description() const = 0;
+ // JSEP01
+ // Create a new offer.
+ // The CreateSessionDescriptionObserver callback will be called when done.
+ virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
+ const SessionDescriptionOptions& options) = 0;
+ // Create an answer to an offer.
+ // The CreateSessionDescriptionObserver callback will be called when done.
+ virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
+ const SessionDescriptionOptions& options) = 0;
+ // Sets the local session description.
+ // JsepInterface takes the ownership of |desc| even if it fails.
+ // The |observer| callback will be called when done.
+ virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
+ SessionDescriptionInterface* desc) = 0;
+ // Sets the remote session description.
+ // JsepInterface takes the ownership of |desc| even if it fails.
+ // The |observer| callback will be called when done.
+ virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer,
+ SessionDescriptionInterface* desc) = 0;
+ // Restarts or updates the ICE Agent process of gathering local candidates
+ // and pinging remote candidates.
+ virtual bool UpdateIce(const IceServers& configuration,
+ IceOptions options) = 0;
+ // Provides a remote candidate to the ICE Agent.
+ // A copy of the |candidate| will be created and added to the remote
+ // description. So the caller of this method still has the ownership of the
+ // |candidate|.
+ // TODO: Consider to change this so that the AddIceCandidate will
+ // take the ownership of the |candidate|.
+ virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0;
+
protected:
~JsepInterface() {}
};
@@ -36,15 +36,21 @@ using cricket::SessionDescription;
namespace webrtc {
SessionDescriptionInterface* CreateSessionDescription(const std::string& sdp) {
+ return CreateSessionDescription(sdp, SessionDescriptionInterface::kOffer);
+}
+
+SessionDescriptionInterface* CreateSessionDescription(const std::string& sdp,
+ SessionDescriptionInterface::SdpType type) {
JsepSessionDescription* jsep_desc = new JsepSessionDescription();
- if (!jsep_desc->Initialize(sdp)) {
+ if (!jsep_desc->Initialize(sdp, type)) {
delete jsep_desc;
return NULL;
}
return jsep_desc;
}
-JsepSessionDescription::JsepSessionDescription() {
+JsepSessionDescription::JsepSessionDescription()
+ : type_(kOffer) {
}
JsepSessionDescription::~JsepSessionDescription() {}
@@ -53,14 +59,29 @@ bool JsepSessionDescription::Initialize(
cricket::SessionDescription* description,
const std::string& session_id,
const std::string& session_version) {
+ return Initialize(description, session_id, session_version, type_);
+}
+
+bool JsepSessionDescription::Initialize(const std::string& sdp) {
+ return Initialize(sdp, type_);
+}
+
+bool JsepSessionDescription::Initialize(
+ cricket::SessionDescription* description,
+ const std::string& session_id,
+ const std::string& session_version,
+ SdpType type) {
session_id_ = session_id;
session_version_ = session_version;
+ type_ = type;
description_.reset(description);
candidate_collection_.resize(number_of_mediasections());
return true;
}
-bool JsepSessionDescription::Initialize(const std::string& sdp) {
+bool JsepSessionDescription::Initialize(const std::string& sdp,
+ SdpType type) {
+ type_ = type;
return SdpDeserialize(sdp, this);
}
@@ -48,12 +48,20 @@ class JsepSessionDescription : public SessionDescriptionInterface {
JsepSessionDescription();
virtual ~JsepSessionDescription();
- // Takes ownership of |description|.
+ // TODO: Remove below 2 methods when they are no longer used - when
+ // the deprecated methods in JsepInterface are removed.
bool Initialize(cricket::SessionDescription* description,
const std::string& session_id,
const std::string& session_version);
bool Initialize(const std::string& sdp);
+ // Takes ownership of |description|.
+ bool Initialize(cricket::SessionDescription* description,
+ const std::string& session_id,
+ const std::string& session_version,
+ SdpType type);
+ bool Initialize(const std::string& sdp, SdpType type);
+
virtual const cricket::SessionDescription* description() const {
return description_.get();
}
@@ -63,6 +71,9 @@ class JsepSessionDescription : public SessionDescriptionInterface {
virtual std::string session_version() const {
return session_version_;
}
+ virtual SdpType type() const {
+ return type_;
+ }
virtual bool AddCandidate(const IceCandidateInterface* candidate);
virtual size_t number_of_mediasections() const;
virtual const IceCandidateCollection* candidates(
@@ -73,6 +84,7 @@ class JsepSessionDescription : public SessionDescriptionInterface {
talk_base::scoped_ptr<cricket::SessionDescription> description_;
std::string session_id_;
std::string session_version_;
+ SdpType type_;
std::vector<JsepCandidateCollection> candidate_collection_;
DISALLOW_COPY_AND_ASSIGN(JsepSessionDescription);
Oops, something went wrong.

0 comments on commit 5e6bbe4

Please sign in to comment.