Update stable to r4621.

git-svn-id: http://webrtc.googlecode.com/svn/stable/talk@4622 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/build/common.gypi b/build/common.gypi
index a8fcd57..50acb39 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -2,26 +2,26 @@
 # libjingle
 # Copyright 2012, Google Inc.
 #
-# Redistribution and use in source and binary forms, with or without 
+# Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
 #
-#  1. Redistributions of source code must retain the above copyright notice, 
+#  1. Redistributions of source code must retain the above copyright notice,
 #     this list of conditions and the following disclaimer.
 #  2. Redistributions in binary form must reproduce the above copyright notice,
 #     this list of conditions and the following disclaimer in the documentation
 #     and/or other materials provided with the distribution.
-#  3. The name of the author may not be used to endorse or promote products 
+#  3. The name of the author may not be used to endorse or promote products
 #     derived from this software without specific prior written permission.
 #
 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
@@ -36,8 +36,6 @@
     # flood of chromium-style warnings.
     'clang_use_chrome_plugins%': 0,
     'libpeer_target_type%': 'static_library',
-    # Whether or not to build the ObjectiveC PeerConnection API & tests.
-    'libjingle_objc%': 0,
     'conditions': [
       ['OS=="android" or OS=="linux"', {
         # TODO(henrike): make sure waterfall bots have $JAVA_HOME configured
@@ -110,7 +108,7 @@
           'HAVE_OPENSSL_SSL_H=1',
         ],
       }],
-      ['libjingle_objc==1', {
+      ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', {
         'defines': [
           'CARBON_DEPRECATED=YES',
         ],
diff --git a/libjingle.gyp b/libjingle.gyp
index aa61360..db19a98 100755
--- a/libjingle.gyp
+++ b/libjingle.gyp
@@ -42,7 +42,6 @@
        }],
      ],
     }],
-
     ['OS=="linux" or OS=="android"', {
       'targets': [
         {
@@ -150,7 +149,7 @@
         },
       ],
     }],
-    ['libjingle_objc == 1', {
+    ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', {
       'targets': [
         {
           'target_name': 'libjingle_peerconnection_objc',
@@ -234,8 +233,8 @@
           'xcode_settings': {
             'CLANG_ENABLE_OBJC_ARC': 'YES',
           },
-        }
-      ]
+        },  # target libjingle_peerconnection_objc
+      ],
     }],
   ],
 
