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/main_wnd.h" | 11 #include "webrtc/examples/peerconnection/client/main_wnd.h" |
12 | 12 |
13 #include <math.h> | 13 #include <math.h> |
14 | 14 |
15 #include "libyuv/convert_argb.h" | 15 #include "libyuv/convert_argb.h" |
16 #include "webrtc/examples/peerconnection/client/defaults.h" | 16 #include "webrtc/examples/peerconnection/client/defaults.h" |
17 #include "webrtc/base/arraysize.h" | 17 #include "webrtc/base/arraysize.h" |
18 #include "webrtc/base/common.h" | 18 #include "webrtc/base/common.h" |
19 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
| 20 #include "webrtc/media/engine/webrtcvideoframe.h" |
20 | 21 |
21 ATOM MainWnd::wnd_class_ = 0; | 22 ATOM MainWnd::wnd_class_ = 0; |
22 const wchar_t MainWnd::kClassName[] = L"WebRTC_MainWnd"; | 23 const wchar_t MainWnd::kClassName[] = L"WebRTC_MainWnd"; |
23 | 24 |
24 using rtc::sprintfn; | 25 using rtc::sprintfn; |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 const char kConnecting[] = "Connecting... "; | 29 const char kConnecting[] = "Connecting... "; |
29 const char kNoVideoStreams[] = "(no video streams either way)"; | 30 const char kNoVideoStreams[] = "(no video streams either way)"; |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 } | 594 } |
594 | 595 |
595 bmi_.bmiHeader.biWidth = width; | 596 bmi_.bmiHeader.biWidth = width; |
596 bmi_.bmiHeader.biHeight = -height; | 597 bmi_.bmiHeader.biHeight = -height; |
597 bmi_.bmiHeader.biSizeImage = width * height * | 598 bmi_.bmiHeader.biSizeImage = width * height * |
598 (bmi_.bmiHeader.biBitCount >> 3); | 599 (bmi_.bmiHeader.biBitCount >> 3); |
599 image_.reset(new uint8_t[bmi_.bmiHeader.biSizeImage]); | 600 image_.reset(new uint8_t[bmi_.bmiHeader.biSizeImage]); |
600 } | 601 } |
601 | 602 |
602 void MainWnd::VideoRenderer::OnFrame( | 603 void MainWnd::VideoRenderer::OnFrame( |
603 const webrtc::VideoFrame& video_frame) { | 604 const cricket::VideoFrame& video_frame) { |
604 | 605 |
605 { | 606 { |
606 AutoLock<VideoRenderer> lock(this); | 607 AutoLock<VideoRenderer> lock(this); |
607 | 608 |
608 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | 609 const cricket::WebRtcVideoFrame frame( |
609 webrtc::I420Buffer::Rotate(video_frame.video_frame_buffer(), | 610 webrtc::I420Buffer::Rotate(video_frame.video_frame_buffer(), |
610 video_frame.rotation())); | 611 video_frame.rotation()), |
| 612 webrtc::kVideoRotation_0, video_frame.timestamp_us()); |
611 | 613 |
612 SetSize(buffer->width(), buffer->height()); | 614 SetSize(frame.width(), frame.height()); |
613 | 615 |
614 ASSERT(image_.get() != NULL); | 616 ASSERT(image_.get() != NULL); |
| 617 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
| 618 frame.video_frame_buffer()); |
615 libyuv::I420ToARGB(buffer->DataY(), buffer->StrideY(), | 619 libyuv::I420ToARGB(buffer->DataY(), buffer->StrideY(), |
616 buffer->DataU(), buffer->StrideU(), | 620 buffer->DataU(), buffer->StrideU(), |
617 buffer->DataV(), buffer->StrideV(), | 621 buffer->DataV(), buffer->StrideV(), |
618 image_.get(), | 622 image_.get(), |
619 bmi_.bmiHeader.biWidth * | 623 bmi_.bmiHeader.biWidth * |
620 bmi_.bmiHeader.biBitCount / 8, | 624 bmi_.bmiHeader.biBitCount / 8, |
621 buffer->width(), buffer->height()); | 625 buffer->width(), buffer->height()); |
622 } | 626 } |
623 InvalidateRect(wnd_, NULL, TRUE); | 627 InvalidateRect(wnd_, NULL, TRUE); |
624 } | 628 } |
OLD | NEW |