Enable cpplint for webrtc/examples and fix all uncovered cpplint errors.
BUG=webrtc:5273 TESTED=Fixed issues reported by: find webrtc/examples/ -type f -name *.cc -o -name *.h | grep -v objc | xargs cpplint.py followed by 'git cl presubmit'. NOTRY=True Review URL: https://codereview.webrtc.org/1504283004 Cr-Commit-Position: refs/heads/master@{#10960}
This commit is contained in:
@ -18,6 +18,7 @@ import sys
|
|||||||
CPPLINT_DIRS = [
|
CPPLINT_DIRS = [
|
||||||
'webrtc/audio',
|
'webrtc/audio',
|
||||||
'webrtc/call',
|
'webrtc/call',
|
||||||
|
'webrtc/examples',
|
||||||
'webrtc/modules/video_processing',
|
'webrtc/modules/video_processing',
|
||||||
'webrtc/video',
|
'webrtc/video',
|
||||||
]
|
]
|
||||||
|
@ -122,9 +122,7 @@ bool Conductor::CreatePeerConnection(bool dtls) {
|
|||||||
if (dtls) {
|
if (dtls) {
|
||||||
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
||||||
"true");
|
"true");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
||||||
"false");
|
"false");
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
||||||
#define TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
@ -126,4 +126,4 @@ class Conductor
|
|||||||
std::string server_;
|
std::string server_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TALK_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_CONDUCTOR_H_
|
||||||
|
@ -50,10 +50,12 @@ std::string GetDefaultServerName() {
|
|||||||
|
|
||||||
std::string GetPeerName() {
|
std::string GetPeerName() {
|
||||||
char computer_name[256];
|
char computer_name[256];
|
||||||
if (gethostname(computer_name, arraysize(computer_name)) != 0)
|
|
||||||
strcpy(computer_name, "host");
|
|
||||||
std::string ret(GetEnvVarOrDefault("USERNAME", "user"));
|
std::string ret(GetEnvVarOrDefault("USERNAME", "user"));
|
||||||
ret += '@';
|
ret += '@';
|
||||||
ret += computer_name;
|
if (gethostname(computer_name, arraysize(computer_name)) == 0) {
|
||||||
|
ret += computer_name;
|
||||||
|
} else {
|
||||||
|
ret += "host";
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PEERCONNECTION_SAMPLES_CLIENT_DEFAULTS_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_DEFAULTS_H_
|
||||||
#define PEERCONNECTION_SAMPLES_CLIENT_DEFAULTS_H_
|
#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_DEFAULTS_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -27,4 +27,4 @@ std::string GetPeerConnectionString();
|
|||||||
std::string GetDefaultServerName();
|
std::string GetDefaultServerName();
|
||||||
std::string GetPeerName();
|
std::string GetPeerName();
|
||||||
|
|
||||||
#endif // PEERCONNECTION_SAMPLES_CLIENT_DEFAULTS_H_
|
#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_DEFAULTS_H_
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TALK_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_
|
||||||
#define TALK_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_
|
#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "webrtc/base/flags.h"
|
#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 "
|
"the server without user intervention. Note: this flag should only be set "
|
||||||
"to true on one of the two clients.");
|
"to true on one of the two clients.");
|
||||||
|
|
||||||
#endif // TALK_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_
|
#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_
|
||||||
|
@ -30,7 +30,7 @@ class CustomSocketServer : public rtc::PhysicalSocketServer {
|
|||||||
// Override so that we can also pump the GTK message loop.
|
// Override so that we can also pump the GTK message loop.
|
||||||
virtual bool Wait(int cms, bool process_io) {
|
virtual bool Wait(int cms, bool process_io) {
|
||||||
// Pump GTK events.
|
// 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
|
// different thread. Alternatively we could look at merging the two loops
|
||||||
// by implementing a dispatcher for the socket server and/or use
|
// by implementing a dispatcher for the socket server and/or use
|
||||||
// g_main_context_set_poll_func.
|
// g_main_context_set_poll_func.
|
||||||
@ -96,10 +96,12 @@ int main(int argc, char* argv[]) {
|
|||||||
wnd.Destroy();
|
wnd.Destroy();
|
||||||
|
|
||||||
thread->set_socketserver(NULL);
|
thread->set_socketserver(NULL);
|
||||||
// TODO: Run the Gtk main loop to tear down the connection.
|
// TODO(henrike): Run the Gtk main loop to tear down the connection.
|
||||||
//while (gtk_events_pending()) {
|
/*
|
||||||
// gtk_main_iteration();
|
while (gtk_events_pending()) {
|
||||||
//}
|
gtk_main_iteration();
|
||||||
|
}
|
||||||
|
*/
|
||||||
rtc::CleanupSSL();
|
rtc::CleanupSSL();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,8 @@ gboolean Redraw(gpointer data) {
|
|||||||
wnd->OnRedraw();
|
wnd->OnRedraw();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} // end anonymous
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
//
|
//
|
||||||
// GtkMainWnd implementation.
|
// GtkMainWnd implementation.
|
||||||
@ -174,7 +175,8 @@ void GtkMainWnd::StopLocalRenderer() {
|
|||||||
local_renderer_.reset();
|
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));
|
remote_renderer_.reset(new VideoRenderer(this, remote_video));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +490,7 @@ void GtkMainWnd::VideoRenderer::RenderFrame(
|
|||||||
static_cast<int>(frame->GetHeight()));
|
static_cast<int>(frame->GetHeight()));
|
||||||
|
|
||||||
int size = width_ * height_ * 4;
|
int size = width_ * height_ * 4;
|
||||||
// TODO: Convert directly to RGBA
|
// TODO(henrike): Convert directly to RGBA
|
||||||
frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB,
|
frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB,
|
||||||
image_.get(),
|
image_.get(),
|
||||||
size,
|
size,
|
||||||
|
@ -8,8 +8,10 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PEERCONNECTION_SAMPLES_CLIENT_LINUX_MAIN_WND_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_
|
||||||
#define PEERCONNECTION_SAMPLES_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/main_wnd.h"
|
||||||
#include "webrtc/examples/peerconnection/client/peer_connection_client.h"
|
#include "webrtc/examples/peerconnection/client/peer_connection_client.h"
|
||||||
@ -115,4 +117,4 @@ class GtkMainWnd : public MainWindow {
|
|||||||
int draw_buffer_size_;
|
int draw_buffer_size_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PEERCONNECTION_SAMPLES_CLIENT_LINUX_MAIN_WND_H_
|
#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PEERCONNECTION_SAMPLES_CLIENT_MAIN_WND_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_
|
||||||
#define PEERCONNECTION_SAMPLES_CLIENT_MAIN_WND_H_
|
#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -60,7 +60,8 @@ class MainWindow {
|
|||||||
|
|
||||||
virtual void StartLocalRenderer(webrtc::VideoTrackInterface* local_video) = 0;
|
virtual void StartLocalRenderer(webrtc::VideoTrackInterface* local_video) = 0;
|
||||||
virtual void StopLocalRenderer() = 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 StopRemoteRenderer() = 0;
|
||||||
|
|
||||||
virtual void QueueUIThreadCallback(int msg_id, void* data) = 0;
|
virtual void QueueUIThreadCallback(int msg_id, void* data) = 0;
|
||||||
@ -197,4 +198,4 @@ class MainWnd : public MainWindow {
|
|||||||
};
|
};
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
#endif // PEERCONNECTION_SAMPLES_CLIENT_MAIN_WND_H_
|
#endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_
|
||||||
|
@ -43,7 +43,7 @@ rtc::AsyncSocket* CreateClientSocket(int family) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
PeerConnectionClient::PeerConnectionClient()
|
PeerConnectionClient::PeerConnectionClient()
|
||||||
: callback_(NULL),
|
: callback_(NULL),
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PEERCONNECTION_SAMPLES_CLIENT_PEER_CONNECTION_CLIENT_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_PEER_CONNECTION_CLIENT_H_
|
||||||
#define PEERCONNECTION_SAMPLES_CLIENT_PEER_CONNECTION_CLIENT_H_
|
#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_PEER_CONNECTION_CLIENT_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -120,4 +120,4 @@ class PeerConnectionClient : public sigslot::has_slots<>,
|
|||||||
int my_id_;
|
int my_id_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PEERCONNECTION_SAMPLES_CLIENT_PEER_CONNECTION_CLIENT_H_
|
#endif // 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.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TALK_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_
|
||||||
#define TALK_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_
|
#define WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -150,4 +150,4 @@ class ListeningSocket : public SocketBase {
|
|||||||
DataSocket* Accept() const;
|
DataSocket* Accept() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TALK_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_
|
#endif // WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_DATA_SOCKET_H_
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "webrtc/examples/peerconnection/server/data_socket.h"
|
#include "webrtc/examples/peerconnection/server/data_socket.h"
|
||||||
#include "webrtc/examples/peerconnection/server/utils.h"
|
#include "webrtc/examples/peerconnection/server/utils.h"
|
||||||
#include "webrtc/base/stringutils.h"
|
#include "webrtc/base/stringutils.h"
|
||||||
|
#include "webrtc/base/urlencode.h"
|
||||||
|
|
||||||
using rtc::sprintfn;
|
using rtc::sprintfn;
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ ChannelMember::ChannelMember(DataSocket* socket)
|
|||||||
assert(socket);
|
assert(socket);
|
||||||
assert(socket->method() == DataSocket::GET);
|
assert(socket->method() == DataSocket::GET);
|
||||||
assert(socket->PathEquals("/sign_in"));
|
assert(socket->PathEquals("/sign_in"));
|
||||||
name_ = socket->request_arguments(); // TODO: urldecode
|
name_ = rtc::UrlDecodeString(socket->request_arguments());
|
||||||
if (name_.empty())
|
if (name_.empty())
|
||||||
name_ = "peer_" + int2str(id_);
|
name_ = "peer_" + int2str(id_);
|
||||||
else if (name_.length() > kMaxNameLength)
|
else if (name_.length() > kMaxNameLength)
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TALK_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_
|
||||||
#define TALK_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_
|
#define WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -117,4 +117,4 @@ class PeerChannel {
|
|||||||
Members members_;
|
Members members_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TALK_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_
|
#endif // WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_PEER_CHANNEL_H_
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TALK_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_
|
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_
|
||||||
#define TALK_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_
|
#define WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -22,4 +22,4 @@
|
|||||||
std::string int2str(int i);
|
std::string int2str(int i);
|
||||||
std::string size_t2str(size_t i);
|
std::string size_t2str(size_t i);
|
||||||
|
|
||||||
#endif // TALK_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_
|
#endif // WEBRTC_EXAMPLES_PEERCONNECTION_SERVER_UTILS_H_
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "webrtc/p2p/base/stunserver.h"
|
#include "webrtc/p2p/base/stunserver.h"
|
||||||
#include "webrtc/base/thread.h"
|
#include "webrtc/base/thread.h"
|
||||||
|
|
||||||
using namespace cricket;
|
using cricket::StunServer;
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
|
Reference in New Issue
Block a user