Permalink
Browse files

Update libjingle to 34494359.

- Fix for the "google-ice" ICE option in answer.
Review URL: https://webrtc-codereview.appspot.com/864005

git-svn-id: http://libjingle.googlecode.com/svn/trunk@196 dd674b97-3498-5ee5-1854-bdd07cd0ff33
  • Loading branch information...
1 parent 0a49800 commit 6e00b5d8b8b1f9f0dbf63f2b0f6ce7d3c41daedc ronghuawu@google.com committed Oct 2, 2012
Showing with 772 additions and 235 deletions.
  1. +3 −0 CHANGELOG
  2. +1 −1 talk/app/webrtc/audiotrack.h
  3. +1 −1 talk/app/webrtc/test/fakeaudiocapturemodule.h
  4. +41 −46 talk/app/webrtc/webrtcsession.cc
  5. +2 −1 talk/app/webrtc/webrtcsession.h
  6. +130 −15 talk/app/webrtc/webrtcsession_unittest.cc
  7. +2 −2 talk/base/basictypes.h
  8. +17 −13 talk/examples/call/callclient.cc
  9. +9 −4 talk/examples/call/callclient.h
  10. +4 −1 talk/media/base/capturemanager.cc
  11. +2 −4 talk/media/devices/devicemanager_unittest.cc
  12. +1 −1 talk/media/devices/videorendererfactory.h
  13. +4 −3 talk/media/webrtc/fakewebrtcvideoengine.h
  14. +2 −0 talk/media/webrtc/fakewebrtcvoiceengine.h
  15. +7 −0 talk/media/webrtc/webrtcpassthroughrender.h
  16. +1 −1 talk/media/webrtc/webrtcvoe.h
  17. +9 −8 talk/media/webrtc/webrtcvoiceengine.cc
  18. +1 −0 talk/media/webrtc/webrtcvoiceengine.h
  19. +2 −0 talk/media/webrtc/webrtcvoiceengine_unittest.cc
  20. +1 −0 talk/p2p/base/constants.cc
  21. +1 −0 talk/p2p/base/constants.h
  22. +6 −5 talk/p2p/base/dtlstransportchannel_unittest.cc
  23. +1 −1 talk/p2p/base/fakesession.h
  24. +61 −6 talk/p2p/base/session.cc
  25. +12 −28 talk/p2p/base/session.h
  26. +9 −0 talk/p2p/base/session_unittest.cc
  27. +87 −20 talk/p2p/base/transport.cc
  28. +15 −4 talk/p2p/base/transport.h
  29. +14 −13 talk/p2p/base/transport_unittest.cc
  30. +2 −3 talk/p2p/base/transportdescriptionfactory.cc
  31. +102 −11 talk/session/media/call.cc
  32. +20 −5 talk/session/media/call.h
  33. +36 −28 talk/session/media/channel.cc
  34. +8 −3 talk/session/media/channel.h
  35. +2 −2 talk/session/media/channel_unittest.cc
  36. +101 −1 talk/session/media/channelmanager.cc
  37. +23 −0 talk/session/media/channelmanager.h
  38. +0 −1 talk/session/media/mediasession_unittest.cc
  39. +32 −3 talk/session/tunnel/tunnelsessionclient.cc
