OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/examples/peerconnection/client/defaults.h" | 11 #include "webrtc/examples/peerconnection/client/defaults.h" |
12 | 12 |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #ifdef WIN32 | 16 #ifdef WIN32 |
17 #include <winsock2.h> | 17 #include <winsock2.h> |
18 #else | 18 #else |
19 #include <unistd.h> | 19 #include <unistd.h> |
20 #endif | 20 #endif |
21 | 21 |
22 #include "webrtc/base/arraysize.h" | 22 #include "webrtc/rtc_base/arraysize.h" |
23 | 23 |
24 const char kAudioLabel[] = "audio_label"; | 24 const char kAudioLabel[] = "audio_label"; |
25 const char kVideoLabel[] = "video_label"; | 25 const char kVideoLabel[] = "video_label"; |
26 const char kStreamLabel[] = "stream_label"; | 26 const char kStreamLabel[] = "stream_label"; |
27 const uint16_t kDefaultServerPort = 8888; | 27 const uint16_t kDefaultServerPort = 8888; |
28 | 28 |
29 std::string GetEnvVarOrDefault(const char* env_var_name, | 29 std::string GetEnvVarOrDefault(const char* env_var_name, |
30 const char* default_value) { | 30 const char* default_value) { |
31 std::string value; | 31 std::string value; |
32 const char* env_var = getenv(env_var_name); | 32 const char* env_var = getenv(env_var_name); |
(...skipping 18 matching lines...) Expand all Loading... |
51 char computer_name[256]; | 51 char computer_name[256]; |
52 std::string ret(GetEnvVarOrDefault("USERNAME", "user")); | 52 std::string ret(GetEnvVarOrDefault("USERNAME", "user")); |
53 ret += '@'; | 53 ret += '@'; |
54 if (gethostname(computer_name, arraysize(computer_name)) == 0) { | 54 if (gethostname(computer_name, arraysize(computer_name)) == 0) { |
55 ret += computer_name; | 55 ret += computer_name; |
56 } else { | 56 } else { |
57 ret += "host"; | 57 ret += "host"; |
58 } | 58 } |
59 return ret; | 59 return ret; |
60 } | 60 } |
OLD | NEW |