diff options
Diffstat (limited to 'webrtc/examples/peerconnection')
16 files changed, 60 insertions, 54 deletions
diff --git a/webrtc/examples/peerconnection/client/conductor.cc b/webrtc/examples/peerconnection/client/conductor.cc index e3def9955f..883f44a77b 100644 --- a/webrtc/examples/peerconnection/client/conductor.cc +++ b/webrtc/examples/peerconnection/client/conductor.cc @@ -113,28 +113,22 @@ bool Conductor::CreatePeerConnection(bool dtls) { ASSERT(peer_connection_factory_.get() != NULL); ASSERT(peer_connection_.get() == NULL); - webrtc::PeerConnectionInterface::IceServers servers; + webrtc::PeerConnectionInterface::RTCConfiguration config; webrtc::PeerConnectionInterface::IceServer server; server.uri = GetPeerConnectionString(); - servers.push_back(server); + config.servers.push_back(server); webrtc::FakeConstraints constraints; if (dtls) { constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, "true"); - } - else - { + } else { constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, "false"); } - peer_connection_ = - peer_connection_factory_->CreatePeerConnection(servers, - &constraints, - NULL, - NULL, - this); + peer_connection_ = peer_connection_factory_->CreatePeerConnection( + config, &constraints, NULL, NULL, this); return peer_connection_.get() != NULL; } diff --git a/webrtc/examples/peerconnection/client/conductor.h b/webrtc/examples/peerconnection/client/conductor.h index f5f16a3d10..e5ee170299 100644 --- a/webrtc/examples/peerconnection/client/conductor.h +++ b/webrtc/examples/peerconnection/client/conductor.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_ -#define TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_ #pragma once #include <deque> @@ -126,4 +126,4 @@ class Conductor std::string server_; }; -#endif // TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_ diff --git a/webrtc/examples/peerconnection/client/defaults.cc b/webrtc/examples/peerconnection/client/defaults.cc index 3090c15ca1..a2501c718f 100644 --- a/webrtc/examples/peerconnection/client/defaults.cc +++ b/webrtc/examples/peerconnection/client/defaults.cc @@ -19,6 +19,7 @@ #include <unistd.h> #endif +#include "webrtc/base/arraysize.h" #include "webrtc/base/common.h" const char kAudioLabel[] = "audio_label"; @@ -49,10 +50,12 @@ std::string GetDefaultServerName() { std::string GetPeerName() { char computer_name[256]; - if (gethostname(computer_name, ARRAY_SIZE(computer_name)) != 0) - strcpy(computer_name, "host"); std::string ret(GetEnvVarOrDefault("USERNAME", "user")); ret += '@'; - ret += computer_name; + if (gethostname(computer_name, arraysize(computer_name)) == 0) { + ret += computer_name; + } else { + ret += "host"; + } return ret; } diff --git a/webrtc/examples/peerconnection/client/defaults.h b/webrtc/examples/peerconnection/client/defaults.h index 7b503974e5..f4d3bf52f7 100644 --- a/webrtc/examples/peerconnection/client/defaults.h +++ b/webrtc/examples/peerconnection/client/defaults.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef PEERCONNECTION_SAMPLES_CLIENT_DEFAULTS_H_ -#define PEERCONNECTION_SAMPLES_CLIENT_DEFAULTS_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_DEFAULTS_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_DEFAULTS_H_ #pragma once #include <string> @@ -27,4 +27,4 @@ std::string GetPeerConnectionString(); std::string GetDefaultServerName(); std::string GetPeerName(); -#endif // PEERCONNECTION_SAMPLES_CLIENT_DEFAULTS_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_DEFAULTS_H_ diff --git a/webrtc/examples/peerconnection/client/flagdefs.h b/webrtc/examples/peerconnection/client/flagdefs.h index 0cffffb135..92e2773166 100644 --- a/webrtc/examples/peerconnection/client/flagdefs.h +++ b/webrtc/examples/peerconnection/client/flagdefs.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef TALK_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_ -#define TALK_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_ #pragma once #include "webrtc/base/flags.h" @@ -30,4 +30,4 @@ DEFINE_bool(autocall, false, "Call the first available other client on " "the server without user intervention. Note: this flag should only be set " "to true on one of the two clients."); -#endif // TALK_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_ diff --git a/webrtc/examples/peerconnection/client/linux/main.cc b/webrtc/examples/peerconnection/client/linux/main.cc index cf88c36fbb..4db929c82e 100644 --- a/webrtc/examples/peerconnection/client/linux/main.cc +++ b/webrtc/examples/peerconnection/client/linux/main.cc @@ -30,7 +30,7 @@ class CustomSocketServer : public rtc::PhysicalSocketServer { // Override so that we can also pump the GTK message loop. virtual bool Wait(int cms, bool process_io) { // Pump GTK events. - // TODO: We really should move either the socket server or UI to a + // TODO(henrike): We really should move either the socket server or UI to a // different thread. Alternatively we could look at merging the two loops // by implementing a dispatcher for the socket server and/or use // g_main_context_set_poll_func. @@ -96,10 +96,12 @@ int main(int argc, char* argv[]) { wnd.Destroy(); thread->set_socketserver(NULL); - // TODO: Run the Gtk main loop to tear down the connection. - //while (gtk_events_pending()) { - // gtk_main_iteration(); - //} + // TODO(henrike): Run the Gtk main loop to tear down the connection. + /* + while (gtk_events_pending()) { + gtk_main_iteration(); + } + */ rtc::CleanupSSL(); return 0; } diff --git a/webrtc/examples/peerconnection/client/linux/main_wnd.cc b/webrtc/examples/peerconnection/client/linux/main_wnd.cc index 254fb946f9..cf98c1cac7 100644 --- a/webrtc/examples/peerconnection/client/linux/main_wnd.cc +++ b/webrtc/examples/peerconnection/client/linux/main_wnd.cc @@ -116,7 +116,8 @@ gboolean Redraw(gpointer data) { wnd->OnRedraw(); return false; } -} // end anonymous + +} // namespace // // GtkMainWnd implementation. @@ -174,7 +175,8 @@ void GtkMainWnd::StopLocalRenderer() { local_renderer_.reset(); } -void GtkMainWnd::StartRemoteRenderer(webrtc::VideoTrackInterface* remote_video) { +void GtkMainWnd::StartRemoteRenderer( + webrtc::VideoTrackInterface* remote_video) { remote_renderer_.reset(new VideoRenderer(this, remote_video)); } @@ -488,7 +490,7 @@ void GtkMainWnd::VideoRenderer::RenderFrame( static_cast<int>(frame->GetHeight())); int size = width_ * height_ * 4; - // TODO: Convert directly to RGBA + // TODO(henrike): Convert directly to RGBA frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, image_.get(), size, diff --git a/webrtc/examples/peerconnection/client/linux/main_wnd.h b/webrtc/examples/peerconnection/client/linux/main_wnd.h index 1a91082768..e35d4dd8fa 100644 --- a/webrtc/examples/peerconnection/client/linux/main_wnd.h +++ b/webrtc/examples/peerconnection/client/linux/main_wnd.h @@ -8,8 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef PEERCONNECTION_SAMPLES_CLIENT_LINUX_MAIN_WND_H_ -#define PEERCONNECTION_SAMPLES_CLIENT_LINUX_MAIN_WND_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ + +#include <string> #include "webrtc/examples/peerconnection/client/main_wnd.h" #include "webrtc/examples/peerconnection/client/peer_connection_client.h" @@ -115,4 +117,4 @@ class GtkMainWnd : public MainWindow { int draw_buffer_size_; }; -#endif // PEERCONNECTION_SAMPLES_CLIENT_LINUX_MAIN_WND_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ diff --git a/webrtc/examples/peerconnection/client/main_wnd.cc b/webrtc/examples/peerconnection/client/main_wnd.cc index 30b12a8511..72f85b9eb2 100644 --- a/webrtc/examples/peerconnection/client/main_wnd.cc +++ b/webrtc/examples/peerconnection/client/main_wnd.cc @@ -13,6 +13,7 @@ #include <math.h> #include "webrtc/examples/peerconnection/client/defaults.h" +#include "webrtc/base/arraysize.h" #include "webrtc/base/common.h" #include "webrtc/base/logging.h" @@ -241,7 +242,7 @@ void MainWnd::OnPaint() { // Set the map mode so that the ratio will be maintained for us. HDC all_dc[] = { ps.hdc, dc_mem }; - for (int i = 0; i < ARRAY_SIZE(all_dc); ++i) { + for (int i = 0; i < arraysize(all_dc); ++i) { SetMapMode(all_dc[i], MM_ISOTROPIC); SetWindowExtEx(all_dc[i], width, height, NULL); SetViewportExtEx(all_dc[i], rc.right, rc.bottom, NULL); diff --git a/webrtc/examples/peerconnection/client/main_wnd.h b/webrtc/examples/peerconnection/client/main_wnd.h index 9f61a568fd..ac4fd8a9b9 100644 --- a/webrtc/examples/peerconnection/client/main_wnd.h +++ b/webrtc/examples/peerconnection/client/main_wnd.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef PEERCONNECTION_SAMPLES_CLIENT_MAIN_WND_H_ -#define PEERCONNECTION_SAMPLES_CLIENT_MAIN_WND_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ #pragma once #include <map> @@ -60,7 +60,8 @@ class MainWindow { virtual void StartLocalRenderer(webrtc::VideoTrackInterface* local_video) = 0; virtual void StopLocalRenderer() = 0; - virtual void StartRemoteRenderer(webrtc::VideoTrackInterface* remote_video) = 0; + virtual void StartRemoteRenderer( + webrtc::VideoTrackInterface* remote_video) = 0; virtual void StopRemoteRenderer() = 0; virtual void QueueUIThreadCallback(int msg_id, void* data) = 0; @@ -197,4 +198,4 @@ class MainWnd : public MainWindow { }; #endif // WIN32 -#endif // PEERCONNECTION_SAMPLES_CLIENT_MAIN_WND_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ diff --git a/webrtc/examples/peerconnection/client/peer_connection_client.cc b/webrtc/examples/peerconnection/client/peer_connection_client.cc index d49ce35060..9875115c4b 100644 --- a/webrtc/examples/peerconnection/client/peer_connection_client.cc +++ b/webrtc/examples/peerconnection/client/peer_connection_client.cc @@ -43,7 +43,7 @@ rtc::AsyncSocket* CreateClientSocket(int family) { #endif } -} +} // namespace PeerConnectionClient::PeerConnectionClient() : callback_(NULL), @@ -114,7 +114,7 @@ void PeerConnectionClient::Connect(const std::string& server, int port, server_address_.SetPort(port); client_name_ = client_name; - if (server_address_.IsUnresolved()) { + if (server_address_.IsUnresolvedIP()) { state_ = RESOLVING; resolver_ = new rtc::AsyncResolver(); resolver_->SignalDone.connect(this, &PeerConnectionClient::OnResolveResult); diff --git a/webrtc/examples/peerconnection/client/peer_connection_client.h b/webrtc/examples/peerconnection/client/peer_connection_client.h index 5b5787bc14..b7abfdfe18 100644 --- a/webrtc/examples/peerconnection/client/peer_connection_client.h +++ b/webrtc/examples/peerconnection/client/peer_connection_client.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef PEERCONNECTION_SAMPLES_CLIENT_PEER_CONNECTION_CLIENT_H_ -#define PEERCONNECTION_SAMPLES_CLIENT_PEER_CONNECTION_CLIENT_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_PEER_CONNECTION_CLIENT_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_PEER_CONNECTION_CLIENT_H_ #pragma once #include <map> @@ -120,4 +120,4 @@ class PeerConnectionClient : public sigslot::has_slots<>, int my_id_; }; -#endif // PEERCONNECTION_SAMPLES_CLIENT_PEER_CONNECTION_CLIENT_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_PEER_CONNECTION_CLIENT_H_ diff --git a/webrtc/examples/peerconnection/server/data_socket.h b/webrtc/examples/peerconnection/server/data_socket.h index 454ad3978a..0ef61ea6aa 100644 --- a/webrtc/examples/peerconnection/server/data_socket.h +++ b/webrtc/examples/peerconnection/server/data_socket.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef TALK_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_ -#define TALK_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_ #pragma once #ifdef WIN32 @@ -150,4 +150,4 @@ class ListeningSocket : public SocketBase { DataSocket* Accept() const; }; -#endif // TALK_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_ diff --git a/webrtc/examples/peerconnection/server/peer_channel.cc b/webrtc/examples/peerconnection/server/peer_channel.cc index 150e5dec97..5e173cd460 100644 --- a/webrtc/examples/peerconnection/server/peer_channel.cc +++ b/webrtc/examples/peerconnection/server/peer_channel.cc @@ -19,6 +19,7 @@ #include "webrtc/examples/peerconnection/server/data_socket.h" #include "webrtc/examples/peerconnection/server/utils.h" #include "webrtc/base/stringutils.h" +#include "webrtc/base/urlencode.h" using rtc::sprintfn; @@ -59,7 +60,7 @@ ChannelMember::ChannelMember(DataSocket* socket) assert(socket); assert(socket->method() == DataSocket::GET); assert(socket->PathEquals("/sign_in")); - name_ = socket->request_arguments(); // TODO: urldecode + name_ = rtc::UrlDecodeString(socket->request_arguments()); if (name_.empty()) name_ = "peer_" + int2str(id_); else if (name_.length() > kMaxNameLength) diff --git a/webrtc/examples/peerconnection/server/peer_channel.h b/webrtc/examples/peerconnection/server/peer_channel.h index 263f17dfa8..6fd740d2f9 100644 --- a/webrtc/examples/peerconnection/server/peer_channel.h +++ b/webrtc/examples/peerconnection/server/peer_channel.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef TALK_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_ -#define TALK_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_ #pragma once #include <time.h> @@ -117,4 +117,4 @@ class PeerChannel { Members members_; }; -#endif // TALK_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_ diff --git a/webrtc/examples/peerconnection/server/utils.h b/webrtc/examples/peerconnection/server/utils.h index e70968b875..e1c8729c0b 100644 --- a/webrtc/examples/peerconnection/server/utils.h +++ b/webrtc/examples/peerconnection/server/utils.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef TALK_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_ -#define TALK_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_ +#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_ +#define WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_ #pragma once #include <assert.h> @@ -22,4 +22,4 @@ std::string int2str(int i); std::string size_t2str(size_t i); -#endif // TALK_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_ +#endif // WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_ |