View
@@ -1,5 +1,8 @@
Libjingle
+0.7.1 - Oct 2, 2012
+ - Fix for the "google-ice" ICE option in answer.
+
0.7.0 - Sep 14, 2012
- Enable RFC 5245 ICE for PeerConnection.
@@ -40,7 +40,7 @@
#include "modules/audio_device/main/interface/audio_device.h"
#endif
#else
-#include "third_party/webrtc/modules/audio_device/main/interface/audio_device.h"
+#include "third_party/webrtc/modules/audio_device/include/audio_device.h"
#endif
namespace webrtc {
@@ -50,7 +50,7 @@
#endif
#else
#include "third_party/webrtc/common_types.h"
-#include "third_party/webrtc/modules/audio_device/main/interface/audio_device.h"
+#include "third_party/webrtc/modules/audio_device/include/audio_device.h"
#endif // WEBRTC_RELATIVE_PATH
namespace talk_base {
@@ -330,28 +330,11 @@ bool WebRtcSession::SetLocalDescription(Action action,
return false;
}
+ if (!UpdateSessionState(action, cricket::CS_LOCAL, desc->description())) {
+ return false;
+ }
// Kick starting the ice candidates allocation.
StartCandidatesAllocation();
-
- switch (action) {
- case kOffer:
- SetState(STATE_SENTINITIATE);
- break;
- case kAnswer:
- // Remove channel and transport proxies, if MediaContentDescription is
- // rejected in local session description.
- RemoveUnusedChannelsAndTransports(desc->description());
- if (!transport_muxed()) {
- MaybeEnableMuxingSupport();
- }
- EnableChannels();
- SetState(STATE_SENTACCEPT);
- break;
- case kPrAnswer:
- EnableChannels();
- SetState(STATE_SENTPRACCEPT);
- break;
- }
return error() == cricket::BaseSession::ERROR_NONE;
}
@@ -392,31 +375,8 @@ bool WebRtcSession::SetRemoteDescription(Action action,
// is called.
set_remote_description(desc->description()->Copy());
-
- switch (action) {
- case kOffer:
- SetState(STATE_RECEIVEDINITIATE);
- // Pushing remote transport description information down to the
- // transport channels.
- PushdownRemoteTransportDescription();
- break;
- case kAnswer:
- // Remove channel and transport proxies, if MediaContentDescription is
- // rejected in remote session description.
- RemoveUnusedChannelsAndTransports(desc->description());
- if (!transport_muxed()) {
- MaybeEnableMuxingSupport();
- }
- EnableChannels();
- SetState(STATE_RECEIVEDACCEPT);
- // Pushing remote transport description information down to the
- // transport channels.
- PushdownRemoteTransportDescription();
- break;
- case kPrAnswer:
- EnableChannels();
- SetState(STATE_RECEIVEDPRACCEPT);
- break;
+ if (!UpdateSessionState(action, cricket::CS_REMOTE, desc->description())) {
+ return false;
}
// Update remote MediaStreams.
@@ -437,10 +397,45 @@ bool WebRtcSession::SetRemoteDescription(Action action,
return error() == cricket::BaseSession::ERROR_NONE;
}
+bool WebRtcSession::UpdateSessionState(
+ Action action, cricket::ContentSource source,
+ const cricket::SessionDescription* desc) {
+ bool ret = false;
+ if (action == kOffer) {
+ if (PushdownTransportDescription(source, cricket::CA_OFFER)) {
+ SetState(source == cricket::CS_LOCAL ?
+ STATE_SENTINITIATE : STATE_RECEIVEDINITIATE);
+ ret = true;
+ }
+ } else if (action == kPrAnswer) {
+ if (PushdownTransportDescription(source, cricket::CA_PRANSWER)) {
+ EnableChannels();
+ SetState(source == cricket::CS_LOCAL ?
+ STATE_SENTPRACCEPT : STATE_RECEIVEDPRACCEPT);
+ ret = true;
+ }
+ } else if (action == kAnswer) {
+ // Remove channel and transport proxies, if MediaContentDescription is
+ // rejected in local session description.
+ RemoveUnusedChannelsAndTransports(desc);
+ if (!transport_muxed()) {
+ MaybeEnableMuxingSupport();
+ }
+ if (PushdownTransportDescription(source, cricket::CA_ANSWER)) {
+ EnableChannels();
+ SetState(source == cricket::CS_LOCAL ?
+ STATE_SENTACCEPT : STATE_RECEIVEDACCEPT);
+ ret = true;
+ }
+ }
+ return ret;
+}
+
bool WebRtcSession::ProcessIceMessage(const IceCandidateInterface* candidate) {
if (state() == STATE_INIT) {
LOG(LS_ERROR) << "ProcessIceMessage: ICE candidates can't be added "
- << "without any offer (local or remote) session description.";
+ << "without any offer (local or remote) "
+ << "session description.";
return false;
}
@@ -138,10 +138,11 @@ class WebRtcSession : public cricket::BaseSession,
// Invokes ConnectChannels() on transport proxies, which initiates ice
// candidates allocation.
bool StartCandidatesAllocation();
+ bool UpdateSessionState(Action action, cricket::ContentSource source,
+ const cricket::SessionDescription* desc);
virtual void OnMessage(talk_base::Message* msg);
-
// Transport related callbacks, override from cricket::BaseSession.
virtual void OnTransportRequestSignaling(cricket::Transport* transport);
virtual void OnTransportConnecting(cricket::Transport* transport);
@@ -83,6 +83,15 @@ static const int kMediaContentIndex1 = 1;
static const int kIceCandidatesTimeout = 10000;
+// Add some extra |newlines| to the |message| after |line|.
+static void InjectAfter(const std::string& line,
+ const std::string& newlines,
+ std::string* message) {
+ const std::string tmp = line + newlines;
+ talk_base::replace_substrs(line.c_str(), line.length(),
+ tmp.c_str(), tmp.length(), message);
+}
+
class MockCandidateObserver : public webrtc::IceCandidateObserver {
public:
MockCandidateObserver()
@@ -459,15 +468,11 @@ class WebRtcSessionTest : public testing::Test {
}
}
- void VerifyTransportType(const SessionDescriptionInterface* desc,
- const std::string& content_name,
- const std::string& transport_type) {
- ASSERT_TRUE(desc != NULL);
- ASSERT_TRUE(desc->description() != NULL);
- const TransportInfo* transport_info =
- desc->description()->GetTransportInfoByName(content_name);
- ASSERT_TRUE(transport_info != NULL);
- EXPECT_EQ(transport_type, transport_info->description.transport_type);
+ void VerifyTransportType(const std::string& content_name,
+ cricket::TransportProtocol protocol) {
+ const cricket::Transport* transport = session_->GetTransport(content_name);
+ ASSERT_TRUE(transport != NULL);
+ EXPECT_EQ(protocol, transport->protocol());
}
cricket::FakeMediaEngine* media_engine_;
@@ -1394,16 +1399,126 @@ TEST_F(WebRtcSessionTest, TestHandleBackwardCompatibility) {
// Use "1" as the session version to indicate a older client.
JsepSessionDescription* offer =
CreateOfferSessionDescriptionWithVersion(options, "1");
- VerifyTransportType(offer, "audio", NS_JINGLE_ICE_UDP);
- VerifyTransportType(offer, "video", NS_JINGLE_ICE_UDP);
EXPECT_TRUE(session_->SetRemoteDescription(JsepInterface::kOffer, offer));
- VerifyTransportType(session_->remote_description(), "audio", NS_GINGLE_P2P);
- VerifyTransportType(session_->remote_description(), "video", NS_GINGLE_P2P);
+ SessionDescriptionInterface* answer = session_->CreateAnswer(MediaHints(),
+ offer);
+ EXPECT_TRUE(session_->SetLocalDescription(JsepInterface::kAnswer,
+ answer));
+ VerifyTransportType("audio", cricket::ICEPROTO_GOOGLE);
+ VerifyTransportType("video", cricket::ICEPROTO_GOOGLE);
// The WebRtcSession has remember the fact that the remote client is a older
// version client. So even the follow up offer has a session version of "2",
// the WebRtcSession will still update the transport type to NS_GINGLE_P2P.
offer = CreateOfferSessionDescriptionWithVersion(options, "2");
EXPECT_TRUE(session_->SetRemoteDescription(JsepInterface::kOffer, offer));
- VerifyTransportType(session_->remote_description(), "audio", NS_GINGLE_P2P);
- VerifyTransportType(session_->remote_description(), "video", NS_GINGLE_P2P);
+ VerifyTransportType("audio", cricket::ICEPROTO_GOOGLE);
+ VerifyTransportType("video", cricket::ICEPROTO_GOOGLE);
+}
+
+TEST_F(WebRtcSessionTest, TestInitiatorGIceInAnswer) {
+ WebRtcSessionTest::Init();
+ session_->set_secure_policy(cricket::SEC_DISABLED);
+ cricket::MediaSessionOptions options;
+ options.has_video = true;
+ SessionDescriptionInterface* offer = session_->CreateOffer(MediaHints());
+ EXPECT_TRUE(session_->SetLocalDescription(JsepInterface::kOffer, offer));
+ SessionDescriptionInterface* answer = session_->CreateAnswer(MediaHints(),
+ offer);
+ std::string sdp;
+ EXPECT_TRUE(answer->ToString(&sdp));
+ // Adding ice-options to the session level.
+ InjectAfter("t=0 0\r\n",
+ "a=ice-options:google-ice\r\n",
+ &sdp);
+ JsepSessionDescription* answer_with_gice =
+ new JsepSessionDescription(JsepSessionDescription::kAnswer);
+ EXPECT_TRUE((answer_with_gice)->Initialize(sdp));
+ EXPECT_TRUE(session_->SetRemoteDescription(JsepInterface::kAnswer,
+ answer_with_gice));
+ VerifyTransportType("audio", cricket::ICEPROTO_GOOGLE);
+ VerifyTransportType("video", cricket::ICEPROTO_GOOGLE);
+}
+
+TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
+ WebRtcSessionTest::Init();
+ session_->set_secure_policy(cricket::SEC_DISABLED);
+ cricket::MediaSessionOptions options;
+ options.has_video = true;
+ SessionDescriptionInterface* offer = session_->CreateOffer(MediaHints());
+ EXPECT_TRUE(session_->SetLocalDescription(JsepInterface::kOffer, offer));
+ SessionDescriptionInterface* answer = session_->CreateAnswer(MediaHints(),
+ offer);
+ EXPECT_TRUE(session_->SetRemoteDescription(JsepInterface::kAnswer,
+ answer));
+ VerifyTransportType("audio", cricket::ICEPROTO_RFC5245);
+ VerifyTransportType("video", cricket::ICEPROTO_RFC5245);
+}
+
+TEST_F(WebRtcSessionTest, TestReceiverGIceInOffer) {
+ WebRtcSessionTest::Init();
+ session_->set_secure_policy(cricket::SEC_DISABLED);
+ cricket::MediaSessionOptions options;
+ options.has_video = true;
+ SessionDescriptionInterface* offer = session_->CreateOffer(MediaHints());
+ EXPECT_TRUE(session_->SetRemoteDescription(JsepInterface::kOffer, offer));
+ SessionDescriptionInterface* answer = session_->CreateAnswer(MediaHints(),
+ offer);
+ std::string sdp;
+ EXPECT_TRUE(answer->ToString(&sdp));
+ // Adding ice-options to the session level.
+ InjectAfter("t=0 0\r\n",
+ "a=ice-options:google-ice\r\n",
+ &sdp);
+ JsepSessionDescription* answer_with_gice =
+ new JsepSessionDescription(JsepSessionDescription::kAnswer);
+ EXPECT_TRUE((answer_with_gice)->Initialize(sdp));
+ EXPECT_TRUE(session_->SetLocalDescription(JsepInterface::kAnswer,
+ answer_with_gice));
+ VerifyTransportType("audio", cricket::ICEPROTO_GOOGLE);
+ VerifyTransportType("video", cricket::ICEPROTO_GOOGLE);
+}
+
+TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
+ WebRtcSessionTest::Init();
+ session_->set_secure_policy(cricket::SEC_DISABLED);
+ cricket::MediaSessionOptions options;
+ options.has_video = true;
+ SessionDescriptionInterface* offer = session_->CreateOffer(MediaHints());
+ EXPECT_TRUE(session_->SetRemoteDescription(JsepInterface::kOffer,
+ offer));
+ SessionDescriptionInterface* answer =
+ session_->CreateAnswer(MediaHints(), offer);
+ EXPECT_TRUE(session_->SetLocalDescription(JsepInterface::kAnswer,
+ answer));
+ VerifyTransportType("audio", cricket::ICEPROTO_RFC5245);
+ VerifyTransportType("video", cricket::ICEPROTO_RFC5245);
+}
+
+TEST_F(WebRtcSessionTest, TestIceOfferGIceOnlyAnswer) {
+ WebRtcSessionTest::Init();
+ session_->set_secure_policy(cricket::SEC_DISABLED);
+ cricket::MediaSessionOptions options;
+ options.has_video = true;
+ talk_base::scoped_ptr<SessionDescriptionInterface> offer(
+ session_->CreateOffer(MediaHints()));
+ std::string offer_str;
+ offer->ToString(&offer_str);
+ // Disable google-ice
+ const std::string gice_option = "google-ice";
+ const std::string xgoogle_xice = "xgoogle-xice";
+ talk_base::replace_substrs(gice_option.c_str(), gice_option.length(),
+ xgoogle_xice.c_str(), xgoogle_xice.length(),
+ &offer_str);
+ JsepSessionDescription *ice_only_offer =
+ new JsepSessionDescription(JsepSessionDescription::kOffer);
+ EXPECT_TRUE((ice_only_offer)->Initialize(offer_str));
+ EXPECT_TRUE(session_->SetLocalDescription(JsepInterface::kOffer,
+ ice_only_offer));
+ std::string original_offer_sdp;
+ EXPECT_TRUE(offer->ToString(&original_offer_sdp));
+ JsepSessionDescription* answer_with_gice =
+ new JsepSessionDescription(JsepSessionDescription::kAnswer);
+ EXPECT_TRUE((answer_with_gice)->Initialize(original_offer_sdp));
+ EXPECT_FALSE(session_->SetRemoteDescription(JsepInterface::kAnswer,
+ answer_with_gice));
}
View
@@ -137,8 +137,8 @@ namespace talk_base {
}
#define ALIGNP(p, t) \
- (reinterpret_cast<uint8*>(((reinterpret_cast<uintptr_t>(p) + \
- ((t)-1)) & ~((t)-1))))
+ (reinterpret_cast<uint8*>(((reinterpret_cast<uintptr_t>(p) + \
+ ((t) - 1)) & ~((t) - 1))))
#define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1)))
// Note: UNUSED is also defined in common.h
Oops, something went wrong.

0 comments on commit 6e00b5d

Please sign in to comment.