Update talk folder to revision=49470012. Same as 375 in libjingle's google code repository.

TBR=wu@webrtc.org

BUG=N/A

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4364 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc
index 63a32e8..d6a8b58 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -69,9 +69,9 @@
 #include "talk/media/devices/videorendererfactory.h"
 #include "talk/media/webrtc/webrtcvideocapturer.h"
 #include "third_party/icu/public/common/unicode/unistr.h"
-#include "third_party/webrtc/system_wrappers/interface/trace.h"
-#include "third_party/webrtc/video_engine/include/vie_base.h"
-#include "third_party/webrtc/voice_engine/include/voe_base.h"
+#include "webrtc/system_wrappers/interface/trace.h"
+#include "webrtc/video_engine/include/vie_base.h"
+#include "webrtc/voice_engine/include/voe_base.h"
 
 using icu::UnicodeString;
 using webrtc::AudioSourceInterface;
diff --git a/talk/app/webrtc/webrtcsession_unittest.cc b/talk/app/webrtc/webrtcsession_unittest.cc
index e56e8a2..78619c6 100644
--- a/talk/app/webrtc/webrtcsession_unittest.cc
+++ b/talk/app/webrtc/webrtcsession_unittest.cc
@@ -66,8 +66,6 @@
 using cricket::NS_GINGLE_P2P;
 using cricket::NS_JINGLE_ICE_UDP;
 using cricket::TransportInfo;
-using cricket::kDtmfDelay;
-using cricket::kDtmfReset;
 using talk_base::SocketAddress;
 using talk_base::scoped_ptr;
 using webrtc::CreateSessionDescription;
@@ -2247,13 +2245,13 @@
 
   cricket::SessionDescription* answer_copy = answer->description()->Copy();
   answer_copy->RemoveContentByName("video");
-  JsepSessionDescription* modified_answer =
-      new JsepSessionDescription(JsepSessionDescription::kAnswer);
+  talk_base::scoped_ptr<JsepSessionDescription> modified_answer(
+      new JsepSessionDescription(JsepSessionDescription::kAnswer));
 
   EXPECT_TRUE(modified_answer->Initialize(answer_copy,
                                           answer->session_id(),
                                           answer->session_version()));
-  SetLocalDescriptionExpectError(kMlineMismatch, modified_answer);
+  SetLocalDescriptionExpectError(kMlineMismatch, modified_answer.get());
   SetLocalDescriptionWithoutError(answer);
 }
 
