| 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/linux/main_wnd.h" | 11 #include "webrtc/examples/peerconnection/client/linux/main_wnd.h" |
| 12 | 12 |
| 13 #include <gdk/gdkkeysyms.h> | 13 #include <gdk/gdkkeysyms.h> |
| 14 #include <gtk/gtk.h> | 14 #include <gtk/gtk.h> |
| 15 #include <stddef.h> | 15 #include <stddef.h> |
| 16 | 16 |
| 17 #include "libyuv/convert_from.h" | 17 #include "libyuv/convert_from.h" |
| 18 #include "webrtc/api/video/i420_buffer.h" |
| 18 #include "webrtc/examples/peerconnection/client/defaults.h" | 19 #include "webrtc/examples/peerconnection/client/defaults.h" |
| 19 #include "webrtc/base/common.h" | 20 #include "webrtc/base/common.h" |
| 20 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/stringutils.h" | 22 #include "webrtc/base/stringutils.h" |
| 22 | 23 |
| 23 using rtc::sprintfn; | 24 using rtc::sprintfn; |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 // | 28 // |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 height_ = height; | 480 height_ = height; |
| 480 image_.reset(new uint8_t[width * height * 4]); | 481 image_.reset(new uint8_t[width * height * 4]); |
| 481 gdk_threads_leave(); | 482 gdk_threads_leave(); |
| 482 } | 483 } |
| 483 | 484 |
| 484 void GtkMainWnd::VideoRenderer::OnFrame( | 485 void GtkMainWnd::VideoRenderer::OnFrame( |
| 485 const webrtc::VideoFrame& video_frame) { | 486 const webrtc::VideoFrame& video_frame) { |
| 486 gdk_threads_enter(); | 487 gdk_threads_enter(); |
| 487 | 488 |
| 488 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | 489 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
| 489 webrtc::I420Buffer::Rotate(video_frame.video_frame_buffer(), | 490 video_frame.video_frame_buffer()); |
| 490 video_frame.rotation())); | 491 if (video_frame.rotation() != webrtc::kVideoRotation_0) { |
| 491 | 492 buffer = webrtc::I420Buffer::Rotate(*buffer, video_frame.rotation()); |
| 493 } |
| 492 SetSize(buffer->width(), buffer->height()); | 494 SetSize(buffer->width(), buffer->height()); |
| 493 | 495 |
| 494 libyuv::I420ToRGBA(buffer->DataY(), buffer->StrideY(), | 496 libyuv::I420ToRGBA(buffer->DataY(), buffer->StrideY(), |
| 495 buffer->DataU(), buffer->StrideU(), | 497 buffer->DataU(), buffer->StrideU(), |
| 496 buffer->DataV(), buffer->StrideV(), | 498 buffer->DataV(), buffer->StrideV(), |
| 497 image_.get(), width_ * 4, | 499 image_.get(), width_ * 4, |
| 498 buffer->width(), buffer->height()); | 500 buffer->width(), buffer->height()); |
| 499 | 501 |
| 500 gdk_threads_leave(); | 502 gdk_threads_leave(); |
| 501 | 503 |
| 502 g_idle_add(Redraw, main_wnd_); | 504 g_idle_add(Redraw, main_wnd_); |
| 503 } | 505 } |
| OLD | NEW |