Allow to skip turn by passing ts=false to apprtc.

R=braveyao@webrtc.org, fischman@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5384 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/samples/js/apprtc/apprtc.py b/samples/js/apprtc/apprtc.py
index 2f7564e..743ea4f 100644
--- a/samples/js/apprtc/apprtc.py
+++ b/samples/js/apprtc/apprtc.py
@@ -327,7 +327,6 @@
     if not stun_server:
       stun_server = get_default_stun_server(user_agent)
     turn_server = self.request.get('ts')
-
     ts_pwd = self.request.get('tp')
 
     # Use "audio" and "video" to set the media stream constraints. Defined here:
@@ -438,10 +437,15 @@
         logging.info('Room ' + room_key + ' is full')
         return
 
+    if turn_server == 'false':
+      turn_server = None
+      turn_url = ''
+    else:
+      turn_url = 'https://computeengineondemand.appspot.com/'
+      turn_url = turn_url + 'turn?' + 'username=' + user + '&key=4080218913'
+
     room_link = base_url + '?r=' + room_key
     room_link = append_url_arguments(self.request, room_link)
-    turn_url = 'https://computeengineondemand.appspot.com/'
-    turn_url = turn_url + 'turn?' + 'username=' + user + '&key=4080218913'
     token = create_channel(room, user, token_timeout)
     pc_config = make_pc_config(stun_server, turn_server, ts_pwd)
     pc_constraints = make_pc_constraints(compat, dscp)
diff --git a/samples/js/apprtc/index.html b/samples/js/apprtc/index.html
index 840d6f3..a240f29 100644
--- a/samples/js/apprtc/index.html
+++ b/samples/js/apprtc/index.html
@@ -22,8 +22,8 @@
   var roomKey = '{{ room_key }}';
   var roomLink = '{{ room_link }}';
   var initiator = {{ initiator }};
-  var pcConfig = {{ pc_config|safe }};
-  var pcConstraints = {{ pc_constraints|safe }};
+  var pcConfig = {{ pc_config | safe }};
+  var pcConstraints = {{ pc_constraints | safe }};
   var offerConstraints = {{ offer_constraints | safe }};
   var mediaConstraints = {{ media_constraints | safe }};
   var turnUrl = '{{ turn_url }}';
diff --git a/samples/js/apprtc/js/main.js b/samples/js/apprtc/js/main.js
index 3c0b73e..9a8a574 100644
--- a/samples/js/apprtc/js/main.js
+++ b/samples/js/apprtc/js/main.js
@@ -61,9 +61,7 @@
 }
 
 function maybeRequestTurn() {
-  // Skipping TURN Http request for Firefox version <=22.
-  // Firefox does not support TURN for version <=22.
-  if (webrtcDetectedBrowser === 'firefox' && webrtcDetectedVersion <=22) {
+  if (turnUrl == '') {
     turnDone = true;
     return;
   }