@@ -591,17 +590,6 @@
           ],
         }],
         ['OS=="mac"', {
-          'conditions': [
-            ['libjingle_objc != 1', {
-              'link_settings' :{
-                'xcode_settings': {
-                  'OTHER_LDFLAGS': [
-                    '-framework Carbon',
-                  ],
-                },
-              },
-            }],
-          ],
           'sources': [
             'base/macasyncsocket.cc',
             'base/macasyncsocket.h',
@@ -619,18 +607,36 @@
           ],
           'link_settings': {
             'libraries': [
-             '$(SDKROOT)/usr/lib/libcrypto.dylib',
-             '$(SDKROOT)/usr/lib/libssl.dylib',
+              '$(SDKROOT)/usr/lib/libcrypto.dylib',
+              '$(SDKROOT)/usr/lib/libssl.dylib',
             ],
-            'xcode_settings': {
-              'OTHER_LDFLAGS': [
-                '-framework Cocoa',
-                '-framework IOKit',
-                '-framework Security',
-                '-framework SystemConfiguration',
-              ],
+          },
+          'all_dependent_settings': {
+            'link_settings': {
+              'xcode_settings': {
+                'OTHER_LDFLAGS': [
+                  '-framework Cocoa',
+                  '-framework Foundation',
+                  '-framework IOKit',
+                  '-framework Security',
+                  '-framework SystemConfiguration',
+                ],
+              },
             },
           },
+          'conditions': [
+            ['target_arch=="ia32"', {
+              'all_dependent_settings': {
+                'link_settings': {
+                  'xcode_settings': {
+                    'OTHER_LDFLAGS': [
+                      '-framework Carbon',
+                    ],
+                  },
+                },
+              },
+            }],
+          ],
         }],
         ['OS=="ios"', {
           'sources': [
@@ -639,13 +645,16 @@
           'dependencies': [
             '../net/third_party/nss/ssl.gyp:libssl',
           ],
-          'xcode_settings': {
-            'OTHER_LDFLAGS': [
-              '-framework IOKit',
-              '-framework Security',
-              '-framework SystemConfiguration',
-              '-framework UIKit',
-            ],
+          'all_dependent_settings': {
+            'xcode_settings': {
+              'OTHER_LDFLAGS': [
+                '-framework Foundation',
+                '-framework IOKit',
+                '-framework Security',
+                '-framework SystemConfiguration',
+                '-framework UIKit',
+              ],
+            },
           },
         }],
         ['OS=="win"', {
@@ -903,12 +912,18 @@
             'media/devices/macdevicemanagermm.mm',
           ],
           'conditions': [
-            # TODO(hughv):  Investigate if this is needed.
-            [ 'libjingle_objc != 1', {
+            ['target_arch=="ia32"', {
               'sources': [
                 'media/devices/carbonvideorenderer.cc',
                 'media/devices/carbonvideorenderer.h',
               ],
+              'link_settings': {
+                'xcode_settings': {
+                  'OTHER_LDFLAGS': [
+                    '-framework Carbon',
+                  ],
+                },
+              },
             }],
           ],
           'xcode_settings': {
diff --git a/libjingle_examples.gyp b/libjingle_examples.gyp
index 78bfe65..d4aa4a4 100755
--- a/libjingle_examples.gyp
+++ b/libjingle_examples.gyp
@@ -218,7 +218,7 @@
       ], # targets
     }],  # OS=="linux" or OS=="win"
 
-    ['libjingle_objc==1 and OS=="ios"', {
+    ['OS=="ios"', {
       'targets': [
         {
           'target_name': 'AppRTCDemo',
@@ -276,17 +276,23 @@
                 # we could pick more intelligently among the keys, but as a
                 # first cut just tell the developer to specify a key identity
                 # explicitly.
-                'ensure_single_key': '<!(python -c "assert len(\'\'\'<(key_id)\'\'\') > 0 and \'\\n\' not in \'\'\'<(key_id)\'\'\', \'key_id gyp variable needs to be set explicitly because there are multiple codesigning keys, or none!\'")',
+                'ensure_single_key': '<!(python -c "assert \'\\n\' not in \'\'\'<(key_id)\'\'\', \'key_id gyp variable needs to be set explicitly because there are multiple codesigning keys!\'")',
               },
-              'action': [
-                '/usr/bin/codesign', '-v', '--force', '--sign', '<(key_id)',
-                '${BUILT_PRODUCTS_DIR}/AppRTCDemo.app',
+              'conditions': [
+                ['key_id==""', {
+                  'action': [ 'echo', 'Skipping signing' ],
+                }, {
+                  'action': [
+                    '/usr/bin/codesign', '-v', '--force', '--sign', '<(key_id)',
+                    '${BUILT_PRODUCTS_DIR}/AppRTCDemo.app',
+                  ],
+                }],
               ],
             },
           ],
         },  # target AppRTCDemo
       ],  # targets
-    }],  # libjingle_objc==1
+    }],  # OS=="ios"
 
     ['OS=="android"', {
       'targets': [
diff --git a/libjingle_tests.gyp b/libjingle_tests.gyp
index 9ea81af..e0cc239 100755
--- a/libjingle_tests.gyp
+++ b/libjingle_tests.gyp
@@ -464,13 +464,16 @@
         },
       ],
     }],
-    ['libjingle_objc == 1', {
+    ['OS=="ios" or (OS=="mac" and target_arch!="ia32" and mac_sdk>="10.7")', {
+      # The >=10.7 above is required to make ARC link cleanly (e.g. as
+      # opposed to _compile_ cleanly, which the library under test
+      # does just fine on 10.6 too).
       'targets': [
         {
+        'target_name': 'libjingle_peerconnection_objc_test',
           'variables': {
             'infoplist_file': './app/webrtc/objctests/Info.plist',
           },
-          'target_name': 'libjingle_peerconnection_objc_test',
           'type': 'executable',
           'mac_bundle': 1,
           'mac_bundle_resources': [
@@ -510,7 +513,7 @@
               ],
             }],
           ],
-        },
+        },  # target libjingle_peerconnection_objc_test
       ],
     }],
   ],
diff --git a/p2p/base/fakesession.h b/p2p/base/fakesession.h
index d3da2b2..8b1550c 100644
--- a/p2p/base/fakesession.h
+++ b/p2p/base/fakesession.h
@@ -71,7 +71,8 @@
         tiebreaker_(0),
         ice_proto_(ICEPROTO_HYBRID),
         remote_ice_mode_(ICEMODE_FULL),
-        dtls_fingerprint_("", NULL, 0) {
+        dtls_fingerprint_("", NULL, 0),
+        ssl_role_(talk_base::SSL_CLIENT) {
   }
   ~FakeTransportChannel() {
     Reset();
@@ -207,7 +208,6 @@
 
   bool SetLocalIdentity(talk_base::SSLIdentity* identity) {
     identity_ = identity;
-
     return true;
   }