Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: webrtc/examples/peerconnection/client/defaults.cc

Issue 1235563006: Move talk/examples/* to webrtc/examples. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 201508051337 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/examples/peerconnection/client/defaults.h"
12
13 #include <stdlib.h>
14 #include <string.h>
15
16 #ifdef WIN32
17 #include <winsock2.h>
18 #else
19 #include <unistd.h>
20 #endif
21
22 #include "webrtc/base/common.h"
23
24 const char kAudioLabel[] = "audio_label";
25 const char kVideoLabel[] = "video_label";
26 const char kStreamLabel[] = "stream_label";
27 const uint16 kDefaultServerPort = 8888;
28
29 std::string GetEnvVarOrDefault(const char* env_var_name,
30 const char* default_value) {
31 std::string value;
32 const char* env_var = getenv(env_var_name);
33 if (env_var)
34 value = env_var;
35
36 if (value.empty())
37 value = default_value;
38
39 return value;
40 }
41
42 std::string GetPeerConnectionString() {
43 return GetEnvVarOrDefault("WEBRTC_CONNECT", "stun:stun.l.google.com:19302");
44 }
45
46 std::string GetDefaultServerName() {
47 return GetEnvVarOrDefault("WEBRTC_SERVER", "localhost");
48 }
49
50 std::string GetPeerName() {
51 char computer_name[256];
52 if (gethostname(computer_name, ARRAY_SIZE(computer_name)) != 0)
53 strcpy(computer_name, "host");
54 std::string ret(GetEnvVarOrDefault("USERNAME", "user"));
55 ret += '@';
56 ret += computer_name;
57 return ret;
58 }
OLDNEW
« no previous file with comments | « webrtc/examples/peerconnection/client/defaults.h ('k') | webrtc/examples/peerconnection/client/flagdefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698