diff --git a/talk/build/common.gypi b/talk/build/common.gypi
index 7775e24..f2322b1 100644
--- a/talk/build/common.gypi
+++ b/talk/build/common.gypi
@@ -29,6 +29,7 @@
 
 {
   'variables': {
+   'webrtc_root%': '<(DEPTH)/webrtc',
     # TODO(ronghuawu): Chromium build will need a different libjingle_root.
     'libjingle_root%': '<(DEPTH)',
     # TODO(ronghuawu): For now, disable the Chrome plugins, which causes a
@@ -44,6 +45,7 @@
       '../..',
       '../../third_party',
       '../../third_party/webrtc',
+      '../../webrtc',
     ],
     'defines': [
       'EXPAT_RELATIVE_PATH',
diff --git a/talk/libjingle.gyp b/talk/libjingle.gyp
index b1d7131..270a55d 100755
--- a/talk/libjingle.gyp
+++ b/talk/libjingle.gyp
@@ -80,7 +80,7 @@
             {
               'variables': {
                 'java_src_dir': 'app/webrtc/java/src',
-                'webrtc_modules_dir': '<(DEPTH)/third_party/webrtc/modules',
+                'webrtc_modules_dir': '<(webrtc_root)/modules',
                 'peerconnection_java_files': [
                   'app/webrtc/java/src/org/webrtc/AudioSource.java',
                   'app/webrtc/java/src/org/webrtc/AudioTrack.java',
@@ -105,13 +105,13 @@
                 # included here, or better yet, build a proper .jar in webrtc
                 # and include it here.
                 'android_java_files': [
-                  '<(webrtc_modules_dir)/audio_device/android/org/webrtc/voiceengine/WebRTCAudioDevice.java',
-                  '<(webrtc_modules_dir)/video_capture/android/java/org/webrtc/videoengine/CaptureCapabilityAndroid.java',
-                  '<(webrtc_modules_dir)/video_capture/android/java/org/webrtc/videoengine/VideoCaptureAndroid.java',
-                  '<(webrtc_modules_dir)/video_capture/android/java/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java',
-                  '<(webrtc_modules_dir)/video_render/android/java/org/webrtc/videoengine/ViEAndroidGLES20.java',
-                  '<(webrtc_modules_dir)/video_render/android/java/org/webrtc/videoengine/ViERenderer.java',
-                  '<(webrtc_modules_dir)/video_render/android/java/org/webrtc/videoengine/ViESurfaceRenderer.java',
+                  '<(webrtc_modules_dir)/audio_device/android/java/src/org/webrtc/voiceengine/WebRTCAudioDevice.java',
+                  '<(webrtc_modules_dir)/video_capture/android/java/src/org/webrtc/videoengine/CaptureCapabilityAndroid.java',
+                  '<(webrtc_modules_dir)/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java',
+                  '<(webrtc_modules_dir)/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java',
+                  '<(webrtc_modules_dir)/video_render/android/java/src/org/webrtc/videoengine/ViEAndroidGLES20.java',
+                  '<(webrtc_modules_dir)/video_render/android/java/src/org/webrtc/videoengine/ViERenderer.java',
+                  '<(webrtc_modules_dir)/video_render/android/java/src/org/webrtc/videoengine/ViESurfaceRenderer.java',
                 ],
               },
               'action_name': 'create_jar',
@@ -769,11 +769,11 @@
       'type': 'static_library',
       'dependencies': [
         '<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',
-        '<(DEPTH)/third_party/webrtc/modules/modules.gyp:video_capture_module',
-        '<(DEPTH)/third_party/webrtc/modules/modules.gyp:video_render_module',
-        '<(DEPTH)/third_party/webrtc/video_engine/video_engine.gyp:video_engine_core',
-        '<(DEPTH)/third_party/webrtc/voice_engine/voice_engine.gyp:voice_engine',
-        '<(DEPTH)/third_party/webrtc/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+        '<(webrtc_root)/modules/modules.gyp:video_capture_module',
+        '<(webrtc_root)/modules/modules.gyp:video_render_module',
+        '<(webrtc_root)/video_engine/video_engine.gyp:video_engine_core',
+        '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
+        '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
         'libjingle',
         'libjingle_sound',
       ],
diff --git a/talk/libjingle.scons b/talk/libjingle.scons
index 2bacf6b..cfc0249 100644
--- a/talk/libjingle.scons
+++ b/talk/libjingle.scons
@@ -22,13 +22,13 @@
 )
 talk.Library(env, name = "gunit",
              srcs = [
-               "third_party/gtest/src/gtest-all.cc",
+               "testing/gtest/src/gtest-all.cc",
              ],
              includedirs = [
-               "third_party/gtest/include",
+               "testing/gtest/include",
                "third_party/expat-2.0.1/lib",
                "third_party/srtp",
-               "third_party/gtest",
+               "testing/gtest",
              ],
              cppdefines = [
                "EXPAT_RELATIVE_PATH",
@@ -355,7 +355,7 @@
              includedirs = [
                "third_party/libudev",
                "third_party/expat-2.0.1/lib",
-               "third_party/gtest/include",
+               "testing/gtest/include",
                "third_party/srtp/include",
                "third_party/srtp/crypto/include",
              ] + SSL_INCLUDES,
@@ -405,10 +405,10 @@
                "base/unittest_main.cc",
              ],
              includedirs = [
-               "third_party/gtest/include",
+               "testing/gtest/include",
                "third_party/expat-2.0.1/lib",
                "third_party/srtp",
-               "third_party/gtest",
+               "testing/gtest",
              ],
              cppdefines = [
                "EXPAT_RELATIVE_PATH",
@@ -589,10 +589,10 @@
                 "base/windowpicker_unittest.cc",
               ],
               includedirs = [
-                "third_party/gtest/include",
+                "testing/gtest/include",
                 "third_party/expat-2.0.1/lib",
                 "third_party/srtp",
-                "third_party/gtest",
+                "testing/gtest",
               ],
               win_srcs = [
                 "base/win32_unittest.cc",
@@ -644,10 +644,10 @@
                 "p2p/client/portallocator_unittest.cc",
               ],
               includedirs = [
-                "third_party/gtest/include",
+                "testing/gtest/include",
                 "third_party/expat-2.0.1/lib",
                 "third_party/srtp",
-                "third_party/gtest",
+                "testing/gtest",
               ],
               libs = [
                 "jingle",
@@ -688,10 +688,10 @@
                 "session/media/ssrcmuxfilter_unittest.cc",
               ],
               includedirs = [
-                "third_party/gtest/include",
+                "testing/gtest/include",
                 "third_party/expat-2.0.1/lib",
                 "third_party/srtp",
-                "third_party/gtest",
+                "testing/gtest",
               ],
               libs = [
                 "jingle",
@@ -712,10 +712,10 @@
               mac_libs = SSL_LIBS,
 
               includedirs = [
-                "third_party/gtest/include",
+                "testing/gtest/include",
                 "third_party/expat-2.0.1/lib",
                 "third_party/srtp",
-                "third_party/gtest",
+                "testing/gtest",
               ],
               cppdefines = [
                 "EXPAT_RELATIVE_PATH",
@@ -738,10 +738,10 @@
               ],
               mac_libs = SSL_LIBS,
               includedirs = [
-                "third_party/gtest/include",
+                "testing/gtest/include",
                 "third_party/expat-2.0.1/lib",
                 "third_party/srtp",
-                "third_party/gtest",
+                "testing/gtest",
               ],
               cppdefines = [
                 "EXPAT_RELATIVE_PATH",
@@ -772,10 +772,10 @@
                 "xmpp/xmppstanzaparser_unittest.cc",
               ],
               includedirs = [
-                "third_party/gtest/include",
+                "testing/gtest/include",
                 "third_party/expat-2.0.1/lib",
                 "third_party/srtp",
-                "third_party/gtest",
+                "testing/gtest",
               ],
               libs = [
                 "jingle",
diff --git a/talk/libjingle_tests.gyp b/talk/libjingle_tests.gyp
index 5a2f3a9..4b7b793 100755
--- a/talk/libjingle_tests.gyp
+++ b/talk/libjingle_tests.gyp
@@ -225,8 +225,7 @@
         ['os_posix==1', {
           'sources': [
             'base/sslidentity_unittest.cc',
-            # TODO(ronghuawu): reenable once fixed on build bots.
-            # 'base/sslstreamadapter_unittest.cc',
+            'base/sslstreamadapter_unittest.cc',
           ],
         }],
       ],  # conditions
diff --git a/talk/media/base/mediachannel.h b/talk/media/base/mediachannel.h
index b20051e..441fbff 100644
--- a/talk/media/base/mediachannel.h
+++ b/talk/media/base/mediachannel.h
@@ -393,12 +393,6 @@
   DF_SEND = 0x02,
 };
 
-// Special purpose DTMF event code used by the VoiceMediaChannel::InsertDtmf.
-const int kDtmfDelay = -1;  // Insert a delay to the end of the DTMF queue.
-const int kDtmfReset = -2;  // Reset the DTMF queue.
-// The delay in ms when the InsertDtmf is called with kDtmfDelay.
-const int kDtmfDelayInMs = 2000;
-
 class MediaChannel : public sigslot::has_slots<> {
  public:
   class NetworkInterface {
@@ -738,10 +732,8 @@
   // Send and/or play a DTMF |event| according to the |flags|.
   // The DTMF out-of-band signal will be used on sending.
   // The |ssrc| should be either 0 or a valid send stream ssrc.
-  // The valid value for the |event| are -2 to 15.
-  // kDtmfReset(-2) is used to reset the DTMF.
-  // kDtmfDelay(-1) is used to insert a delay to the end of the DTMF queue.
-  // 0 to 15 which corresponding to DTMF event 0-9, *, #, A-D.
+  // The valid value for the |event| are 0 to 15 which corresponding to
+  // DTMF event 0-9, *, #, A-D.
   virtual bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) = 0;
   // Gets quality stats for the channel.
   virtual bool GetStats(VoiceMediaInfo* info) = 0;
diff --git a/talk/media/base/rtpdataengine_unittest.cc b/talk/media/base/rtpdataengine_unittest.cc
index 23b57d4..4ee072e 100644
--- a/talk/media/base/rtpdataengine_unittest.cc
+++ b/talk/media/base/rtpdataengine_unittest.cc
@@ -140,7 +140,8 @@
 
   std::string GetSentData(int index) {
     // Assume RTP header of length 12
-    const talk_base::Buffer* packet = iface_->GetRtpPacket(index);
+    talk_base::scoped_ptr<const talk_base::Buffer> packet(
+        iface_->GetRtpPacket(index));
     if (packet->length() > 12) {
       return std::string(packet->data() + 12, packet->length() - 12);
     } else {
@@ -149,7 +150,8 @@
   }
 
   cricket::RtpHeader GetSentDataHeader(int index) {
-    const talk_base::Buffer* packet = iface_->GetRtpPacket(index);
+    talk_base::scoped_ptr<const talk_base::Buffer> packet(
+        iface_->GetRtpPacket(index));
     cricket::RtpHeader header;
     GetRtpHeader(packet->data(), packet->length(), &header);
     return header;
diff --git a/talk/media/webrtc/fakewebrtcvideoengine.h b/talk/media/webrtc/fakewebrtcvideoengine.h
index 886f403..68963f7 100644
--- a/talk/media/webrtc/fakewebrtcvideoengine.h
+++ b/talk/media/webrtc/fakewebrtcvideoengine.h
@@ -708,6 +708,10 @@
   WEBRTC_STUB(DeregisterDecoderObserver, (const int));
   WEBRTC_STUB(SendKeyFrame, (const int));
   WEBRTC_STUB(WaitForFirstKeyFrame, (const int, const bool));
+#ifdef USE_WEBRTC_DEV_BRANCH
+  WEBRTC_STUB(StartDebugRecording, (int, const char*));
+  WEBRTC_STUB(StopDebugRecording, (int));
+#endif
 
   // webrtc::ViECapture
   WEBRTC_STUB(NumberOfCaptureDevices, ());
diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc
index 266cefc..f392751 100644
--- a/talk/media/webrtc/webrtcvoiceengine.cc
+++ b/talk/media/webrtc/webrtcvoiceengine.cc
@@ -2290,12 +2290,6 @@
     return false;
   }
 
-  // TODO(ronghuawu): Remove this once the reset and delay are supported by VoE.
-  // https://code.google.com/p/webrtc/issues/detail?id=747
-  if (event == kDtmfReset || event == kDtmfDelay) {
-    return true;
-  }
-
   // Send the event.
   if (flags & cricket::DF_SEND) {
     if (send_ssrc_ != ssrc && ssrc != 0) {
diff --git a/talk/p2p/base/tcpport.cc b/talk/p2p/base/tcpport.cc
index 356dd67..037abec 100644
--- a/talk/p2p/base/tcpport.cc
+++ b/talk/p2p/base/tcpport.cc
@@ -121,8 +121,11 @@
                  ICE_TYPE_PREFERENCE_HOST_TCP, true);
   } else {
     LOG_J(LS_INFO, this) << "Not listening due to firewall restrictions.";
-    // Sending error signal as we can't allocate tcp candidate.
-    SignalPortError(this);
+    // Note: We still add the address, since otherwise the remote side won't
+    // recognize our incoming TCP connections.
+    AddAddress(talk_base::SocketAddress(ip(), 0),
+               talk_base::SocketAddress(ip(), 0), TCP_PROTOCOL_NAME,
+               LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP, true);
   }
 }
 
diff --git a/talk/p2p/client/portallocator_unittest.cc b/talk/p2p/client/portallocator_unittest.cc
index 2113103..1ee97f1 100644
--- a/talk/p2p/client/portallocator_unittest.cc
+++ b/talk/p2p/client/portallocator_unittest.cc
@@ -505,18 +505,6 @@
   // There is no error reporting from RelayEntry to handle this failure.
 }
 
-TEST_F(PortAllocatorTest, TestTcpPortNoListenAllowed) {
-  AddInterface(kClientAddr);
-  allocator().set_flags(cricket::PORTALLOCATOR_DISABLE_UDP |
-                        cricket::PORTALLOCATOR_DISABLE_STUN |
-                        cricket::PORTALLOCATOR_DISABLE_RELAY);
-  allocator().set_allow_tcp_listen(false);
-  EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
-  session_->StartGettingPorts();
-  EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
-  EXPECT_TRUE(candidates_.empty());
-}
-
 // Testing STUN timeout.
 TEST_F(PortAllocatorTest, TestGetAllPortsNoUdpAllowed) {
   fss_->AddRule(false, talk_base::FP_UDP, talk_base::FD_ANY, kClientAddr);
diff --git a/talk/session/media/channel.h b/talk/session/media/channel.h
index ddf7c67..b49d5a0 100644
--- a/talk/session/media/channel.h
+++ b/talk/session/media/channel.h
@@ -385,10 +385,8 @@
   // Send and/or play a DTMF |event| according to the |flags|.
   // The DTMF out-of-band signal will be used on sending.
   // The |ssrc| should be either 0 or a valid send stream ssrc.
-  // The valid value for the |event| are -2 to 15.
-  // kDtmfReset(-2) is used to reset the DTMF.
-  // kDtmfDelay(-1) is used to insert a delay to the end of the DTMF queue.
-  // 0 to 15 which corresponding to DTMF event 0-9, *, #, A-D.
+  // The valid value for the |event| are 0 which corresponding to DTMF
+  // event 0-9, *, #, A-D.
   bool InsertDtmf(uint32 ssrc, int event_code, int duration, int flags);
   bool SetOutputScaling(uint32 ssrc, double left, double right);
   // Get statistics about the current media session.
diff --git a/talk/session/media/channel_unittest.cc b/talk/session/media/channel_unittest.cc
index 8c02505..c9918f8 100644
--- a/talk/session/media/channel_unittest.cc
+++ b/talk/session/media/channel_unittest.cc
@@ -57,8 +57,6 @@
 using cricket::CA_ANSWER;
 using cricket::CA_UPDATE;
 using cricket::FakeVoiceMediaChannel;
-using cricket::kDtmfDelay;
-using cricket::kDtmfReset;
 using cricket::ScreencastId;
 using cricket::StreamParams;
 using cricket::TransportChannel;
@@ -2221,23 +2219,17 @@
   EXPECT_TRUE(SendAccept());
   EXPECT_EQ(0U, media_channel1_->dtmf_info_queue().size());
 
-  EXPECT_TRUE(channel1_->InsertDtmf(-1, kDtmfReset, -1, cricket::DF_SEND));
-  EXPECT_TRUE(channel1_->InsertDtmf(0, kDtmfDelay, 90, cricket::DF_PLAY));
   EXPECT_TRUE(channel1_->InsertDtmf(1, 3, 100, cricket::DF_SEND));
   EXPECT_TRUE(channel1_->InsertDtmf(2, 5, 110, cricket::DF_PLAY));
   EXPECT_TRUE(channel1_->InsertDtmf(3, 7, 120,
                                     cricket::DF_PLAY | cricket::DF_SEND));
 
-  ASSERT_EQ(5U, media_channel1_->dtmf_info_queue().size());
+  ASSERT_EQ(3U, media_channel1_->dtmf_info_queue().size());
   EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[0],
-                              -1, kDtmfReset, -1, cricket::DF_SEND));
-  EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[1],
-                              0, kDtmfDelay, 90, cricket::DF_PLAY));
-  EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[2],
                               1, 3, 100, cricket::DF_SEND));
-  EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[3],
+  EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[1],
                               2, 5, 110, cricket::DF_PLAY));
-  EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[4],
+  EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[2],
                               3, 7, 120, cricket::DF_PLAY | cricket::DF_SEND));
 }