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/examples/peerconnection/client/defaults.h" | 18 #include "webrtc/examples/peerconnection/client/defaults.h" |
19 #include "webrtc/base/common.h" | 19 #include "webrtc/base/common.h" |
20 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
21 #include "webrtc/base/stringutils.h" | 21 #include "webrtc/base/stringutils.h" |
22 #include "webrtc/media/engine/webrtcvideoframe.h" | |
23 | 22 |
24 using rtc::sprintfn; | 23 using rtc::sprintfn; |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 // | 27 // |
29 // Simple static functions that simply forward the callback to the | 28 // Simple static functions that simply forward the callback to the |
30 // GtkMainWnd instance. | 29 // GtkMainWnd instance. |
31 // | 30 // |
32 | 31 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 return; | 475 return; |
477 } | 476 } |
478 | 477 |
479 width_ = width; | 478 width_ = width; |
480 height_ = height; | 479 height_ = height; |
481 image_.reset(new uint8_t[width * height * 4]); | 480 image_.reset(new uint8_t[width * height * 4]); |
482 gdk_threads_leave(); | 481 gdk_threads_leave(); |
483 } | 482 } |
484 | 483 |
485 void GtkMainWnd::VideoRenderer::OnFrame( | 484 void GtkMainWnd::VideoRenderer::OnFrame( |
486 const cricket::VideoFrame& video_frame) { | 485 const webrtc::VideoFrame& video_frame) { |
487 gdk_threads_enter(); | 486 gdk_threads_enter(); |
488 | 487 |
489 const cricket::WebRtcVideoFrame frame( | 488 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
490 webrtc::I420Buffer::Rotate(video_frame.video_frame_buffer(), | 489 webrtc::I420Buffer::Rotate(video_frame.video_frame_buffer(), |
491 video_frame.rotation()), | 490 video_frame.rotation())); |
492 webrtc::kVideoRotation_0, video_frame.timestamp_us()); | |
493 | 491 |
494 SetSize(frame.width(), frame.height()); | 492 SetSize(buffer->width(), buffer->height()); |
495 | 493 |
496 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | |
497 frame.video_frame_buffer()); | |
498 libyuv::I420ToRGBA(buffer->DataY(), buffer->StrideY(), | 494 libyuv::I420ToRGBA(buffer->DataY(), buffer->StrideY(), |
499 buffer->DataU(), buffer->StrideU(), | 495 buffer->DataU(), buffer->StrideU(), |
500 buffer->DataV(), buffer->StrideV(), | 496 buffer->DataV(), buffer->StrideV(), |
501 image_.get(), width_ * 4, | 497 image_.get(), width_ * 4, |
502 buffer->width(), buffer->height()); | 498 buffer->width(), buffer->height()); |
503 | 499 |
504 gdk_threads_leave(); | 500 gdk_threads_leave(); |
505 | 501 |
506 g_idle_add(Redraw, main_wnd_); | 502 g_idle_add(Redraw, main_wnd_); |
507 } | 503 } |
OLD | NEW |