| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 rtc::EnsureWinsockInit(); | 23 rtc::EnsureWinsockInit(); |
| 24 rtc::Win32Thread w32_thread; | 24 rtc::Win32Thread w32_thread; |
| 25 rtc::ThreadManager::Instance()->SetCurrentThread(&w32_thread); | 25 rtc::ThreadManager::Instance()->SetCurrentThread(&w32_thread); |
| 26 | 26 |
| 27 rtc::WindowsCommandLineArguments win_args; | 27 rtc::WindowsCommandLineArguments win_args; |
| 28 int argc = win_args.argc(); | 28 int argc = win_args.argc(); |
| 29 char **argv = win_args.argv(); | 29 char **argv = win_args.argv(); |
| 30 | 30 |
| 31 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | 31 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
| 32 if (FLAG_help) { | 32 if (FLAG_help) { |
| 33 rtc::FlagList::Print(NULL, false); | 33 rtc::FlagList::Print(nullptr, false); |
| 34 return 0; | 34 return 0; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Abort if the user specifies a port that is outside the allowed | 37 // Abort if the user specifies a port that is outside the allowed |
| 38 // range [1, 65535]. | 38 // range [1, 65535]. |
| 39 if ((FLAG_port < 1) || (FLAG_port > 65535)) { | 39 if ((FLAG_port < 1) || (FLAG_port > 65535)) { |
| 40 printf("Error: %i is not a valid port.\n", FLAG_port); | 40 printf("Error: %i is not a valid port.\n", FLAG_port); |
| 41 return -1; | 41 return -1; |
| 42 } | 42 } |
| 43 | 43 |
| 44 MainWnd wnd(FLAG_server, FLAG_port, FLAG_autoconnect, FLAG_autocall); | 44 MainWnd wnd(FLAG_server, FLAG_port, FLAG_autoconnect, FLAG_autocall); |
| 45 if (!wnd.Create()) { | 45 if (!wnd.Create()) { |
| 46 RTC_NOTREACHED(); | 46 RTC_NOTREACHED(); |
| 47 return -1; | 47 return -1; |
| 48 } | 48 } |
| 49 | 49 |
| 50 rtc::InitializeSSL(); | 50 rtc::InitializeSSL(); |
| 51 PeerConnectionClient client; | 51 PeerConnectionClient client; |
| 52 rtc::scoped_refptr<Conductor> conductor( | 52 rtc::scoped_refptr<Conductor> conductor( |
| 53 new rtc::RefCountedObject<Conductor>(&client, &wnd)); | 53 new rtc::RefCountedObject<Conductor>(&client, &wnd)); |
| 54 | 54 |
| 55 // Main loop. | 55 // Main loop. |
| 56 MSG msg; | 56 MSG msg; |
| 57 BOOL gm; | 57 BOOL gm; |
| 58 while ((gm = ::GetMessage(&msg, NULL, 0, 0)) != 0 && gm != -1) { | 58 while ((gm = ::GetMessage(&msg, nullptr, 0, 0)) != 0 && gm != -1) { |
| 59 if (!wnd.PreTranslateMessage(&msg)) { | 59 if (!wnd.PreTranslateMessage(&msg)) { |
| 60 ::TranslateMessage(&msg); | 60 ::TranslateMessage(&msg); |
| 61 ::DispatchMessage(&msg); | 61 ::DispatchMessage(&msg); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (conductor->connection_active() || client.is_connected()) { | 65 if (conductor->connection_active() || client.is_connected()) { |
| 66 while ((conductor->connection_active() || client.is_connected()) && | 66 while ((conductor->connection_active() || client.is_connected()) && |
| 67 (gm = ::GetMessage(&msg, NULL, 0, 0)) != 0 && gm != -1) { | 67 (gm = ::GetMessage(&msg, nullptr, 0, 0)) != 0 && gm != -1) { |
| 68 if (!wnd.PreTranslateMessage(&msg)) { | 68 if (!wnd.PreTranslateMessage(&msg)) { |
| 69 ::TranslateMessage(&msg); | 69 ::TranslateMessage(&msg); |
| 70 ::DispatchMessage(&msg); | 70 ::DispatchMessage(&msg); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 rtc::CleanupSSL(); | 75 rtc::CleanupSSL(); |
| 76 return 0; | 76 return 0; |
| 77 } | 77 } |
| OLD | NEW |