Reformat the WebRTC code base
Running clang-format with chromium's style guide. The goal is n-fold: * providing consistency and readability (that's what code guidelines are for) * preventing noise with presubmit checks and git cl format * building on the previous point: making it easier to automatically fix format issues * you name it Please consider using git-hyper-blame to ignore this commit. Bug: webrtc:9340 Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87 Reviewed-on: https://webrtc-review.googlesource.com/81185 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
@ -30,7 +30,8 @@ namespace {
|
||||
// GtkMainWnd instance.
|
||||
//
|
||||
|
||||
gboolean OnDestroyedCallback(GtkWidget* widget, GdkEvent* event,
|
||||
gboolean OnDestroyedCallback(GtkWidget* widget,
|
||||
GdkEvent* event,
|
||||
gpointer data) {
|
||||
reinterpret_cast<GtkMainWnd*>(data)->OnDestroyed(widget, event);
|
||||
return FALSE;
|
||||
@ -45,14 +46,17 @@ gboolean SimulateButtonClick(gpointer button) {
|
||||
return false;
|
||||
}
|
||||
|
||||
gboolean OnKeyPressCallback(GtkWidget* widget, GdkEventKey* key,
|
||||
gboolean OnKeyPressCallback(GtkWidget* widget,
|
||||
GdkEventKey* key,
|
||||
gpointer data) {
|
||||
reinterpret_cast<GtkMainWnd*>(data)->OnKeyPress(widget, key);
|
||||
return false;
|
||||
}
|
||||
|
||||
void OnRowActivatedCallback(GtkTreeView* tree_view, GtkTreePath* path,
|
||||
GtkTreeViewColumn* column, gpointer data) {
|
||||
void OnRowActivatedCallback(GtkTreeView* tree_view,
|
||||
GtkTreePath* path,
|
||||
GtkTreeViewColumn* column,
|
||||
gpointer data) {
|
||||
reinterpret_cast<GtkMainWnd*>(data)->OnRowActivated(tree_view, path, column);
|
||||
}
|
||||
|
||||
@ -90,8 +94,8 @@ void InitializeList(GtkWidget* list) {
|
||||
|
||||
// Adds an entry to a tree view.
|
||||
void AddToList(GtkWidget* list, const gchar* str, int value) {
|
||||
GtkListStore* store = GTK_LIST_STORE(
|
||||
gtk_tree_view_get_model(GTK_TREE_VIEW(list)));
|
||||
GtkListStore* store =
|
||||
GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list)));
|
||||
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append(store, &iter);
|
||||
@ -131,11 +135,20 @@ gboolean Draw(GtkWidget* widget, cairo_t* cr, gpointer data) {
|
||||
// GtkMainWnd implementation.
|
||||
//
|
||||
|
||||
GtkMainWnd::GtkMainWnd(const char* server, int port, bool autoconnect,
|
||||
GtkMainWnd::GtkMainWnd(const char* server,
|
||||
int port,
|
||||
bool autoconnect,
|
||||
bool autocall)
|
||||
: window_(NULL), draw_area_(NULL), vbox_(NULL), server_edit_(NULL),
|
||||
port_edit_(NULL), peer_list_(NULL), callback_(NULL),
|
||||
server_(server), autoconnect_(autoconnect), autocall_(autocall) {
|
||||
: window_(NULL),
|
||||
draw_area_(NULL),
|
||||
vbox_(NULL),
|
||||
server_edit_(NULL),
|
||||
port_edit_(NULL),
|
||||
peer_list_(NULL),
|
||||
callback_(NULL),
|
||||
server_(server),
|
||||
autoconnect_(autoconnect),
|
||||
autocall_(autocall) {
|
||||
char buffer[10];
|
||||
sprintfn(buffer, sizeof(buffer), "%i", port);
|
||||
port_ = buffer;
|
||||
@ -153,12 +166,13 @@ bool GtkMainWnd::IsWindow() {
|
||||
return window_ != NULL && GTK_IS_WINDOW(window_);
|
||||
}
|
||||
|
||||
void GtkMainWnd::MessageBox(const char* caption, const char* text,
|
||||
void GtkMainWnd::MessageBox(const char* caption,
|
||||
const char* text,
|
||||
bool is_error) {
|
||||
GtkWidget* dialog = gtk_message_dialog_new(GTK_WINDOW(window_),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
is_error ? GTK_MESSAGE_ERROR : GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE, "%s", text);
|
||||
GtkWidget* dialog = gtk_message_dialog_new(
|
||||
GTK_WINDOW(window_), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
is_error ? GTK_MESSAGE_ERROR : GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s",
|
||||
text);
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), caption);
|
||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy(dialog);
|
||||
@ -174,7 +188,6 @@ MainWindow::UI GtkMainWnd::current_ui() {
|
||||
return STREAMING;
|
||||
}
|
||||
|
||||
|
||||
void GtkMainWnd::StartLocalRenderer(webrtc::VideoTrackInterface* local_video) {
|
||||
local_renderer_.reset(new VideoRenderer(this, local_video));
|
||||
}
|
||||
@ -394,7 +407,8 @@ void GtkMainWnd::OnKeyPress(GtkWidget* widget, GdkEventKey* key) {
|
||||
}
|
||||
}
|
||||
|
||||
void GtkMainWnd::OnRowActivated(GtkTreeView* tree_view, GtkTreePath* path,
|
||||
void GtkMainWnd::OnRowActivated(GtkTreeView* tree_view,
|
||||
GtkTreePath* path,
|
||||
GtkTreeViewColumn* column) {
|
||||
RTC_DCHECK(peer_list_ != NULL);
|
||||
GtkTreeIter iter;
|
||||
@ -402,12 +416,12 @@ void GtkMainWnd::OnRowActivated(GtkTreeView* tree_view, GtkTreePath* path,
|
||||
GtkTreeSelection* selection =
|
||||
gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
|
||||
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
|
||||
char* text;
|
||||
int id = -1;
|
||||
gtk_tree_model_get(model, &iter, 0, &text, 1, &id, -1);
|
||||
if (id != -1)
|
||||
callback_->ConnectToPeer(id);
|
||||
g_free(text);
|
||||
char* text;
|
||||
int id = -1;
|
||||
gtk_tree_model_get(model, &iter, 0, &text, 1, &id, -1);
|
||||
if (id != -1)
|
||||
callback_->ConnectToPeer(id);
|
||||
g_free(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,8 +533,7 @@ void GtkMainWnd::VideoRenderer::SetSize(int width, int height) {
|
||||
gdk_threads_leave();
|
||||
}
|
||||
|
||||
void GtkMainWnd::VideoRenderer::OnFrame(
|
||||
const webrtc::VideoFrame& video_frame) {
|
||||
void GtkMainWnd::VideoRenderer::OnFrame(const webrtc::VideoFrame& video_frame) {
|
||||
gdk_threads_enter();
|
||||
|
||||
rtc::scoped_refptr<webrtc::I420BufferInterface> buffer(
|
||||
@ -536,11 +549,10 @@ void GtkMainWnd::VideoRenderer::OnFrame(
|
||||
// This was supposed to be a call to libyuv::I420ToRGBA but it was resulting
|
||||
// in a reddish video output (see https://bugs.webrtc.org/6857) because it
|
||||
// was producing an unexpected byte order (ABGR, byte swapped).
|
||||
libyuv::I420ToABGR(buffer->DataY(), buffer->StrideY(),
|
||||
buffer->DataU(), buffer->StrideU(),
|
||||
buffer->DataV(), buffer->StrideV(),
|
||||
image_.get(), width_ * 4,
|
||||
buffer->width(), buffer->height());
|
||||
libyuv::I420ToABGR(buffer->DataY(), buffer->StrideY(), buffer->DataU(),
|
||||
buffer->StrideU(), buffer->DataV(), buffer->StrideV(),
|
||||
image_.get(), width_ * 4, buffer->width(),
|
||||
buffer->height());
|
||||
|
||||
gdk_threads_leave();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user