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